-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GHAS/CodeQL reporting missing input sanitization #6623
Comments
Hi @automartin5000 - thanks for reaching out. The issue isn't really SDK related but I'm happy to offer guidance anyway. The alert you're receiving is related to a potential security vulnerability known as "Insecure String Encoding or Escaping" (CWE-116). This vulnerability can occur when user input is not properly sanitized or encoded, allowing attackers to inject malicious code or data into the application. In the specific code snippet you provided, the issue lies in the way the Here's an example of how an attacker could exploit this vulnerability: Suppose the input string is "foo\bar". The To mitigate this vulnerability, you should use a more robust and secure way of escaping or encoding strings. One option is to use the built-in function quoteHeader(part) {
if (part.includes(",") || part.includes('"')) {
part = `"${JSON.stringify(part).slice(1, -1)}"`;
}
return part;
} Alternatively, you can use a dedicated library or module that provides secure string encoding or escaping functions, such as the |
Hey @aBurmeseDev, that's not our code. As I mentioned, that code seems to be coming from the node module I believe I just found the original source. I thought that was AWS source, but maybe not? If not, it still seems like that's a module being used by the AWS SDK. |
Understood, sorry for the confusion. I'll take a further look at the code and attempt to reproduce this first. A few questions to help me identify the culprit:
|
We started seeing the security alert a few weeks ago, which seems like it coincides with the timing of the commit from the linked repo. Can't really share any other code or logs other than the ones I've sent. I'm guessing if whoever owns that repo enables GHAS, they'll start seeing it too. |
Checkboxes for prior research
Describe the bug
A few weeks ago, we started seeing GitHub Advanced Security alerts on Lambda functions that bundle AWS SDK code. The alert is:
Specifically, multiple alerts point to the following block of code:
The full code block is
esbuild says the code is in
node_modules/@smithy/smithy-client/dist-cjs/index.js
Regression Issue
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Node v20.11.1
Reproduction Steps
Open PR with code bundled with 3.682.0
Observed Behavior
GitHub Advanced Security throws alert
Expected Behavior
No security alert
Possible Solution
Unclear if this is a true finding or a false positive given this is a client SDK.
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: