Skip to content

Commit 287ac6b

Browse files
SONARPY-1015 Remove unrelated argument check for S6281 (#1131)
1 parent dbd7115 commit 287ac6b

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

python-checks/src/main/java/org/sonar/python/checks/cdk/S3BucketBlockPublicAccessCheck.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.sonar.plugins.python.api.tree.CallExpression;
3030
import org.sonar.plugins.python.api.tree.Expression;
3131
import org.sonar.plugins.python.api.tree.QualifiedExpression;
32-
import org.sonar.plugins.python.api.tree.Token;
3332
import org.sonar.plugins.python.api.tree.Tree;
3433

3534
@Rule(key = "S6281")
@@ -48,12 +47,6 @@ public class S3BucketBlockPublicAccessCheck extends AbstractS3BucketCheck {
4847

4948
@Override
5049
void visitBucketConstructor(SubscriptionContext ctx, CallExpression bucket) {
51-
Optional<ArgumentTrace> publicReadAccess = getArgument(ctx, bucket, "public_read_access");
52-
if (publicReadAccess.isPresent()) {
53-
publicReadAccess.get().addIssueIf(S3BucketBlockPublicAccessCheck::isTrue, MESSAGE);
54-
return;
55-
}
56-
5750
Optional<ArgumentTrace> blockPublicAccess = getArgument(ctx, bucket, "block_public_access");
5851
if (blockPublicAccess.isPresent()) {
5952
checkBlockPublicAccess(ctx, blockPublicAccess.get());
@@ -94,8 +87,4 @@ private static boolean isBlockPublicAccessConstructor(CallExpression expression)
9487
return Optional.ofNullable(expression.calleeSymbol()).map(Symbol::fullyQualifiedName).filter(BLOCK_PUBLIC_ACCESS_FQN::equals).isPresent();
9588
}
9689

97-
private static boolean isTrue(Expression expression) {
98-
return Optional.ofNullable(expression.firstToken()).map(Token::value).filter("True"::equals).isPresent();
99-
}
100-
10190
}

python-checks/src/test/resources/checks/cdk/s3BucketBlockPublicAccessCheck.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
2121
block_public_access=public_access_only_block_acls_by_reference) # NonCompliant {{Make sure allowing public ACL/policies to be set is safe here.}}
2222
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2323

24-
bucket = s3.Bucket(self, "AllowPublicReadAccess",
25-
public_read_access=True) # NonCompliant {{Make sure allowing public ACL/policies to be set is safe here.}}
26-
27-
public_read_access = True
28-
# ^^^^^^^^^^^^^^^^^^^^^^^^^> {{Propagated setting.}}
29-
bucket = s3.Bucket(self, "AllowPublicReadAccessByReference",
30-
public_read_access=public_read_access) # NonCompliant {{Make sure allowing public ACL/policies to be set is safe here.}}
31-
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32-
3324
bucket = s3.Bucket(self, "SingleUnblockPublicAccesses",
3425
block_public_access=s3.BlockPublicAccess(
3526
block_public_acls=False, # NonCompliant {{Make sure allowing public ACL/policies to be set is safe here.}}

0 commit comments

Comments
 (0)