Interview › Security & DevSecOps
How would you enforce a policy like 'no public S3 buckets' as code? [Intermediate]
Answer
To enforce 'no public S3 buckets' as code, I would check Terraform or CloudFormation before deployment and also monitor deployed AWS resources continuously. The policy should deny public ACLs, public bucket policies, and missing block-public-access settings.
Technical explanation
CI/IaC enforcement prevents new violations before they reach production.
Runtime CSPM detects drift or changes made outside IaC.
Exceptions should be explicit, time-limited, approved, and limited to reviewed public assets.
Hands-on example
Conftest/Rego sketch:
deny[msg] {
resource := input.resource_changes[_]
resource.type == "aws_s3_bucket_public_access_block"
resource.change.after.block_public_acls == false
msg := sprintf("S3 bucket %s must block public ACLs", [resource.name])
}Run against terraform show -json plan.out before apply.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Security & DevSecOps interview questions
- What is OPA, and what is the Rego language used for? [Intermediate]
- What is workload identity, and how does it remove static credentials? [Intermediate]
- How do you apply least privilege to service-to-service communication (e.g., with Istio mTLS)? [Intermediate]
- What is secrets management, and how does HashiCorp Vault work at a high level? [Intermediate]
- What is encryption at rest versus in transit, and how do you ensure both? [Advanced]
- What is the difference between symmetric and asymmetric encryption? [Advanced]
- What is certificate management, and how do tools like cert-manager help? [Advanced]
- What is the difference between authentication and authorization? [Advanced]