File tree Expand file tree Collapse file tree 5 files changed +37
-4
lines changed
python-checks/src/main/resources/org/sonar/l10n/py/rules/python Expand file tree Collapse file tree 5 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ <h2>Compliant Solution</h2>
7070 CfnDomain(self, "example",
7171 version=EngineVersion.OPENSEARCH_1_3
7272 domain_endpoint_options=CfnDomain.DomainEndpointOptionsProperty(
73- tls_security_policy="Policy-Min-TLS-1-2-2019-07" # Compliant
73+ tls_security_policy="Policy-Min-TLS-1-2-2019-07"
7474 )
7575 )
7676</ pre >
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ <h2>Sensitive Code Example</h2>
2020 effect=Effect.ALLOW,
2121 actions=["s3:*"],
2222 resources=[bucket.arn_for_objects("*")],
23- principals=[AnyPrincipal()] # Noncompliant
23+ principals=[AnyPrincipal()] # Sensitive
2424))
2525</ pre >
2626< h2 > Compliant Solution</ h2 >
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ <h2>Sensitive Code Example</h2>
2020
2121PolicyStatement(
2222 effect=Effect.ALLOW,
23- actions=["*"], # Noncompliant
23+ actions=["*"], # Sensitive
2424 resources=["arn:aws:iam:::user/*"]
2525)
2626</ pre >
Original file line number Diff line number Diff line change @@ -10,6 +10,18 @@ <h2>Ask Yourself Whether</h2>
1010< h2 > Recommended Secure Coding Practices</ h2 >
1111< p > It’s recommended to restrict API access to authorized entities, unless the API offers a non-sensitive service designed to be public.</ p >
1212< h2 > Sensitive Code Example</ h2 >
13+ < p > For < a href ="https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_apigateway/Resource.html "> aws_cdk.aws_apigateway.Resource</ a > :</ p >
14+ < pre >
15+ from aws_cdk import (
16+ aws_apigateway as apigateway
17+ )
18+
19+ resource = api.root.add_resource("example")
20+ resource.add_method(
21+ "GET",
22+ authorization_type=apigateway.AuthorizationType.NONE # Sensitive
23+ )
24+ </ pre >
1325< p > For < a href ="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.CfnRoute.html "> aws_cdk.aws_apigatewayv2.CfnRoute</ a > :</ p >
1426< pre >
1527from aws_cdk import (
@@ -25,6 +37,27 @@ <h2>Sensitive Code Example</h2>
2537)
2638</ pre >
2739< h2 > Compliant Solution</ h2 >
40+ < p > For < a href ="https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_apigateway/Resource.html "> aws_cdk.aws_apigateway.Resource</ a > :</ p >
41+ < pre >
42+ from aws_cdk import (
43+ aws_apigateway as apigateway
44+ )
45+
46+ opts = apigateway.MethodOptions(
47+ authorization_type=apigateway.AuthorizationType.IAM
48+ )
49+ resource = api.root.add_resource(
50+ "example",
51+ default_method_options=opts
52+ )
53+ resource.add_method(
54+ "POST",
55+ authorization_type=apigateway.AuthorizationType.IAM
56+ )
57+ resource.add_method( # authorization_type is inherited from the Resource's configured default_method_options
58+ "POST"
59+ )
60+ </ pre >
2861< p > For < a href ="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.CfnRoute.html "> aws_cdk.aws_apigatewayv2.CfnRoute</ a > :</ p >
2962< pre >
3063from aws_cdk import (
Original file line number Diff line number Diff line change 33 "languages" : [
44 " PY"
55 ],
6- "latest-update" : " 2022-09-30T06:54:04.510718Z " ,
6+ "latest-update" : " 2022-10-14T12:58:57.615105Z " ,
77 "options" : {
88 "no-language-in-filenames" : true ,
99 "preserve-filenames" : true
You can’t perform that action at this time.
0 commit comments