Skip to content

🔐 fix path traversal in scanner#22

Closed
miccy wants to merge 1 commit intomainfrom
fix-path-traversal-scanner-15568165884353647124
Closed

🔐 fix path traversal in scanner#22
miccy wants to merge 1 commit intomainfrom
fix-path-traversal-scanner-15568165884353647124

Conversation

@miccy
Copy link
Copy Markdown
Owner

@miccy miccy commented May 4, 2026

🎯 What: Fixed a path traversal vulnerability in the scanner package where unvalidated user input could lead to unauthorized file reads.
⚠️ Risk: Attackers could use null byte injection or other path manipulation techniques to bypass intended directory restrictions, potentially reading sensitive files if the scanner is used in a service context.
🛡️ Solution: Implemented a centralized validatePath utility that checks for null bytes and empty paths. Integrated this validation into all scanner entry points, including scan(), lockfile parsers, and injection detectors. Added a security test suite to verify the fix.


PR created automatically by Jules for task 15568165884353647124 started by @miccy

@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 393a0897-fd14-46f8-b1a7-3343deda8086

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-path-traversal-scanner-15568165884353647124

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

miccy added a commit that referenced this pull request May 4, 2026
- Added validatePath utility to prevent null byte injection and empty paths
- Applied validation at all scanner entry points: scan(), findLockfiles(),
  parseNpmLockfile(), parseYarnLockfile(), detectInjection()
- Added security tests for path validation
@miccy
Copy link
Copy Markdown
Owner Author

miccy commented May 4, 2026

Manually integrated into dev/feat-grant-ready-foundation (commit 0989ec4).

The PR had merge conflicts with the current codebase (restructured parsers, different injection.ts), so the changes were applied manually:

  • packages/scanner/src/utils.tsvalidatePath() utility created
  • packages/scanner/tests/security.test.ts — security tests added
  • validatePath() calls added to scan.ts, injection.ts, npm.ts, yarn.ts

All 4 security tests pass. Closing as integrated.

@miccy miccy closed this May 4, 2026
@miccy miccy deleted the fix-path-traversal-scanner-15568165884353647124 branch May 4, 2026 03:23
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