folder trust: harden the shared warning pattern and its contract test (from #9519 review)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- backend, testing-qa
Research direction
Start with packages/protocol/src/folder-trust-warnings.ts and packages/server/tests/folder-trust-warning-contract.test.js. Read how FOLDER_TRUST_BLOCKING_WARNING is built and how the contract test tracks prefixes from real scans. Make the three requested safety, coverage, and naming changes; run the contract test both normally and with a name filter to confirm coverage remains independent.
Written by the indexing model from the issue text.
Description
Context
Filed from: the round 1 review of #9519 (closes #9516), at head 5a44e9a0f. The review approved, with no critical findings. The points below do not block that PR.
#9519 moved the folder-trust warning prefixes into one module, packages/protocol/src/folder-trust-warnings.ts. The daemon builds its warnings from it, and store-core's split uses its FOLDER_TRUST_BLOCKING_WARNING. A real-scan contract test, packages/server/tests/folder-trust-warning-contract.test.js, guards it.
1. The prefixes go into new RegExp unescaped
FOLDER_TRUST_BLOCKING_WARNING joins FOLDER_TRUST_WARNING_PREFIX values into a new RegExp(...) without escaping. All four prefixes are plain letters and spaces today, so it is safe. A future prefix containing ., ( or ? would silently change what the pattern matches, or throw when protocol is imported. The .source pin test would notice only if someone edits it by hand in the same change.
Acceptance: escape each prefix (a small escapeRegExp), or assert in the protocol test that every prefix matches /^[A-Za-z ]+$/. Either way, a prefix with a metacharacter must go red.
2. The contract test's coverage check depends on the earlier cases
The last case in folder-trust-warning-contract.test.js asserts that every prefix was produced by some real scan. It reads a seen set that the earlier cases fill, so a run with --test-name-pattern or --test-only makes it red for the wrong reason. A normal file run is sound.
Acceptance: the coverage case builds its own scans, or is folded into a single case that both scans and checks coverage.
3. Nit: an inverted name
In the same test file, NOT_ROOT is true when the host is Windows or the process runs as root. The behaviour is correct (the chmod case skips in both), but the name reads backwards. Rename it, for example CANNOT_CHMOD_UNREADABLE.
- 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
-
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
-
enhancement from-review
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blamechris/chroxy#9101 ·
Maintainers usually reply within 1 day
All issues in blamechris/chroxy
Similar issues
-
Documentation pleaseOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
Java Edition Tests
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JSPrismarine/JSPrismarine#4178 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Trac-Systems/main_settlement_bus#1278 ·
Maintainers usually reply within 1 day
-
documentation good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apidly-ltd/apidly-mcp#5 ·