Describe the bug
In SecurityHub we get a HIGH severity notification CWE-117
,93-Log injection, with message:
User-provided inputs must be sanitized before they are logged. An attacker can use unsanitized input to break a log's integrity, forge log entries, or bypass log monitors.
We get this notification when the CDK custom resource CustomCDKBucketDeployment is deployed by CDK. Can you update the Lambda Python code so we don't get this notification anymore? Inspector notifies about these lines starting at line 103 in the Lambda Python code:
logger.info("| s3_dest: %s" % s3_dest)
logger.info("| old_s3_dest: %s" % old_s3_dest)
Inspector suggests this solution:
logger.info("| s3_dest: %s" % urllib.parse.quote(s3_dest))
Expected Behavior
That we get no SecurityHub notification
Current Behavior
When I specify this:
new s3deploy.BucketDeployment(...)
Then a Custom resource with CustomCDKBucketDeployment Lambda is created. After that Inspector creates a HIGH severity notification: CWE-117,93 - Log injection
Reproduction Steps
const testBucket = new Bucket(this,'TestBucket',{
bucketName: "test-bucket-test",
enforceSSL: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true
})
new s3deploy.BucketDeployment(this,'CopyFilesFromLocalToBucket', {
sources: [
s3deploy.Source.data('tree.json', fs.readFileSync(path.join(__dirname + '/../cdk.out/tree.json'), 'utf-8') )
],
destinationBucket: testBucket
})
Possible Solution
Inspector notifies about these lines starting at line 103 in the Lambda code:
logger.info("| s3_dest: %s" % s3_dest)
logger.info("| old_s3_dest: %s" % old_s3_dest)
Inspector suggests this solution:
logger.info("| s3_dest: %s" % urllib.parse.quote(s3_dest))
It is possible there is a better solution.
Additional Information/Context
No response
CDK CLI Version
2.141.0
Framework Version
No response
Node.js Version
18.19.1
OS
Windows
Language
TypeScript
Language Version
5.2.2
Other information
No response
Describe the bug
In SecurityHub we get a HIGH severity notification CWE-117
,93-Log injection, with message:
User-provided inputs must be sanitized before they are logged. An attacker can use unsanitized input to break a log's integrity, forge log entries, or bypass log monitors.
We get this notification when the CDK custom resource CustomCDKBucketDeployment is deployed by CDK. Can you update the Lambda Python code so we don't get this notification anymore? Inspector notifies about these lines starting at line 103 in the Lambda Python code:
Inspector suggests this solution:
Expected Behavior
That we get no SecurityHub notification
Current Behavior
When I specify this:
new s3deploy.BucketDeployment(...)
Then a Custom resource with CustomCDKBucketDeployment Lambda is created. After that Inspector creates a HIGH severity notification: CWE-117,93 - Log injection
Reproduction Steps
Possible Solution
Inspector notifies about these lines starting at line 103 in the Lambda code:
Inspector suggests this solution:
It is possible there is a better solution.
Additional Information/Context
No response
CDK CLI Version
2.141.0
Framework Version
No response
Node.js Version
18.19.1
OS
Windows
Language
TypeScript
Language Version
5.2.2
Other information
No response