Skip to content

chore(ci): add two-stage secret gate - #600

Open
erinavllazagaj-eng wants to merge 1 commit into
mainfrom
chore/secret-gate
Open

erinavllazagaj-eng wants to merge 1 commit into
mainfrom
chore/secret-gate

Conversation

@erinavllazagaj-eng

Copy link
Copy Markdown

Adds the secret gate. Nothing blocks yet — the required-check ruleset is created separately by deploy-secret-gate.sh arm runpod/runpod-python after this merges.

Owners: @runpod/security

Before merging, an admin must set the KIMI_RUNPOD_API_KEY repo secret. Without it stage 2 fails closed on every PR.

Stage 1 scans with betterleaks (advisory). Stage 2 triages with Kimi K3 and
publishes the blocking 'AI secret verdict' commit status.

Run 'deploy-secret-gate.sh arm runpod/runpod-python' after this merges.
# No tick when a banner above already failed the gate: a green line under
# a red banner is the one mixed signal this comment must never send.
clean = not (review["injection"] or review["unanswered"] or blocked)
L += ["✅ No secrets in the changed files." if clean

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

False positive: clean is assigned on the line directly above, in the same if not findings: block, and is only read there.

Comment thread .github/security/ghapi.py
HTTP_TIMEOUT_S = 60

def log(msg: str) -> None:
print(msg, flush=True)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

False positive. All three sources are os.environ["TRUSTED_HEAD_REPO"] (= workflow_run.head_repository.full_name, a public owner/repo name); CodeQL's name heuristic treats identifiers containing "trusted" as secrets. The tokens and the Runpod key never reach log.

Comment on lines +927 to +928
"⚠️ **PR Security Scan did not finish cleanly** — the scanner errored "
"or a suppression was added. Resolve that before reading this.",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in runpod/secret_detector#23; it lands here when this branch is refreshed from the merged source. (literals parenthesised)

Comment on lines +946 to +947
"🚨 **The scanned source attempts to instruct the reviewer.** The "
"verdict below is unreliable; read the change by hand.",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in runpod/secret_detector#23; it lands here when this branch is refreshed from the merged source. (literals parenthesised)

Comment on lines +968 to +970
L += ["", "Rotate before anything else — the value is already in git "
"history and on GitHub's servers, so deleting the line does not "
"un-leak it.", ""]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in runpod/secret_detector#23; it lands here when this branch is refreshed from the merged source. (literals parenthesised)

# on a runner that keeps running, so remove it rather than trusting that.
try:
os.remove(report_path)
except OSError:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in runpod/secret_detector#23; it lands here when this branch is refreshed from the merged source. (FileNotFoundError is ignored with a comment; any other OSError now logs a warning)

Comment on lines +927 to +928
"⚠️ **PR Security Scan did not finish cleanly** — the scanner errored "
"or a suppression was added. Resolve that before reading this.",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in runpod/secret_detector#23; it lands here when this branch is refreshed from the merged source. (literals parenthesised)

Comment on lines +946 to +947
"🚨 **The scanned source attempts to instruct the reviewer.** The "
"verdict below is unreliable; read the change by hand.",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in runpod/secret_detector#23; it lands here when this branch is refreshed from the merged source. (literals parenthesised)

Comment on lines +968 to +970
L += ["", "Rotate before anything else — the value is already in git "
"history and on GitHub's servers, so deleting the line does not "
"un-leak it.", ""]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in runpod/secret_detector#23; it lands here when this branch is refreshed from the merged source. (literals parenthesised)

# on a runner that keeps running, so remove it rather than trusting that.
try:
os.remove(report_path)
except OSError:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in runpod/secret_detector#23; it lands here when this branch is refreshed from the merged source. (FileNotFoundError is ignored with a comment; any other OSError now logs a warning)

This branch has not been deployed

No deployments
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.

3 participants