SK-3014-gitleaks-detection-fix-added-script-to-fix-generated-files - #282
Merged
Conversation
skyflow-himanshupal
requested review from
saileshwar-skyflow,
skyflow-bharti and
yaswanth-pula-skyflow
September 21, 2026 07:34
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved moderate issues affect redaction correctness, staging safety, and secret-scan enforcement.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Adds automated gitleaks redaction for generated Python files and an opt-in pre-commit guard.
Changes:
- Adds secret detection, redaction, validation, and rescanning.
- Adds Git hook installation and staged scanning.
- Replaces generated JWT examples with placeholders.
| File | Summary |
|---|---|
scripts/patch_generated_secrets.py |
Implements redaction and verification; duplicate spans, subprocess failures, and missing test coverage remain. |
scripts/install_git_hooks.sh |
Configures repository-local Git hooks. |
common/generated/rest/authentication/client.py |
Replaces generated JWT examples with placeholders. |
.githooks/pre-commit |
Runs redaction and staged scans; contains invalid path staging, unintended staging side effects, and an unenforced CI fallback. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
yaswanth-pula-skyflow
approved these changes
Sep 24, 2026
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
Fern regenerates the four vault client trees (
common/generated,skyflow/generated,skyvault/skyflow/generated,flowvault/skyflow/generated) from scratch, so realistic-looking example secrets in theirdocstrings (a fake JWT, fake token UUIDs) keep re-triggering gitleaks on every regen. Hand-fixing them doesn't stick. This PR adds automated detection, redaction, and enforcement so this stops being a recurring manual
chore.
What's included
scripts/patch_generated_secrets.py— runs the realgitleaksbinary against.gitleaks.tomland auto-redacts whatever it flags across all four generated trees, rather than hand-maintaining a list ofknown-bad strings. Redacts by position (not by the matched text itself) so it can't corrupt surrounding quotes or trip CodeQL's clear-text-storage/logging checks, self-tests the local
gitleaksbuild's allowlistsupport before trusting it, verifies with
ast.parse, and rolls back cleanly on any failure (including a failed final re-scan)..githooks/pre-commit— two-tier local guard: tier 1 runs the script above and stages only what it actually redacted (plus whatever you'd already staged); tier 2 runsgitleaks protect --stagedand blocks thecommit on anything left over.
scripts/install_git_hooks.sh— one-time setup (git config core.hooksPath .githooks); pip has no npm-stylepreparehook to wire this automatically..github/workflows/gitleaks-auto-redact.yml(new) — runs the same auto-redaction on every PR push and commits the fix straight back to the branch. Closes the gap for contributors withoutgitleaksinstalledlocally.
.github/workflows/Gitleaks.yml(new) — scans every PR, comments findings, and fails the check if it finds anything. This repo had no gitleaks CI coverage at all before this PR..gitleaks.toml— added an allowlist fortests/dummy-non-secret/*, intentional non-secret fixture data.Testing