8000 fix: address security vulnerabilities in viz server and bundle import by 007vasy · Pull Request #726 · CodeGraphContext/CodeGraphContext · GitHub
[go: up one dir, main page]

Skip to content

fix: address security vulnerabilities in viz server and bundle import#726

Open
007vasy wants to merge 1 commit intoCodeGraphContext:mainfrom
007vasy:fix/security-vulnerabilities
Open

fix: address security vulnerabilities in viz server and bundle import#726
007vasy wants to merge 1 commit intoCodeGraphContext:mainfrom
007vasy:fix/security-vulnerabilities

Conversation

@007vasy
Copy link
@007vasy 007vasy commented Mar 15, 2026

Summary

  • Arbitrary file read via /api/file: The endpoint accepted any filesystem path without restriction. Now validates that resolved paths are within allowed project directories, returning 403 otherwise.
  • Wildcard CORS policy: Changed allow_origins=["*"] to localhost-only origins, preventing cross-origin exfiltration attacks from malicious websites.
  • Cypher injection in bundle import: Node labels and relationship types from .cgc bundle JSONL files were interpolated directly into Cypher queries via f-strings. Added identifier validation (^[A-Za-z_][A-Za-z0-9_]*$) before interpolation.
  • Zip-slip in bundle extraction: extractall() was called without validating member paths. Added path traversal check to ensure no ZIP entry escapes the extraction directory.

Test plan

  • Verify /api/file returns 403 for paths outside the project directory (e.g., /etc/passwd)
  • Verify /api/file still serves files within the visualized project directory
  • Verify CORS blocks requests from non-localhost origins
  • Verify importing a valid .cgc bundle still works
  • Verify importing a bundle with malicious labels (e.g., containing }) is rejected with a warning
  • Verify importing a bundle with path-traversal ZIP entries raises ValueError

🤖 Generated with Claude Code

- Restrict /api/file endpoint to only serve files within allowed project
  directories, preventing arbitrary file read
- Tighten CORS policy from wildcard (*) to localhost-only origins,
  preventing cross-origin exfiltration attacks
- Validate Cypher identifiers (node labels and relationship types) in
  bundle import to prevent Cypher injection via malicious .cgc files
- Add zip-slip protection to bundle extraction by validating member
  paths before extractall()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
vercel bot commented Mar 15, 2026

@007vasy is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

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

0