Skip to content

feat: full scan mode, init command, 18 gates, and 100% test coverage #4

Merged
sadayamuthu merged 72 commits into
mainfrom
develop
Feb 28, 2026
Merged

feat: full scan mode, init command, 18 gates, and 100% test coverage #4
sadayamuthu merged 72 commits into
mainfrom
develop

Conversation

@sadayamuthu

Copy link
Copy Markdown
Owner

Summary

  • Full scan mode (--mode full): scans entire repo via git ls-files with extension/skip-dir/binary filtering
  • controlgate init command: interactive bootstrap for .controlgate.yml, pre-commit, and CI/CD configs
  • 10 new security gates (9–18): deps, api, privacy, resilience, incident, observability, memsafe, license, aiml, container
  • 100% test coverage enforced (277 tests, 0 missing lines)

Test plan

  • pytest --cov=controlgate reports 100% coverage
  • All pre-commit hooks pass (ruff, mypy)
  • Full scan detects secrets and passes on clean code
  • Init command creates expected files and respects --no-docs / CI flags

sadayamuthu and others added 30 commits February 27, 2026 00:17
…incident, observability, memsafe, license, aiml, container)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…per-commit)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…er detection in DepsGate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements APIGate with pattern-based detection of insecure API patterns:
TLS verification disabled, wildcard CORS origins, API credentials in query
params, credentialed CORS headers, and GraphQL introspection enabled.
Wires gate into GATE_CONTROL_MAP (SC-8, AC-3, SC-5, SI-10) and ALL_GATES.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…39/AC-6/SI-7)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n debt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Gate)

Also fix pre-existing mypy import-not-found errors across all test gate
files by setting ignore_missing_imports = true in [tool.mypy]; the
controlgate package is installed in editable mode for pytest but not in
the isolated pre-commit mypy environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sadayamuthu and others added 29 commits February 27, 2026 17:05
Captures approved design for:
- controlgate scan --mode full (synthetic DiffFile approach, directory walk with git ls-files fallback)
- controlgate init (interactive bootstrap: .controlgate.yml, .pre-commit-config.yaml, CONTROLGATE.md, GitHub/GitLab/Bitbucket CI templates)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7-task TDD plan covering:
- Task 1: full_scan config fields
- Task 2: _get_full_files() with git ls-files + fallback walk
- Task 3: --mode full wired into scan_command + parser
- Task 4: init_command.py with all 6 file templates
- Task 5: init subcommand wired into CLI
- Task 6: README + docs updates (8 → 18 gates)
- Task 7: final validation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
## Changes

### .controlgate.yml
- Renamed `input` gate to `input_validation` for consistency with gate module naming
- Renamed `change` gate to `change_control` for consistency with gate module naming
- Added 10 new security gates, all enabled with `action: warn` by default:
  - `deps`          – Dependency integrity and supply chain checks
  - `api`           – API security (CORS, TLS verification, key exposure)
  - `privacy`       – PII handling, data retention, and serialization checks
  - `resilience`    – Deletion protection, retry logic, and snapshot policies
  - `incident`      – Error suppression, silent catch blocks, traceback exposure
  - `observability` – Monitoring flags, log drivers, and liveness probes
  - `memsafe`       – Unsafe memory ops, eval/exec, C FFI patterns
  - `license`       – Copyleft license detection in dependencies and source
  - `aiml`          – AI/ML model loading safety and prompt injection patterns
  - `container`     – Container privilege escalation and image hygiene

### CHANGELOG.md
- Added unreleased entry documenting the expansion to 18 gates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auto-formatted with `ruff format` to fix CI lint failures:
- src/controlgate/gates/deps_gate.py
- tests/test_gates/test_deps_gate.py
- tests/test_gates/test_incident_gate.py
- tests/test_gates/test_privacy_gate.py
- tests/test_gates/test_resilience_gate.py

No logic changes — whitespace and line-length fixes only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add 8 targeted tests covering the 12 previously uncovered lines:
- _get_full_files: except ValueError (path outside root), OSError on
  read_bytes, and OSError on read_text
- scan_command: else branch when _get_diff returns non-empty content
- init_command: invalid baseline fallback, _prompt_yn empty-input
  default, and _prompt without a default value

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements bump_version.py in hooks/ with TDD: tests written first,
confirmed failing, then implementation added to achieve 100% coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sadayamuthu
sadayamuthu merged commit b319510 into main Feb 28, 2026
12 checks passed
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