Skip to content

fix: path traversal, file size limit, manifest size guard, scan limit…#210

Open
ameyvaidya44 wants to merge 2 commits into
Stanzin7:masterfrom
ameyvaidya44:fix/security-and-robustness-improvements
Open

fix: path traversal, file size limit, manifest size guard, scan limit…#210
ameyvaidya44 wants to merge 2 commits into
Stanzin7:masterfrom
ameyvaidya44:fix/security-and-robustness-improvements

Conversation

@ameyvaidya44
Copy link
Copy Markdown

… race condition

  • fix(api): replace startswith() path traversal check with os.path.commonpath() in get_file_content; startswith is bypassable when one path is a prefix of another directory name (e.g. /tmp/ext_abc vs /tmp/ext_abcdef)

  • fix(api): add 5 MB file size guard in get_file_content before reading into memory to prevent OOM on large bundled assets

  • fix(manifest_parser): add 512 KB size limit on manifest.json before parsing to prevent DoS via crafted oversized manifests

  • fix(api): wrap _consume_deep_scan in a threading.Lock to eliminate the check-then-increment race condition that allowed concurrent requests to exceed the daily scan limit

… race condition

- fix(api): replace startswith() path traversal check with os.path.commonpath()
  in get_file_content; startswith is bypassable when one path is a prefix of
  another directory name (e.g. /tmp/ext_abc vs /tmp/ext_abcdef)

- fix(api): add 5 MB file size guard in get_file_content before reading into
  memory to prevent OOM on large bundled assets

- fix(manifest_parser): add 512 KB size limit on manifest.json before parsing
  to prevent DoS via crafted oversized manifests

- fix(api): wrap _consume_deep_scan in a threading.Lock to eliminate the
  check-then-increment race condition that allowed concurrent requests to
  exceed the daily scan limit
docker-compose was binding to 0.0.0.0:8007 by default, making the API
reachable from any device on the local network. For a local dev tool
handling API keys and scan results this is unnecessary exposure.

- docker-compose.yml: change port binding to 127.0.0.1:8007:8007
- docs/GET_STARTED.md: add network note explaining the binding and
  guidance for cases where external access is intentionally needed
@github-actions github-actions Bot added area: docs Documentation-only changes area: infra CI, deployment, database, or repository automation changes labels Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs Documentation-only changes area: infra CI, deployment, database, or repository automation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant