diff --git a/.cursor/rules/security-standards.md b/.cursor/rules/security-standards.md index a1c32f8..d9056fc 100644 --- a/.cursor/rules/security-standards.md +++ b/.cursor/rules/security-standards.md @@ -6,7 +6,7 @@ - **`.env.example`** must be checked in with placeholder values and comments. - **All env vars** accessed via `process.env.X` and validated with Zod at startup. - **Production secrets** live ONLY in Vercel environment settings (not in code, not in CI). -- **gitleaks** runs in CI and pre-commit (configured in `.github/workflows/security.yml`). +- **gitleaks** runs in CI and pre-commit (configured in `.github/workflows/security.yml`). Placeholder tokens in docs are allowlisted via `.gitleaks.toml`. ## Input Validation diff --git a/.github/workflows/agent-coding.yml b/.github/workflows/agent-coding.yml index f327bea..40d0b5b 100644 --- a/.github/workflows/agent-coding.yml +++ b/.github/workflows/agent-coding.yml @@ -19,8 +19,17 @@ jobs: # Gate the agent on CURSOR_API_KEY being present. Secrets can't be used in # job-level `if:`, so we surface presence as an output here and skip cleanly # (neutral, not failed) on repos that haven't set the key. + # + # The guard carries the same event filter as the job(s) it gates, so it only + # runs when an agent would actually start. A job that runs bills at least one + # full Actions minute, even for this 2-second check; a skipped job bills + # nothing. Without the filter the guard alone cost one minute per PR push, + # label or CI completion in every managed repo. Keep both filters in sync. guard: name: Check Cursor API key + if: > + contains(github.event.issue.labels.*.name, 'agent-task') && + startsWith(github.event.issue.title, '[CODING]') runs-on: ubuntu-latest outputs: has_key: ${{ steps.check.outputs.has_key }} diff --git a/.github/workflows/agent-devops.yml b/.github/workflows/agent-devops.yml index da54472..b9d6164 100644 --- a/.github/workflows/agent-devops.yml +++ b/.github/workflows/agent-devops.yml @@ -12,8 +12,18 @@ jobs: # Gate the agent on CURSOR_API_KEY being present. Secrets can't be used in # job-level `if:`, so we surface presence as an output here and skip cleanly # (neutral, not failed) on repos that haven't set the key. + # + # The guard carries the same event filter as the job(s) it gates, so it only + # runs when an agent would actually start. A job that runs bills at least one + # full Actions minute, even for this 2-second check; a skipped job bills + # nothing. Without the filter the guard alone cost one minute per PR push, + # label or CI completion in every managed repo. Keep both filters in sync. guard: name: Check Cursor API key + if: > + github.event.pull_request.merged == true && + github.event.pull_request.base.ref == 'staging' && + contains(github.event.pull_request.labels.*.name, 'qa-passed') runs-on: ubuntu-latest outputs: has_key: ${{ steps.check.outputs.has_key }} diff --git a/.github/workflows/agent-qa.yml b/.github/workflows/agent-qa.yml index 03cd332..21b312c 100644 --- a/.github/workflows/agent-qa.yml +++ b/.github/workflows/agent-qa.yml @@ -13,8 +13,15 @@ jobs: # Gate the agent on CURSOR_API_KEY being present. Secrets can't be used in # job-level `if:`, so we surface presence as an output here and skip cleanly # (neutral, not failed) on repos that haven't set the key. + # + # The guard carries the same event filter as the job(s) it gates, so it only + # runs when an agent would actually start. A job that runs bills at least one + # full Actions minute, even for this 2-second check; a skipped job bills + # nothing. Without the filter the guard alone cost one minute per PR push, + # label or CI completion in every managed repo. Keep both filters in sync. guard: name: Check Cursor API key + if: github.event.label.name == 'needs-qa' runs-on: ubuntu-latest outputs: has_key: ${{ steps.check.outputs.has_key }} diff --git a/.github/workflows/agent-security.yml b/.github/workflows/agent-security.yml index 34003c6..a6d63e6 100644 --- a/.github/workflows/agent-security.yml +++ b/.github/workflows/agent-security.yml @@ -20,8 +20,22 @@ jobs: # Gate the agent on CURSOR_API_KEY being present. Secrets can't be used in # job-level `if:`, so we surface presence as an output here and skip cleanly # (neutral, not failed) on repos that haven't set the key. + # + # The guard carries the same event filter as the job(s) it gates, so it only + # runs when an agent would actually start. A job that runs bills at least one + # full Actions minute, even for this 2-second check; a skipped job bills + # nothing. Without the filter the guard alone cost one minute per PR push, + # label or CI completion in every managed repo. Keep both filters in sync. guard: name: Check Cursor API key + if: > + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' || ( + github.event_name == 'pull_request' && ( + github.event.pull_request.user.login == 'dependabot[bot]' || + contains(github.event.pull_request.labels.*.name, 'dependencies') + ) + ) runs-on: ubuntu-latest outputs: has_key: ${{ steps.check.outputs.has_key }} diff --git a/.github/workflows/ci-doctor.yml b/.github/workflows/ci-doctor.yml index fddd7dd..4774478 100644 --- a/.github/workflows/ci-doctor.yml +++ b/.github/workflows/ci-doctor.yml @@ -24,8 +24,18 @@ jobs: # Gate on CURSOR_API_KEY being present. Secrets can't be used in job-level # `if:`, so we surface presence as an output here and skip cleanly (neutral, # not failed) on repos that haven't set the key. + # + # The guard carries the same event filter as the job(s) it gates, so it only + # runs when an agent would actually start. A job that runs bills at least one + # full Actions minute, even for this 2-second check; a skipped job bills + # nothing. Without the filter the guard alone cost one minute per PR push, + # label or CI completion in every managed repo. Keep both filters in sync. guard: name: Check Cursor API key + if: > + github.event.workflow_run.conclusion == 'failure' && + github.event.workflow_run.event != 'pull_request' && + !startsWith(github.event.workflow_run.head_branch, 'cursor/') runs-on: ubuntu-latest outputs: has_key: ${{ steps.check.outputs.has_key }}