test(server): fail-closed HTTP roster also covers switch-case, logical and conditional routing forms
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- testing
Research direction
Start in packages/server/tests/helpers/http-auth-inventory.js, where the AST visitor decides unplaced entries, and read tests/principal-http-roster.test.js to see how the inventory and fixture count are asserted. Add detection for LogicalExpression, ConditionalExpression and SwitchCase test subtrees that mention req.url or URL-derived names, plus alias-computed header keys and computed or destructured grant access. Add one mutation fixture per new form and update the fixture count; done when each fixture reports an explicit finding and the real http-routes.js control stays clean.
Written by the indexing model from the issue text.
Description
Context
Identified during the final delta review of PR #9123 (S1 of #9112). The review approved the PR, and these are non-blocking hardening items for a test guard.
Location: packages/server/tests/helpers/http-auth-inventory.js. This is the AST inventory behind tests/principal-http-roster.test.js.
Description
The roster refuses principal tokens on every HTTP route by inventorying routes and bearer reads from the AST. It fails closed on request aliases, switch discriminants derived from req.url, computed header keys and compound assignments. Three routing forms in future code would still go unreported, because they use no req.method check and no if statement:
switch (true) { case p === '/b': … }. Only the discriminant is inspected, not theSwitchCasetests.p === '/c' && res.end(), aLogicalExpression.p === '/d' ? res.end() : null, aConditionalExpression.
A probe confirmed that none of these produces an unplaced entry. Two smaller gaps:
const h = req.headers; h[k]is caught only through the pinned whole-headers escape count, not as a computed header key.- The no-
.grant()mint scan does not coverstore['grant']or a destructuredgrant. The method still refuses at runtime.
The real http-routes.js classifies cleanly today, so no current route escapes. These are future-code gaps.
Acceptance Criteria
- Any
LogicalExpression,ConditionalExpressionorSwitchCasetest whose subtree mentionsreq.urlor a URL-derived name outside a classified route is reported as unplaced. A mutation fixture for each of the three forms must produce an explicit finding. - A computed key on an alias of
req.headersis reported as a computed header read, not only through the escape count. - The mint scan also rejects computed or destructured
grantaccess insrc/. - The real
http-routes.jspositive control stays clean, and the fixture count assertion is updated.
- Dominant language
- JavaScript
- Stars
- 7
- Forks
- 1
- Avg merge
- 2h 3m
- Merged PRs (30d)
- 333
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from blamechris/chroxy
-
from-review tech-debt testing
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
blamechris/chroxy#9520 ·
Maintainers usually reply within 1 day
-
priority: low server
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
blamechris/chroxy#9340 ·
Maintainers usually reply within 1 day
-
documentation from-review
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
blamechris/chroxy#9237 ·
Maintainers usually reply within 1 day
-
agent-control client: notify() docstring should say the outbound gate applies only in principal modeOpenenhancement from-review
Difficulty 1/5 Under an hour Newbie friendliness 80/100
blamechris/chroxy#9227 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blamechris/chroxy#9108 ·
Maintainers usually reply within 1 day
All issues in blamechris/chroxy
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Use one constant for the 10,000-character input limitPossibly taken @NginxL claimed this today. Opengood first issue refactor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aniru-dh21/snap-validate#51 ·
Maintainers usually reply within 1 day
-
Documentation pleaseOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area/host bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Fei2411/DeepSeek-Bot#3190 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days