fix(security-assessment): close scoped-package bypass and fix pip3/go get extraction in pre-bash-package-guard - #2
Open
prithvee07 wants to merge 2 commits into
Open
Conversation
… get extraction in pre-bash-package-guard clean_pkg() treated the leading @ of an unversioned scoped npm package (e.g. @types/node) as a version separator, stripping it to an empty string and silently skipping the blocklist/typosquat/brand-new/install- script checks entirely. Also fixes package extraction for `pip3 install` and `go get`, which previously left the command unstripped (PM was reconstructed as "pip"/"goget", which never matches the literal command text) and fed bogus pseudo-packages like "pip3"/"go"/"get" into the checks. Extraction now uses the exact substring bash's regex already matched instead of a reconstructed guess. Synced the flattened copy and sec-bundle.tar.gz to match.
Runs bash -n syntax check and shellcheck (error severity) on every .sh file in the repo, on push to main and on PRs. There was previously no CI at all, so the pre-bash-package-guard.sh bugs fixed in this PR would have gone unchecked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
clean_pkg()treated the leading@of an unversioned scoped npm package (e.g.@types/node) as a version separator, blanking it out and silently skipping the blocklist/typosquat/brand-new/install-script checks entirely.pip3 installandgo get, which previously left the command unstripped (PM was reconstructed aspip/goget, which never matches the literal command text) and fed bogus pseudo-packages (pip3,go,get) into the checks. Extraction now uses the exact substring bash'''s regex already matched instead of a reconstructed guess.sec-bundle.tar.gzto match.Test plan
bash -nsyntax check on the modified hookpip3 install requesstcorrectly extractsrequesstand denies (blocklist match)go get github.com/spf13/cobraallows cleanly, no bogusgo/getpseudo-packagesnpm install @evil-scope/malicious-pkg(scoped, unversioned, added to a temp blocklist) now correctly denies instead of silently skipping