Skip to content

feat(warden): Upload findings to GCS via Workload Identity Federation#176

Merged
gricha merged 3 commits intomainfrom
feat/warden-gcs-upload
Mar 6, 2026
Merged

feat(warden): Upload findings to GCS via Workload Identity Federation#176
gricha merged 3 commits intomainfrom
feat/warden-gcs-upload

Conversation

@gricha
Copy link
Member

@gricha gricha commented Mar 5, 2026

Upload warden structured findings JSON to a GCS bucket (warden-logs) after each PR scan, using GCP Workload Identity Federation for authentication.

This enables downstream analysis of warden findings — specifically to determine whether linters or other static analysis tools could catch issues that warden currently finds.

Files are stored at gs://warden-logs/<org>/<repo>/<timestamp>.json.

GCP prerequisites:

  • Service account gha-warden@sac-prod-sa.iam.gserviceaccount.com needs workload identity pool binding for this repo
  • Service account needs roles/storage.objectCreator on the warden-logs bucket

Agent transcript: https://claudescope.sentry.dev/share/UvprGlpQKb1AA0zn-RInMqbwPfnbkAVnYTXlRLDB6zY

Authenticate to GCP using OIDC workload identity and upload warden
findings JSON to the warden-logs bucket after each PR scan. Files are
stored as timestamped JSON under org/repo paths for downstream analysis.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/1bzpd9bFJDpsTMflTcligEabMBUvuiHXGg3hoDQHdvI
Move GCP auth after warden scan with continue-on-error so auth failures
don't block scanning. Guard rename/upload on findings-file being
non-empty. Use env var instead of direct expression interpolation.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/BKBjQj046vaZRSSn53ACddWCi8IA4OfcDBXrt63hk7U
Prevent upload failures (e.g. from failed GCP auth) from failing the
entire workflow job.

Co-Authored-By: Claude <noreply@anthropic.com>
@gricha gricha requested a review from Jeffreyhung March 5, 2026 21:08
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

run: |
DEST="$RUNNER_TEMP/$(date -u +%Y-%m-%dT%H%M%SZ).json"
cp "$FINDINGS_FILE" "$DEST"
echo "path=$DEST" >> "$GITHUB_OUTPUT"
Copy link

Choose a reason for hiding this comment

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

Absolute path may cause silent GCS upload failure

Medium Severity

The rename step writes the destination file to $RUNNER_TEMP which is an absolute path (e.g., /home/runner/work/_temp/...), and this absolute path is passed to upload-cloud-storage's path input. The google-github-actions/upload-cloud-storage action has documented issues with absolute paths and expects relative paths. Even if it doesn't error on Linux, the default parent: true behavior may cause the full directory tree (home/runner/work/_temp/) to be included in the GCS object name, resulting in files stored at an unexpected location instead of the intended gs://warden-logs/<org>/<repo>/<timestamp>.json. Because continue-on-error: true is set, any failure here would be completely silent, making the entire upload feature appear to work while never actually producing usable output.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Member

@Jeffreyhung Jeffreyhung left a comment

Choose a reason for hiding this comment

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

lgtm!

only one comment: should we include the PR number in the file name? will that make it easier for engs to lookup the logs? or does that not matter?

@gricha
Copy link
Member Author

gricha commented Mar 5, 2026

it's intentional, the bot that eats that will do so in bulk and mostly by repository

@gricha gricha merged commit 128ef28 into main Mar 6, 2026
6 checks passed
@gricha gricha deleted the feat/warden-gcs-upload branch March 6, 2026 04:10
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.

2 participants