Skip to content

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
Security-Phoenix-demo:mainfrom
prithvee07:main
Open

fix(security-assessment): close scoped-package bypass and fix pip3/go get extraction in pre-bash-package-guard#2
prithvee07 wants to merge 2 commits into
Security-Phoenix-demo:mainfrom
prithvee07:main

Conversation

@prithvee07

Copy link
Copy Markdown

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.
  • 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 (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.

Test plan

  • bash -n syntax check on the modified hook
  • End-to-end run: pip3 install requesst correctly extracts requesst and denies (blocklist match)
  • End-to-end run: go get github.com/spf13/cobra allows cleanly, no bogus go/get pseudo-packages
  • End-to-end run: npm install @evil-scope/malicious-pkg (scoped, unversioned, added to a temp blocklist) now correctly denies instead of silently skipping

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant