Skip to content

fix(integration-platform): attribute AWS check findings to their AWS account (multi-account) - #3065

Merged
tofikwest merged 2 commits into
mainfrom
tofik/aws-checks-account-attribution
Jun 9, 2026
Merged

tofikwest merged 2 commits into
mainfrom
tofik/aws-checks-account-attribution

Conversation

@tofikwest

@tofikwest tofikwest commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Customer report (Dustin)

"that does not tell me the instance info. It is also not at all clear how to add the same check for another instance. I have given 3 aws instances to the system."

On the "S3 — default encryption enabled" evidence check he sees 31 buckets passing but with no indication of which of his 3 AWS accounts each belongs to, and it's unclear how the other accounts are covered.

Root cause (verified)

  • Integration-platform checks run per connection (1 AWS account = 1 connection), so all 3 accounts are already scanned — this part isn't broken.
  • But the account is never put in the finding. s3.ts already derived the account id (accountIdFromCtx → roleArn) for its own logic, yet evidence was just {bucket, encrypted}. The UI groups by check and shows no account → a merged, unlabeled list. So "which instance?" and "how do I add it for another instance?" are really one gap: no per-account attribution.

Fix

All six AWS checks (s3, cloudtrail, ec2, iam, kms, rds) emit through the shared emitOutcomes(), so I stamp the account there in one place:

  • awsAccountIdFromCtx() (moved to shared.ts, exported) derives the 12-digit account id from the connection's roleArn.
  • Every finding now gets evidence.awsAccountId and the account appended to the visible description: … (AWS account 123456789012).

So each result shows its account regardless of how the UI groups them, which also makes it clear all connected accounts are covered. No schema/API/UI change or migration. Key-auth connections (no role ARN) are left unattributed gracefully.

Tests

aws-checks.test.ts (bun): awsAccountIdFromCtx extraction + malformed/missing → null; emitOutcomes stamps account into evidence + description on pass and fail, preserves original evidence, and leaves findings unattributed when there's no role ARN. 41 pass; package builds + typechecks clean.

Caveats / notes

  • Covers the main pass/fail findings (which flow through emitOutcomes). The rare direct ctx.fail() error paths (e.g. "Could not assume AWS role", "Could not verify S3 encryption") are not stamped — edge cases, can follow up if needed.
  • Not live-tested against the customer's accounts; needs a re-run after deploy so findings regenerate with the account.
  • Bonus: once labeled, this also reveals whether all 3 of his accounts are actually producing results — if one account is missing, that's a separate connection/run issue we'd investigate then.

🤖 Generated with Claude Code


Summary by cubic

Fixes multi-account AWS check findings by attributing each result to its AWS account, and shows the customer's connection name when set. Adds the account ID (and connection name) to evidence and descriptions so users can see which account each resource belongs to, with no schema or UI changes.

  • Bug Fixes
    • Centralized account ID extraction via awsAccountIdFromCtx() (from roleArn) and used across all AWS checks.
    • emitOutcomes() stamps awsAccountId and optional awsConnectionName into evidence and appends "(AWS account … — name)" to pass/fail descriptions.
    • Gracefully skips attribution for key-based connections without a roleArn.
    • Added unit tests for extraction, pass/fail attribution, missing-ARN cases, and connection name labeling.

Written for commit 69c84c8. Summary will update on new commits.

Review in cubic

…account

Customer connected 3 AWS accounts; the "S3 — default encryption enabled" check
showed 31 buckets with no indication of which account each belongs to, and it
was unclear how the other accounts are covered. Checks already run per
connection (1 AWS account = 1 connection), so all accounts ARE scanned — but the
account was never surfaced in the findings, so the UI shows a merged, unlabeled
list.

All six AWS checks (s3, cloudtrail, ec2, iam, kms, rds) emit through the shared
emitOutcomes(), so stamp the account there in one place: derive the 12-digit
account id from the connection's roleArn (awsAccountIdFromCtx, moved to shared)
and add it to every finding's evidence (awsAccountId) and visible description
("… (AWS account 123456789012)"). No schema/API/UI/migration needed — the
account now shows per result regardless of how the UI groups them, which also
makes it clear all connected accounts are covered.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 9, 2026 3:42pm
comp-framework-editor Ready Ready Preview, Comment Jun 9, 2026 3:42pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Jun 9, 2026 3:42pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

