Skip to content

fix(ci): stop using the GCP service account key - #773

Merged
akunft merged 1 commit into
mainfrom
fix/remove-sa-key
Nov 11, 2026
Merged

akunft merged 1 commit into
mainfrom
fix/remove-sa-key

Conversation

@akunft

@akunft akunft commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Why

CI decoded GCP_CREDENTIALS_{STAGING,PRODUCTION} (a base64 service-account JSON key) into credentials.json and exported GOOGLE_APPLICATION_CREDENTIALS. A long-lived key in CI is a liability, and nothing that runs in CI uses it.

The only consumer of Application Default Credentials in the SDK is platform.generate_signed_url (src/aignostics/platform/_utils.py). Every test that reaches it without a mock has @pytest.mark.skip(reason=GCS_TEST_SLIDES_REMOVED_REASON) (the test slides were removed from the bucket). Bucket uploads use HMAC keys from the platform, and IDC downloads use anonymous s5cmd --no-sign-request.

What

  • _test.yml, _scheduled-test-{hourly,daily,stress}.yml: remove the GCP_CREDENTIALS_* secret declarations and the "Set up GCP credentials for bucket access" step.
  • ci-cd.yml, scheduled-testing-{staging,production}-{hourly,daily}.yml, stress-testing-staging.yml.paused: remove the secret pass-through. The declarations and callers change together. Otherwise the scheduled workflows fail at startup: a caller that leaves out a required: true secret fails, and so does a caller that passes a secret its reusable workflow doesn't declare.
  • CLAUDE.md, .github/CLAUDE.md, specifications/SPEC-BUILD-CHAIN-CICD-SERVICE.md: remove the mentions.

No Python source or tests changed.

Verification

  • actionlint .github/workflows/*.yml: the same 9 findings on main and on this branch, all from before this change (runner labels, github.head_ref, commit_message input). This change adds none.
  • Proved the caller/callee secret check both ways: I put GCP_CREDENTIALS_STAGING back into a caller, and actionlint reported secret "GCP_CREDENTIALS_STAGING" is not defined in ... reusable workflow (exit 1). After reverting, it exited 0.
  • A search for GCP_CREDENTIALS, credentials.json and GOOGLE_APPLICATION_CREDENTIALS finds nothing left.
  • make lint passes.
  • An independent review with fresh context confirmed that no test which runs in CI reaches ADC.
  • ci-cd.yml green on this PR
  • scheduled-testing-staging-hourly and -daily dispatched on this branch and green

After merge

  1. Watch one scheduled run on main go green.
  2. Delete the repo secrets GCP_CREDENTIALS_STAGING and GCP_CREDENTIALS_PRODUCTION.
  3. Check whether another repo uses the service account. Then disable its key in GCP, and delete it a few days later.

If the GCS tests are ever re-enabled, use Workload Identity Federation with service account impersonation and IAM signBlob, not a key.

SDLC

The change edits SPEC-BUILD-CHAIN-CICD-SERVICE.md and needs the Software Item Spec approval: Engineer, then Engineering Tech Lead.

CI decoded GCP_CREDENTIALS_{STAGING,PRODUCTION} into credentials.json and
exported GOOGLE_APPLICATION_CREDENTIALS. The only consumer is
platform.generate_signed_url, and every test that reaches it unmocked is
skipped (GCS_TEST_SLIDES_REMOVED_REASON), so no running test needs the key.

Remove the secret declarations and the setup step from the reusable test
workflows, the secret pass-through from their callers (including the paused
stress workflow), and the mentions in CLAUDE.md, .github/CLAUDE.md and
SPEC-BUILD-CHAIN-CICD-SERVICE.md.

If the GCS tests are re-enabled, use Workload Identity Federation with
service account impersonation and IAM signBlob instead of a key.
@akunft
akunft requested a review from a team as a code owner November 10, 2026 16:42
@akunft akunft added the skip:test:long_running Skip long-running tests (≥5min) label Nov 10, 2026
@ox-security

ox-security Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

OX Security Logo

OX Security reviewed this pull request — nothing to fix.

✔ No issues found

Branch fix/remove-sa-key → main

View scan in OX Security →

@akunft akunft closed this Nov 10, 2026
@akunft akunft reopened this Nov 10, 2026

@olivermeyer olivermeyer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just to be on the safe side, I'd suggest removing the skip:test:long_running and adding the enable:test:very_long_running to run the full test suite (will require closing + opening the PR again).

@akunft akunft added enable:test:very_long_running Enable very long-running tests (≥60min) and removed skip:test:long_running Skip long-running tests (≥5min) labels Nov 10, 2026
@akunft akunft closed this Nov 10, 2026
@akunft akunft reopened this Nov 10, 2026
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.
see 4 files with indirect coverage changes

@sonarqubecloud

Copy link
Copy Markdown

@akunft
akunft requested a review from olivermeyer November 10, 2026 20:24
@akunft
akunft merged commit e0f8636 into main Nov 11, 2026
62 of 74 checks passed
@akunft
akunft deleted the fix/remove-sa-key branch November 11, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enable:test:very_long_running Enable very long-running tests (≥60min)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants