#213
fix(testing): redact redirect userinfo and fragments
Fixes #211.
I removed userinfo and redacted fragments when scrubbing absolute redirect URLs, including URLs without query parameters. Query rewriting now preserves repeated keys and their order while redacting each value. Previously username/password and fragment tokens could remain in recorded Location headers, and repeated query keys collapsed.
Tests exercise queryless userinfo/fragment URLs and the scrubCalls path, checking query multiplicity/order and that caller objects are not mutated. Existing plain-URL and non-URL pass-through checks remain. Relative URL handling and path-embedded values are outside this change.
Validation (Deno 2.9.7):
- Both regressions fail before the fix; fixture suite: 12 passed, 0 failed.
- All 251 test modules imported into one temporary shared-process entry point: 1,300 passed, 0 failed, 221 gated live tests ignored. This is not a standard isolated-module
deno task testrun. deno task check,deno task lint, changed-filedeno fmt --check,git diff --check, anddeno task version:check --base upstream/mainpass.
@ooctoo777, could you review and merge this fix?
Summary by CodeRabbit
- Bug Fixes
- URL redaction now removes embedded credentials and hides fragment values, including when a URL has no query string. Query values remain hidden while repeated keys and their order are preserved.
- Redirect destinations are also covered, while request data and the original input remain unchanged.
No actionable comments were generated in the recent review.
d46da2c5-c8d0-4e36-83b8-9ba301401968Reviewing files that changed from the base of the PR and between 09d54479142e36eff876383beacfbd37b33b5908 and d29e9e1fe10dafc5692218b22f68badcd4d2e831.
shared/testing/fixture-size.test.tsshared/testing/fixtures.tsIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
Walkthrough
scrubUrlCredentialsnow removes URL userinfo, redacts fragments and query values, and preserves repeated query keys and their order. Tests cover URLs without queries, redirectLocationvalues, unchanged requests, and input immutability.Priority: Normal
Severity of issue fixed: Medium
Merge Risk: Minimal · up to
d29e9No merge-blocking risk was identified in the redirect URL scrubbing change.
Pre-merge checks: 4
#211requirements are implemented.scrubUrlCredentialsremoves URL userinfo, replaces non-empty fragments withREDACTED, and rebuilds every query occurrence in its original order with `REDAC…scrubUrlCredentialsbehavior and regression tests inshared/testing/fixture-size.test.ts. They address the absolute response-header URL scope of issue#211. No unrelated…Full details: Linked Issues check
Explanation
Issue
#211requirements are implemented.scrubUrlCredentialsremoves URL userinfo, replaces non-empty fragments withREDACTED, and rebuilds every query occurrence in its original order withREDACTEDvalues.scrubCallsapplies the helper to response headers and returns copied objects. Added tests cover queryless userinfo and fragment URLs, repeated query keys, thescrubCallspath, and input preservation.Full details: Out of Scope Changes check
Explanation
The changes are limited to
scrubUrlCredentialsbehavior and regression tests inshared/testing/fixture-size.test.ts. They address the absolute response-header URL scope of issue#211. No unrelated implementation or test changes are shown.Comment
@coderabbitai helpto get the list of available commands.