Skip to content

ci(security): migrate Firstrade GCP and GCS vars to secrets - #557

Merged
Pigbibi merged 1 commit into
mainfrom
ci/ft-gcp-gcs-secrets
Nov 27, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
ci/ft-gcp-gcs-secrets

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

AI assistance

Generated with assistance from Antigravity agent.

What changed

  • Updated 9 workflow files (inspect-account-history-schema.yml, publish-archived-account-history.yml, execution-report-heartbeat.yml, sync-cloud-run-env.yml, runtime-target-lifecycle.yml, ft-session-renew-verify.yml, ft-session-check-marker-reset.yml, publish-runtime-daily-once.yml, and ft-afs-align-broker-account.yml) to read ACCOUNT_HISTORY_GCP_PROJECT_ID, ACCOUNT_HISTORY_GCP_SERVICE_ACCOUNT, ACCOUNT_HISTORY_GCP_WIF_PROVIDER, DIGEST_CANDIDATES_OVERRIDE_GCS_URI, EXECUTION_REPORT_GCS_URI, and FIRSTRADE_GCS_STATE_BUCKET from secrets.* instead of public vars.*.

How verified

  • Staged all 6 keys in repository secrets.*.
  • Verified zero vars. references remain for the 6 migrated keys across .github/workflows/.
  • Ran pytest -q tests/test_runtime_monitor_workflows.py and workflow config checks locally.

Why

Completes Security Batch 4D migration in QuantStrategyLab/FirstradePlatform before deleting those 6 public repository variables post-merge.

Risk

Low. Repository secrets were staged before switching workflow bindings; public variable deletion happens strictly post-merge.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T21:52:27.682456Z 15cff8a PR opened
🔒 Security Review ✅ Completed 2026-11-27T21:53:44.638401Z 15cff8a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qsl-ai-reviewer

Copy link
Copy Markdown

AI Code Review (deepseek / deepseek-chat)

The PR migrates six configuration keys from public vars.* to secrets.* across nine workflows. The mechanical substitution is consistent, but it introduces a real regression: secrets.* cannot be used in if: expressions or in some contexts, and more importantly the report-prefix/RUNTIME_HEARTBEAT_GCS_URIS fallbacks now depend on a secret that may be unset, silently degrading heartbeat/guard behavior. Also, secrets are masked in logs but the values here (project id, bucket, WIF provider, service account) are not actually secrets and moving them to secrets reduces auditability; more critically, secrets.* are unavailable to fork PRs and to pull_request events, which can break workflows that previously worked. No hardcoded credentials, no weakened auth gates, and actions remain SHA-pinned, so the security checklist items 1, 2, 4, 5 are satisfied. The main concerns are correctness/robustness of the fallback chains and missing test coverage for the new bindings.

Reviewed commit: 15cff8af32 · Coverage: complete · Unresolved findings: true

Findings

  • [MEDIUM] .github/workflows/execution-report-heartbeat.yml: report-prefix: ${{ vars.RUNTIME_HEARTBEAT_GCS_URIS || secrets.EXECUTION_REPORT_GCS_URI }} and the RUNTIME_HEARTBEAT_GCS_URIS fallback in runtime-target-lifecycle.yml now depend on a secret. If the secret is unset (e.g. fork PR, or before staging completes), the expression evaluates to empty string and the heartbeat/guard step silently runs with no prefix instead of failing closed. Previously the public var made this observable. Add an explicit guard step that fails when the resolved value is empty.
  • [MEDIUM] .github/workflows/execution-report-heartbeat.yml: EXECUTION_REPORT_GCS_URI was changed from vars.EXECUTION_REPORT_GCS_URI || secrets.EXECUTION_REPORT_GCS_URI to secrets.EXECUTION_REPORT_GCS_URI only. This removes the fallback that previously allowed the workflow to run when only the public var was set. If the staged secret is missing or misnamed, downstream steps receive an empty URI with no error. Add a preflight validation step asserting the required env vars are non-empty.
  • [MEDIUM] .github/workflows/inspect-account-history-schema.yml: workload_identity_provider and service_account are now read from secrets.*. These are not secrets (they are public identifiers) and moving them to secrets means they are unavailable on pull_request from forks and are masked in logs, making WIF misconfiguration harder to diagnose. Confirm the workflow is not triggered by pull_request; if it is, this change breaks it. Prefer keeping non-sensitive identifiers in vars.* and only moving genuinely sensitive values.
  • [LOW] .github/workflows/publish-archived-account-history.yml: project_id: ${{ secrets.ACCOUNT_HISTORY_GCP_PROJECT_ID }} passed to setup-gcloud — if the secret is unset the action receives an empty string and may fall back to ambient project, silently targeting the wrong project. Add an explicit if: env.GCP_PROJECT_ID == '' fail step or assert non-empty before the auth step.
  • [LOW] .github/workflows/sync-cloud-run-env.yml: FIRSTRADE_GCS_STATE_BUCKET and EXECUTION_REPORT_GCS_URI are now secrets but are consumed by a sync step that writes Cloud Run env. If the secret is empty the sync will push an empty bucket/URI into the deployed service, which is a silent misconfiguration rather than a fail-closed error. Validate non-empty before the sync step.
  • [LOW] tests/test_runtime_monitor_workflows.py: PR claims pytest -q tests/test_runtime_monitor_workflows.py was run, but no test asserts that the six keys are now sourced from secrets.* and that no vars.* references remain. Add a regression test that greps the workflow files for the migrated keys and asserts the secrets. binding, so a future revert is caught.

@Pigbibi Pigbibi added the agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation label Nov 27, 2026
@Pigbibi
Pigbibi merged commit ed187f3 into main Nov 27, 2026
13 of 14 checks passed
@Pigbibi
Pigbibi deleted the ci/ft-gcp-gcs-secrets branch November 27, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant