Fix ineffective SCP, silent SNS delivery failures, and Lambda edge cases - #13
Merged
Merged
Conversation
Security / correctness - deny-disable-s3-public-access-block: the SCP used condition keys (s3:PutAccountPublicAccessBlock:*) that S3 does not define, so the deny could never match. Replace with an unconditional deny of PutAccountPublicAccessBlock/PutBucketPublicAccessBlock in the JSON, CFN and Terraform copies. - restrict-bedrock-foundation-models: also allow inference-profile ARNs, otherwise enabling the allow-list blocks cross-region profile calls (including this repo's own claude-apps-gateway). - root-activity-alarm, bedrock-cost-guardrails, organization-trail: SNS topics were encrypted with the AWS-managed aws/sns key, which cannot be used by service-principal publishers (EventBridge, Budgets, Cost Anomaly Detection, CloudTrail), so alerts would never be delivered. Use customer-managed keys. - organization-trail: scope the bucket and topic policies to this trail with aws:SourceArn (confused-deputy) and deny non-TLS access to the trail bucket. - claude-apps-gateway: reject 0.0.0.0/0 for CorporateCidr, and warn that the IMMUTABLE ECR repo makes the "latest" tag default a trap. Lambda fixes (CFN and Terraform copies kept identical) - remediate_open_ssh_rdp: all-traffic (-1) rules produced a revoke call with FromPort/ToPort=None, which fails boto3 validation and crashed. - wiz_webhook_bridge: compare secrets as bytes (non-ASCII path segment raised TypeError -> 500), sanitize the SNS subject, handle base64-encoded bodies. - deactivate_stale_iam_keys: fail safe (skip user) when the exemption-tag lookup fails instead of deactivating a possibly-exempt user's keys. - ai-agent / identity-center auditors: handle a single-object Statement (previously skipped or crashed), flag Allow+NotAction on Resource "*", and stop swallowing API errors (an AccessDenied produced a false "no findings"). - sagemaker remediation: report a failed update instead of erroring out. - bedrock logging enforcement: detect drift in image/embedding delivery flags, not just text. Docs / CI - Correct the wiz-finding-bridge docs: this repo's remediators do not accept the bridge payload; an adapter is required. - Document SCP limitations (management account exempt, S3 PAB behavior), root-alarm regional coverage, and EC2 isolation caveats. - CI: lint the Terraform-side StackSet template, compile Python, validate policy JSON, and check the CFN/Terraform Lambda copies stay identical. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
Full accuracy / professionalism / security review. Existing lint,
terraform validateand Checkov were already clean, so these are issues the tooling can't see. Verified after the changes: cfn-lint,terraform fmt/validate(all 18 modules) and Checkov (CFN 400 passed / 0 failed; TF 644 / 0) are clean, and each Lambda change was unit-tested with mocked AWS clients. Nothing was deployed to AWS.Security / correctness
s3:PutAccountPublicAccessBlock:*) that S3 doesn't define (confirmed against AWS's service reference), so the deny never matched. Replaced with an unconditional deny ofPutAccountPublicAccessBlock/PutBucketPublicAccessBlockin the JSON, CFN and Terraform copies.root-activity-alarm,bedrock-cost-guardrailsandorganization-trailused the AWS-managedaws/snskey, whose policy can't grant EventBridge / Budgets / Cost Anomaly Detection / CloudTrail access, so alerts would silently never arrive. Now customer-managed keys.aws:SourceArn; added it, plus a TLS-only deny on the trail bucket.us.anthropic.*), breaking this repo's ownclaude-apps-gateway. Inference-profile ARNs are now allowed; the model allow-list still applies via the underlying foundation-model ARN.CorporateCidrnow rejects0.0.0.0/0(the description already said never to use it); documented that thelatesttag default conflicts with the IMMUTABLE ECR repo.Lambda fixes (CFN and Terraform copies kept identical)
remediate_open_ssh_rdp: all-traffic (-1) rules produced a revoke call withFromPort/ToPort=None, failing boto3 validation and crashing.wiz_webhook_bridge: secrets compared as bytes (a non-ASCII path segment raisedTypeError-> 500), SNS subject sanitized, base64 bodies handled.deactivate_stale_iam_keys: fails safe (skips the user) if the exemption-tag lookup errors.audit_ai_agent_iam_roles/audit_identity_center_access: handle a single-objectStatement(previously skipped or crashed), flagAllow+NotActiononResource: "*", and stop swallowing API errors (an AccessDenied looked like "no findings").remediate_sagemaker_notebook_exposure: reports a failed update instead of erroring out.enforce_bedrock_logging: detects drift in image/embedding delivery flags, not only text.Docs / CI
wiz-finding-bridgedocs: this repo's remediators don't accept the bridge payload, so an adapter Lambda is required.Test plan
python-and-policiesjob included)root-activity-alarmto a sandbox account inus-east-1and trigger a root event to confirm delivery through the CMK-encrypted topic (SNS/KMS behaviour follows AWS docs; not exercised end to end here)deny-disable-s3-public-access-blockto a test OU and confirmput-public-access-blockis deniedNot changed, for your call:
deny-disable-security-servicesdoesn't coverguardduty:UpdateDetector, which can also disable GuardDuty; adding it would block legitimate tuning.