fix(lwpreflight): add S3 tagging and inline-policy reads to AWS lists - #1857
Merged
lokesh-vadlamudi merged 1 commit intoAug 28, 2026
Merged
Conversation
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
force-pushed
the
lvadlamudi/cad-2300-preflight-s3-tagging-getrolepolicy
branch
from
August 28, 2026 01:23
26f37a0 to
67fbaa9
Compare
lokesh-vadlamudi
marked this pull request as ready for review
August 28, 2026 15:37
lokesh-vadlamudi
enabled auto-merge (squash)
August 28, 2026 15:38
PengyuanZhao
approved these changes
Aug 28, 2026
lokesh-vadlamudi
deleted the
lvadlamudi/cad-2300-preflight-s3-tagging-getrolepolicy
branch
August 28, 2026 15:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:TagResourceands3:ListTagsForResource. Newer aws provider versions pass bucket tags insideCreateBucketand read them back withListTagsForResource. When the role lacks those actions the provider falls back toPutBucketTagging/GetBucketTagging, so onboarding still succeeds, but every EKS Audit Log deployment leavesAccessDeniedentries 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 getss3:ListTagsForResourceonly.iam:GetRolePolicyandiam:GetUserPolicyfor EKS Audit Log. Preflight reads the caller's own policies (policy.go): attached policies viaGetPolicy/GetPolicyVersion, inline ones viaGetRolePolicy(roles) orGetUserPolicy(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-effortiam: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.