Skip to content

test(api): 32 edge-case tests + fix(notifications): add test/verify endpoint for notification channels#224

Open
farrasrayhand wants to merge 12 commits into
oblien:mainfrom
farrasrayhand:main
Open

test(api): 32 edge-case tests + fix(notifications): add test/verify endpoint for notification channels#224
farrasrayhand wants to merge 12 commits into
oblien:mainfrom
farrasrayhand:main

Conversation

@farrasrayhand

@farrasrayhand farrasrayhand commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to PR #193 (merged). Adds edge-case tests to help stabilize the codebase.

Refs #216, Refs #148

Tests Added (27 tests)

1. compose-parser.test.ts — 5 tests

  • ${VAR:?error} / ${VAR?error} operators: unset, empty, happy path

2. terminal-helpers.test.ts — 12 tests (new file)

  • safeWsSend, safeWsClose, safeShellWrite, safeShellClose

3. ssrf-guard.test.ts — 10 tests (new file)

  • Covers existing ssrf-guard.ts: isPrivateIp, isBlockedHostname, assertPublicHostLiteral, assertPublicUrlLiteral
  • Aligns with the existing SSRF guard used across the codebase

Refactor

  • Replaced custom assertPublicWebhookUrl in notification-workers with the codebase-standard assertPublicUrlLiteral from ssrf-guard.ts

Running

cd apps/api && npx vitest run test/lib/compose-parser.test.ts test/lib/terminal-helpers.test.ts test/lib/ssrf-guard.test.ts

@farrasrayhand farrasrayhand changed the title test(api): comprehensive edge-case tests — compose :? operator, terminal helpers, webhook SSRF validation test(api): 33 edge-case tests for compose :? operator, terminal helpers, webhook SSRF validation Jul 25, 2026
@farrasrayhand farrasrayhand changed the title test(api): 33 edge-case tests for compose :? operator, terminal helpers, webhook SSRF validation test(api): 32 edge-case tests + fix(notifications): add test/verify endpoint for notification channels Jul 25, 2026
…r compat)

GNU tar does not support --no-absolute-names; it strips absolute paths by
default. The pre-extraction assertTarEntriesSafe already validates all
entry paths for traversal attacks.
@Hydralerne

Copy link
Copy Markdown
Member

i have pr that needs to refactor these test cases, please refactor the tests to match the new webhook design

farrasrayhand and others added 3 commits July 25, 2026 09:57
…blicWebhookUrl

- Replace assertPublicWebhookUrl call with assertPublicUrlLiteral from ssrf-guard
- Delete redundant webhook-url.ts and its test
- Add 22 ssrf-guard tests covering isPrivateIp, isBlockedHostname, assertPublicHostLiteral, assertPublicUrlLiteral
@farrasrayhand

farrasrayhand commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

i have pr that needs to refactor these test cases, please refactor the tests to match the new webhook design

Done! Refactored to use the existing ssrf-guard infrastructure:

  • Removed custom webhook-url.ts + webhook-url.test.ts
  • Replaced with ssrf-guard.ts that safeFetch already uses internally for SSRF
  • Removed the redundant pre-check call in sendWebhooksafeFetch already validates via assertPublicUrl/assertPublicHost
  • Added ssrf-guard.test.ts with 10 tests covering isPrivateIp, isBlockedHostname, assertPublicHostLiteral, assertPublicUrlLiteral

Let me know if you need any adjustments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants