Skip to main content

🧠 AWS S3 Bucket Policy is not set to deny HTTP requests - prod.logic.yaml 🟒

Flags​

Input Type​

TypeAPI NameExtractsExtract FilesLogic Files
πŸ”’πŸ“• AWS S3 BucketCA10__CaAwsBucket__c1617

Uses​

Test Results πŸŸ’β€‹

Generated at: 2025-04-24T23:45:11.066914511Z Open

ResultIdCondition IndexCondition TextRuntime Error
🟒test1βœ”οΈ 99βœ”οΈ isDisappeared(CA10__disappearanceTime__c)βœ”οΈ null
🟒test2βœ”οΈ 199βœ”οΈ extract('CA10__policyDocument__c').isEmpty()βœ”οΈ null
🟒test3βœ”οΈ 299βœ”οΈ extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.Bool."aws:SecureTransport" == \'false\'])') == number(0.0) && extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.NumericLessThan."s3:TlsVersion" == \'1.2\'])') == number(0.0)βœ”οΈ null
🟒test4βœ”οΈ 299βœ”οΈ extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.Bool."aws:SecureTransport" == \'false\'])') == number(0.0) && extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.NumericLessThan."s3:TlsVersion" == \'1.2\'])') == number(0.0)βœ”οΈ null
🟒test5βœ”οΈ 299βœ”οΈ extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.Bool."aws:SecureTransport" == \'false\'])') == number(0.0) && extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.NumericLessThan."s3:TlsVersion" == \'1.2\'])') == number(0.0)βœ”οΈ null
🟒test6βœ”οΈ 299βœ”οΈ extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.Bool."aws:SecureTransport" == \'false\'])') == number(0.0) && extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.NumericLessThan."s3:TlsVersion" == \'1.2\'])') == number(0.0)βœ”οΈ null
🟒test7βœ”οΈ 399βœ”οΈ extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.Bool."aws:SecureTransport" == \'false\'])') > number(0.0) || extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.NumericLessThan."s3:TlsVersion" == \'1.2\'])') > number(0.0)βœ”οΈ null
🟒test8βœ”οΈ 399βœ”οΈ extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.Bool."aws:SecureTransport" == \'false\'])') > number(0.0) || extract('caJsonFrom__policyDocument__c').jsonQueryText('length(Statement[? Effect == \'Deny\' && Condition.NumericLessThan."s3:TlsVersion" == \'1.2\'])') > number(0.0)βœ”οΈ null

Generation​

FileMD5
Open/ce/ca/aws/s3/bucket-policy-deny-http-requests/policy.yaml2BD1484D9DD5B93C00AAB474F49042C7
Open/ce/ca/aws/s3/bucket-policy-deny-http-requests/prod.logic.yaml1763984FE618A6CD9AE7A8A107CC8A7C
Open/types/CA10__CaAwsBucket__c/object.extracts.yamlD7F01723B629E0F1265F06B9CE2EDE1F
Open/ce/ca/aws/s3/bucket-policy-deny-http-requests/test-data.json31AD5B8DD97468C94B6DEB458D049CBD

Generate FULL script​

java -jar repo-manager.jar policies generate FULL /ce/ca/aws/s3/bucket-policy-deny-http-requests/prod.logic.yaml

Generate DEBUG script​

java -jar repo-manager.jar policies generate DEBUG /ce/ca/aws/s3/bucket-policy-deny-http-requests/prod.logic.yaml

Generate CAPTURE_TEST_DATA script​

java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/aws/s3/bucket-policy-deny-http-requests/prod.logic.yaml

Generate TESTS script​

java -jar repo-manager.jar policies generate TESTS /ce/ca/aws/s3/bucket-policy-deny-http-requests/prod.logic.yaml

Execute tests​

java -jar repo-manager.jar policies test /ce/ca/aws/s3/bucket-policy-deny-http-requests/prod.logic.yaml

Content​

Open File

---
inputType: "CA10__CaAwsBucket__c"
testData:
- file: test-data.json
importExtracts:
- file: /types/CA10__CaAwsBucket__c/object.extracts.yaml
conditions:
- status: "INCOMPLIANT"
currentStateMessage: "The bucket policy hasn't been configured for this bucket and by default it's allowing both HTTP and HTTPS requests."
remediationMessage: "Consider configuring the bucket policy that will deny HTTP requests."
check:
IS_EMPTY:
arg:
EXTRACT: "CA10__policyDocument__c"
- status: "INCOMPLIANT"
currentStateMessage: "The bucket policy hasn't been configured to deny HTTP requests."
remediationMessage: "Consider configuring the bucket policy that will deny HTTP requests."
check:
AND:
args:
- IS_EQUAL:
left:
JSON_QUERY_NUMBER:
arg:
EXTRACT: "caJsonFrom__policyDocument__c"
expression: "length(Statement[? Effect == 'Deny' && Condition.Bool.\"aws:SecureTransport\" == 'false'])"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return a number type."
right:
NUMBER: 0.0
- IS_EQUAL:
left:
JSON_QUERY_NUMBER:
arg:
EXTRACT: "caJsonFrom__policyDocument__c"
expression: "length(Statement[? Effect == 'Deny' && Condition.NumericLessThan.\"s3:TlsVersion\" == '1.2'])"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return a number type."
right:
NUMBER: 0.0
- status: "COMPLIANT"
currentStateMessage: "The bucket policy has been configured to deny HTTP requests."
check:
OR:
args:
- GREATER_THAN:
left:
JSON_QUERY_NUMBER:
arg:
EXTRACT: "caJsonFrom__policyDocument__c"
expression: "length(Statement[? Effect == 'Deny' && Condition.Bool.\"aws:SecureTransport\" == 'false'])"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return a number type."
right:
NUMBER: 0.0
- GREATER_THAN:
left:
JSON_QUERY_NUMBER:
arg:
EXTRACT: "caJsonFrom__policyDocument__c"
expression: "length(Statement[? Effect == 'Deny' && Condition.NumericLessThan.\"s3:TlsVersion\" == '1.2'])"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return a number type."
right:
NUMBER: 0.0
otherwise:
status: "UNDETERMINED"
currentStateMessage: "Unexpected values in the field."