Skip to content
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

chore: Override smithy-client to fix CodeQL warning #346

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

dani-chmb
Copy link
Contributor

@dani-chmb dani-chmb commented Nov 22, 2024

Issue #, if available:

Code scanning alert

Description of changes:

The code-scanning alert points towards this generated line as the security issue. The root cause seems to be the smithy-client dependency inherited from the aws-sdk/client-ecs devDependency declared in package.json. Indeed, the latest version of the smithy-client exports the "quoteHeader" function where the problematic line stems from. Path: @smithy/smithy-client/dist-types/ts3.4/quote-header.d.ts

Adding the @smithy/smithy-client": "3.3.6" override to package.json, followed by this string of commands:

% rm -rf node_modules
% rm package-lock.json
% npm install
% npm ci
% npm run package

Results in dist/index.js no longer containing the problematic line. You should see in the diff for this file the removal of:

// src/quote-header.ts
function quoteHeader(part) {
  if (part.includes(",") || part.includes('"')) {
    part = `"${part.replace(/"/g, '\\"')}"`;
  }
  return part;
}
__name(quoteHeader, "quoteHeader");

The changes were tested by running a workflow that calls the action defined by this PR's commit from a simple ecs application.

Screenshot 2024-11-22 at 16 48 10

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "aws-actions-amazon-ecs-render-task-definition",
"version": "1.6.0",
"version": "1.6.1",
Copy link
Contributor

@omkhegde omkhegde Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we manually updating our release version? We should let the update happen as part of the release automation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, will remove manual update of release version

Copy link
Contributor

@omkhegde omkhegde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment

@dani-chmb
Copy link
Contributor Author

Addressed version number comment with new commit.

@dani-chmb dani-chmb requested a review from omkhegde November 25, 2024 17:58
@dani-chmb dani-chmb merged commit 5f46ec3 into aws-actions:master Nov 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants