Add security hardening, fuzzing, and release automation#34
Merged
Conversation
…zzing, signed releases) Address the low-scoring OpenSSF Scorecard checks (overall 6.5 at 075f9e0): Token-Permissions (0 -> 10): - docker-beta.yml: drop top-level write scopes to `contents: read`; move packages/id-token/attestations write to the build job only. - codeql.yml: declare a top-level `permissions: contents: read`. Fuzzing (0): - Add an Atheris fuzz target for the source chunker (the most exposed parser), plus ClusterFuzzLite config (.clusterfuzzlite/) and a bounded fuzz CI workflow. Signed-Releases: - Add release.yml: on a v* tag, build sdist+wheel, keyless-sign each with Sigstore (OIDC), and publish a GitHub Release with the .sigstore bundles. SAST (8): - Add a bandit job to security.yml; annotate two confirmed false positives (parameterized SQL IN-clause; a public-host classifier) with `# nosec`. License (9 -> 10): - Rename LICENSE-2.0.txt -> LICENSE (standard name) and update references in pyproject.toml, README.md, Dockerfile. https://claude.ai/code/session_01VgY3wMWzuBw6QFNivhXZYy
…t hang indexing The Atheris fuzz target (added in this PR) found a ~180-byte TypeScript input — mostly newlines with a few stray tokens — that drove the tree-sitter grammar's GLR error-recovery super-linear: a single parse ran for minutes and ballooned RSS past 2 GB. Indexing arbitrary repos must never let one hostile/garbled file hang or OOM the indexer. Fix: set a per-parse time budget (timeout_micros, 2s) on the cached tree-sitter parsers. A parse that blows the budget raises, and chunk_file falls back to line windows — its existing graceful-degradation contract. Real source parses in single-digit milliseconds, so the guard never trips on legitimate code. Regression tests in tests/test_chunking.py: assert every tree-sitter parser carries the budget, and that the exact fuzzer-found input degrades to windows (SIGALRM-bounded so a future regression fails fast instead of hanging). https://claude.ai/code/session_01VgY3wMWzuBw6QFNivhXZYy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive security hardening, continuous fuzzing infrastructure, and automated release workflows to CodeRAG. It introduces keyless Sigstore signing for releases, Python SAST analysis via bandit, fuzzing of the source chunker via Atheris, and ClusterFuzzLite/OSS-Fuzz integration.
Key Changes
Security & Release Automation:
release.yml): Automated build, sign (keyless Sigstore), and publish of sdist + wheel artifacts on version tags with OpenSSF Scorecard compliancesecurity.yml): Added Python-focused static security analysis gating on MEDIUM+ severity findingsdocker-beta.ymlandcodeql.ymlto apply write scopes only at the job level, not workflow-wide (OpenSSF Token-Permissions compliance)Fuzzing Infrastructure:
fuzz/fuzz_chunk_file.py): Continuous fuzzing harness forchunk_file()(the most exposed parser) with bounded runs on PRs and longer weekly bursts; validates the contract that chunking never crashes and structural invariants on output chunksfuzz.yml): Triggers on chunker-related changes or weekly schedule; runs 50k iterations on PRs, 600s on schedule.clusterfuzzlite/): Dockerfile and build script for integration with continuous fuzzing platformsHousekeeping:
LICENSE-2.0.txt→LICENSEand updated all references (pyproject.toml,Dockerfile,README.md)# nosec B104annotation inhttp_api.pyfor a false-positive security finding (host classification, not socket binding)sqlite_store.py(line continuation)Notable Details
atheris.instrument_imports()to enable coverage-guided fuzzing of CodeRAG's chunking logic.sigstorebundles for provenance verification viasigstore verify-ll(MEDIUM+ only) to reduce noise while catching real issueshttps://claude.ai/code/session_01VgY3wMWzuBw6QFNivhXZYy