You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[APS-19009] resolve semgrep CI + allow legacy upper-case npm names
- Add justified nosemgrep for spawn-shell-true on both npm-install spawns
(static argv, shell needed only for '>' redirect + npm.cmd on Windows).
- Sync securityValidation.js/utils.js with the path-join nosemgrep suppressions
from the #1141 branch so the (false-positive) path-traversal findings clear.
- NPM_NAME_RE: allow A-Z so legacy registry names (e.g. JSONStream) are not
rejected; still blocks git-url/file:/path/alternate-registry specs. Test added.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
// nosemgrep: javascript.lang.security.audit.spawn-shell-true.spawn-shell-true -- static argv (see comment above); shell:true needed for '>' redirection + npm.cmd on Windows, no user input on the command line.
// nosemgrep: javascript.lang.security.audit.spawn-shell-true.spawn-shell-true -- static argv (see comment above); shell:true needed for '>' redirection + npm.cmd on Windows, no user input on the command line.
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal -- these resolves ARE the traversal guard: the value is normalized here only so the containment check below can reject anything outside `base`.
61
62
constbase=path.resolve(baseDir||process.cwd());
63
+
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal -- see above; resolved path is validated by the startsWith(base) check, not used to read the FS unchecked.
62
64
constresolved=path.resolve(base,candidatePath);
63
65
// Must be the base itself or a descendant (base + separator prefix).
// PR-supplied .js config would run arbitrary code, APS-19008). Also require
40
40
// a .json extension and that the file resolves inside the project root so a
41
41
// crafted --config-file cannot point outside the project or at a script.
42
+
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal -- this resolve IS the traversal guard: the path is normalized here so the .json-extension + isPathInsideBase() containment checks below can reject anything outside the project root.
0 commit comments