…ongside the account

Build on the account-attribution stamp: when the customer named the connection
(the "Connection Name" field, e.g. "Production AWS" — stored in credentials and
mirrored to connection.metadata), surface that real label too. The finding
description becomes "… (AWS account 123456789012 — Production AWS)" and evidence
gains awsConnectionName. This is the customer's OWN label — we do not infer
prod/stage from AWS (no reliable signal); falls back to the account id alone
when no name is set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
vercel Bot temporarily deployed to Preview – portal June 9, 2026 15:39 Inactive
@tofikwest
tofikwest merged commit 84b63e0 into main Jun 9, 2026
11 checks passed
@tofikwest
tofikwest deleted the tofik/aws-checks-account-attribution branch June 9, 2026 16:11
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.74.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

claudfuen pushed a commit that referenced this pull request Jun 11, 2026
# [3.78.0](v3.77.0...v3.78.0) (2026-06-11)

### Bug Fixes

* guard optimistic state sync and align picker page cap (cubic on [#3095](#3095)) ([c39011f](c39011f))
* **integration-platform:** isolate per-subscription wildcard scan + graceful subscription picker ([62fd692](62fd692))
* **integration-platform:** make multi-subscription scanning strictly opt-in ([c1bce47](c1bce47))
* **integration-platform:** stamp account attribution on account-level AWS findings ([1493c5c](1493c5c)), closes [#3086](#3086) [#3065](#3065)
* **integration-platform:** surface real read errors in azure/gcp checks (CS-534 part 1) ([91135b2](91135b2))
* **integration-platform:** surface real read errors in cloudtrail/kms/iam/ec2/rds checks (CS-533) ([5d7e2a0](5d7e2a0)), closes [#3075](#3075)
* **integration-platform:** surface the subscription scan cap as an explicit finding ([e6dda8c](e6dda8c))
* **integrations:** gate the Add-account CTA on integration:create RBAC ([6c35625](6c35625))
* resolve cubic findings from the production deploy review ([#3087](#3087)) ([9f30138](9f30138))
* **trust-portal:** resync custom-framework state + mark response fields nullable ([ec5ba44](ec5ba44))
* **trust-portal:** validate allowed-emails body with a DTO ([06ed9bd](06ed9bd))
* **trust:** gate certificate drag-and-drop behind the read-only permission ([086bf7c](086bf7c))
* **trust:** reset the certificate file input on every selection, not only success ([7d51e2c](7d51e2c))
* **trust:** resolve 4 cubic findings from the production deploy review ([c2b9122](c2b9122))
* **trust:** return 400 not 500 on malformed PUT /custom-frameworks body ([bb30749](bb30749))

### Features

* **integration-platform:** scan all enabled Azure subscriptions (CS-534 part 2) ([9912b9a](9912b9a))
* **trust-portal:** add per-email NDA-bypass allowlist ([3e3ed70](3e3ed70))
* **trust-portal:** display custom frameworks on the trust portal ([e9ed93d](e9ed93d))
eshan-singh78 pushed a commit to eshan-singh78/comp-es that referenced this pull request Jun 25, 2026
… AWS findings

Cubic flagged on PR trycompai#3086 that the new iam.ts password-policy finding
bypasses the shared attribution path — in a multi-account org the
merged task panel shows it with no way to tell which AWS account it
belongs to. The same gap existed in every account-level direct
ctx.fail finding: could-not-assume-role (shared.ts), the S3/EC2/RDS/
KMS/CloudTrail aggregate could-not-verify findings, and both iam.ts
findings.

Route all 9 sites through emitOutcomes, which stamps awsAccountId +
awsConnectionName into evidence and appends the account label to the
description (same as every per-resource finding since PR trycompai#3065).

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

This branch was successfully deployed

2 active and 1 inactive deployments
Preview – app — 69c84c85 Deployed Jun 9, 2026 by vercel[bot]
Preview – comp-framework-editor — 69c84c85 Deployed Jun 9, 2026 by vercel[bot]
Preview – portal — 69c84c85 Deployed Jun 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants