Skip to content

test(backend): add unit tests for authCookie and networkSafety#235

Merged
solomon2773 merged 1 commit into
solomon2773:masterfrom
oldregime:add-unit-tests-authcookie-networksafety
Jun 28, 2026
Merged

test(backend): add unit tests for authCookie and networkSafety#235
solomon2773 merged 1 commit into
solomon2773:masterfrom
oldregime:add-unit-tests-authcookie-networksafety

Conversation

@oldregime

@oldregime oldregime commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This PR adds comprehensive unit test suites for two core backend helper modules:

  1. backend-api/authCookie.ts: Tests cookie parsing, reading, setting, and clearing.
  2. backend-api/networkSafety.ts: Tests URL and protocol validation, lexical IP matches, and async DNS resolution.

Additionally, this resolves a minor bug in the synchronous check within assertSafeUrl to properly strip square brackets from IPv6 hostnames (e.g. [::1]), ensuring literal local IPv6 addresses are blocked synchronously in the fast pass.

Closes #220
Closes #221

@solomon2773 solomon2773 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused backend checks passed locally: authCookie/networkSafety Jest coverage and backend typecheck. The IPv6 literal hostname fix is a security-positive correction.

@solomon2773 solomon2773 merged commit ec89235 into solomon2773:master Jun 28, 2026
53 checks passed
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.

Tests: add unit tests for backend-api/networkSafety.ts (SSRF guards) Tests: add unit tests for backend-api/authCookie.ts

2 participants