CQ-05 / CD-02 exclude files by DEP_DIRS substring — over-matches (e.g. depsolver.js) and is author-evadable
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- security, testing-qa
Research direction
Read cq05_safe_execution.py and cd02_permission_scope.py at the listed exclusion checks, then compare their path handling with CQ-03’s _is_test_path and PurePosixPath component matching. Update the dependency and test exclusions in both controls to match path components and test stems; done means paths such as depsolver.js, latest.js, and inspector.js remain scanned while actual dependency and test paths stay excluded.
Written by the indexing model from the issue text.
Description
The gap
CQ-05 (safe-execution) and CD-02 (permission-scope) decide whether a file is bundle code or a dependency/test — and therefore whether to scan it at all — with substring matches, not path-component matches. Substring matching over-matches, so a legitimate server file is silently dropped from the scan. A dropped file is scanned for nothing, which is a fail-open: the control certifies coverage it never had.
This is the same "attribute by origin, not by substring" shape as #136 / #143, but pointed the other way. #136 / #143 are about the "/deps/" in path form that fails to match and charges dependency findings to the bundle (over-block). CQ-05 / CD-02 use the bare dep in path form that over-matches and skips real server code (under-scan). Different direction, different controls, not covered by either issue.
Where
Dependency exclusion (over-matches deps/vendor/venv/... as a substring):
apps/scanner/src/mpak_scanner/controls/code_quality/cq05_safe_execution.py:113—if any(dep in relative for dep in DEP_DIRS): continueapps/scanner/src/mpak_scanner/controls/code_quality/cq05_safe_execution.py:142—in_deps = any(dep in relative_path for dep in DEP_DIRS)apps/scanner/src/mpak_scanner/controls/capability_declaration/cd02_permission_scope.py:500—if any(dep_dir in relative for dep_dir in DEP_DIRS): return ...
Test exclusion in the same two spots has the identical substring flaw ("test" matches latest.js, "spec" matches inspector.js):
cq05_safe_execution.py:117—if "test" in relative.lower() or "spec" in relative.lower(): continuecd02_permission_scope.py:503— same expression
Why it is a real fail-open
DEP_DIRS = ["deps", "node_modules", "vendor", "site-packages", ".venv", "venv"].
- A server file
src/depsolver.js—"deps" in "src/depsolver.js"isTrue→ skipped.eval()/child_process/ a broad permission grant in that file is never inspected. Same for any path containingdeps/vendor/venv/venvas a substring. - The exclusion is on the bundle-relative path the author controls, so this is also an evasion vector, the same threat model #136 raises for CQ-02: name a file or directory
...deps...(with no actual dependency there) and its contents skip CQ-05 / CD-02 entirely. Nonode_modulesrequired. - The test-path check compounds it:
latest.js,contest.py,manifest_spec_helpers.jsall match"test"/"spec"as substrings and are dropped from scanning.
CQ-02, CQ-03 and AI-05 already moved off this shape — they match on PurePosixPath(path).parts / stems (see cq03_static_analysis.py:35,47 and its comment naming latest.js / depsolver.js explicitly). CQ-05 and CD-02 were not converted.
Shape of a fix
Unlike #136 (which needs SBOM-based origin attribution to distinguish a real published package from an author-made vendor/ dir), this one is the small, independent fix the doc in apps/scanner/CLAUDE.md now prescribes: match path components, not substrings.
- Dependency:
any(part in DEP_DIRS for part in relative.parts) - Test: reuse CQ-03's
_is_test_path(component + stem), not"test" in path
There are now four+ copies of DEP_DIRS + a _is_dependency_path helper across cq02 / cq03 / ai05 (and the missing conversions in cq05 / cd02 / cq01). Worth extracting one shared is_dependency_path / is_test_path helper so the next control can't reintroduce the substring form. Converting CQ-05 / CD-02 does not need the SBOM work and can land ahead of #136.
Not this
Real dependency/test directories must still be excluded — the goal is to stop over-matching innocent server files (and to close the author-named-path evasion), not to start scanning node_modules/.
Related
- #136 — CQ-02 dependency exemption is author-controlled (over-block direction; SBOM fix)
- #143 — CQ-01
"/deps/" in file_pathcharges dependency secrets to the bundle - #139 — CQ-02 false positives on inlined/minified bundler output
- Dominant language
- TypeScript
- Stars
- 14
- Forks
- 13
- Avg merge
- 16m
- Merged PRs (30d)
- 4
Getting set up
- No 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 NimbleBrainInc/mpak
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
NimbleBrainInc/mpak#180 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NimbleBrainInc/mpak#175 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
NimbleBrainInc/mpak#159 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
NimbleBrainInc/mpak#120 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
NimbleBrainInc/mpak#112 ·
All issues in NimbleBrainInc/mpak
Similar issues
-
bug documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Potential Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Comfy-Org/ComfyUI_frontend#23773 ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
lingdojo/kana-dojo#34301 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
github/gh-aw-firewall#11797 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
code-yeongyu/senpi#7007 ·
Maintainers usually reply within 1 day