Skip to content

fix(scan): inspect extensionless shebang scripts - #7

Open
vsolano9 wants to merge 1 commit into
AgentPostmortem:mainfrom
vsolano9:fix-5-extensionless-shebang
Open

fix(scan): inspect extensionless shebang scripts#7
vsolano9 wants to merge 1 commit into
AgentPostmortem:mainfrom
vsolano9:fix-5-extensionless-shebang

Conversation

@vsolano9

Copy link
Copy Markdown

What does this PR do?

Collect extensionless directory entries when their first bytes are a shebang, closing the scanner blind spot for executable scripts named setup, install, or run. The probe reads at most 64 bytes; plain extensionless files remain ignored.

Closes #5

Changes

  • add a bounded shebang probe for extensionless files
  • add a fixture with a shebang setup and an equally dangerous plain notes file
  • prove the extensionless script produces the same findings as equivalent .sh content
  • bump the package patch version to 0.1.2 and add the required changelog entry

Validation

  • node --test — 12/12 passed
  • focused regression repeated 20 times
  • real CLI JSON/exit contract: 2 files scanned, critical setup finding, no notes finding
  • full suite and real CLI passed on Node 18.20.8 and Node 20.20.2
  • node --check across source, bin, and test JavaScript
  • npm pack --dry-run — expected 8-file zero-dependency 0.1.2 package
  • installed tarball .bin smoke passed
  • git diff --check

Checklist

  • Tests pass (node --test)
  • Updated docs / README if behavior changed (changelog updated; CLI syntax unchanged)
  • Added a CHANGELOG.md entry
  • Followed the existing code style

Notes

The executable-bit alternative was intentionally not used: a shebang is a precise text-script signal, while an executable bit alone may identify a native binary that should not be decoded and scanned as text.

Probe only the first 64 bytes of extensionless files and collect those beginning with a shebang. Add fixture coverage for finding parity and plain-file exclusion, then bump the patch version and changelog.
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.

Executable files with no extension are never collected, so a shebang script is invisible

1 participant