Skip to content

fix(lwpreflight): add S3 tagging and inline-policy reads to AWS lists - #1857

Merged
lokesh-vadlamudi merged 1 commit into
mainfrom
lvadlamudi/cad-2300-preflight-s3-tagging-getrolepolicy
Aug 28, 2026
Merged

fix(lwpreflight): add S3 tagging and inline-policy reads to AWS lists#1857
lokesh-vadlamudi merged 1 commit into
mainfrom
lvadlamudi/cad-2300-preflight-s3-tagging-getrolepolicy

Conversation

@lokesh-vadlamudi

Copy link
Copy Markdown
Collaborator

Jira/Github ticket

https://lacework.atlassian.net/browse/CAD-2300

Summary

Two gaps in the AWS preflight required-permission lists, found while verifying that roles holding exactly these lists can deploy and destroy every AWS integration.

s3:TagResource and s3:ListTagsForResource. Newer aws provider versions pass bucket tags inside CreateBucket and read them back with ListTagsForResource. When the role lacks those actions the provider falls back to PutBucketTagging / GetBucketTagging, so onboarding still succeeds, but every EKS Audit Log deployment leaves AccessDenied entries in the customer's CloudTrail for a role we told them was sufficient. Added to every list that already tags buckets: Agentless, CloudTrail and EKS Audit Log, single-account and org. Config org creates its bucket untagged but the provider still reads tags on refresh, so it gets s3:ListTagsForResource only.

iam:GetRolePolicy and iam:GetUserPolicy for EKS Audit Log. Preflight reads the caller's own policies (policy.go): attached policies via GetPolicy/GetPolicyVersion, inline ones via GetRolePolicy (roles) or GetUserPolicy (users). The other three integrations require both; EKS never did, so a principal granted through an inline policy failed preflight before terraform ran. Added to both EKS lists.

Data-only change in lwpreflight/aws/constants.go.

How did you test this change?

QAN, CAD team account, one IAM role per integration with a single customer-managed policy equal to the go-sdk single-account list. Each role authorized, passed Discovery, deployed (deployments 500 Config, 501 CloudTrail, 502 Agentless, 503 EKS Audit Log) and then deleted the integration with resource destroy. CloudTrail for the four role sessions shows no terraform AccessDenied; the only denials were the two S3 tagging actions on the EKS run (tolerated by the provider) and the service's best-effort iam:ListAccountAliases, which is not part of this change.

go test ./lwpreflight/aws/ passes.

Org-level variants were not deployed in this pass; their lists received the same additions and the org Config list keeps every CloudFormation StackSet, Lambda, SNS and Secrets Manager action it had.

Newer aws provider versions pass bucket tags inside CreateBucket, which needs
s3:TagResource, and read them with s3:ListTagsForResource. Without them the
provider falls back to PutBucketTagging/GetBucketTagging, so onboarding still
succeeds but every run leaves AccessDenied entries in the customer's CloudTrail.
Add both to every list that already tags buckets (Agentless, CloudTrail, EKS
Audit Log; single-account and org), and s3:ListTagsForResource alone to org
Config, whose bucket is created untagged but still read.

Preflight reads the caller's inline policies with iam:GetRolePolicy (roles) and
iam:GetUserPolicy (users) in policy.go, but the EKS Audit Log lists never
required either, so a principal granted through an inline policy failed
preflight before terraform ran. Add both to the EKS lists; the other three
integrations already carry them.

Verified in QAN with roles holding exactly these lists (deployments 500-503).

CAD-2300
@lokesh-vadlamudi
lokesh-vadlamudi force-pushed the lvadlamudi/cad-2300-preflight-s3-tagging-getrolepolicy branch from 26f37a0 to 67fbaa9 Compare August 28, 2026 01:23
@lokesh-vadlamudi lokesh-vadlamudi changed the title fix(lwpreflight): require S3 tagging actions and inline-policy reads for AWS preflight fix(lwpreflight): add S3 tagging and inline-policy reads to AWS lists Aug 28, 2026
@lokesh-vadlamudi lokesh-vadlamudi self-assigned this Aug 28, 2026
@lokesh-vadlamudi
lokesh-vadlamudi marked this pull request as ready for review August 28, 2026 15:37
@lokesh-vadlamudi
lokesh-vadlamudi requested a review from a team as a code owner August 28, 2026 15:37
@lokesh-vadlamudi
lokesh-vadlamudi enabled auto-merge (squash) August 28, 2026 15:38
@lokesh-vadlamudi
lokesh-vadlamudi merged commit 32db85e into main Aug 28, 2026
13 checks passed
@lokesh-vadlamudi
lokesh-vadlamudi deleted the lvadlamudi/cad-2300-preflight-s3-tagging-getrolepolicy branch August 28, 2026 15:39
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