Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Peer API path guard test never covers the backslash separators it rejects

Open Beginner friendly
#11,997 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
95/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
express, javascript
Domain
security, testing

Research direction

Read hasAmbiguousSegment in server/lib/apiAccessPolicy.js and the existing separator cases in server/lib/apiAccessPolicy.test.js. Add the encoded and literal backslash paths to the existing test table, then run apiAccessPolicy.test.js and authGate.test.js. Done means removing the %5c and backslash checks from the guard makes the test fail, with no production code changed.

Written by the indexing model from the issue text.

Description

effort:low model:light plan planner:fable-5-1 test-quality tests

Slice audited: external auth boundary tests (test-quality audit, 2026-10-18).

Problem

hasAmbiguousSegment in server/lib/apiAccessPolicy.js:80 refuses //, dot segments, %2e, %2f, %5c and a literal backslash before a peer credential's prefix rule is applied. server/lib/apiAccessPolicy.test.js:76 ("refuses dot, empty, and encoded separator segments") covers every alternative except %5c and \.

Mutation probe (scratch worktree): removed |%5c|\\ from the regex and ran apiAccessPolicy.test.js and authGate.test.js.

Test Files  2 passed (2)   Tests  89 passed (89)

Impact

Low. The source comment frames the branch as defense in depth against "a later layer that might normalize differently", and express.static normalizes both separators today. The cost is a guard branch that can be deleted with the suite green; a future static-serving change would then have no test naming the case.

Fix (decided)

Add /data/images/a%5cb.png and /data/images/a\\b.png to the existing for table in apiAccessPolicy.test.js:76. No production code change.

Scope: small

Acceptance criteria

  • Removing |%5c|\\ from hasAmbiguousSegment fails the test.
  • No production code change.
Dominant language
JavaScript
Stars
38
Forks
32
Avg merge
40m
Merged PRs (30d)
996

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from atomantic/PortOS

All issues in atomantic/PortOS

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.