Skip to content

fix(codeSign) esrp shell command built from environment values #3454

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

odaysec
Copy link
Contributor

@odaysec odaysec commented Jun 6, 2025

const { execSync } = require('child_process');

execSync(`${esrpTool} Sign -l Verbose -a ${authJson} -p ${policyJson} -i ${signInputJson}`);

Fix the issue the dynamically constructed shell command should be replaced with a safer approach that avoids shell interpretation. Specifically, the execSync call should be replaced with execFileSync, which allows passing arguments as an array. This ensures that special characters in the input are treated as literal values and do not alter the command's behavior.

implement the fix:

  1. Replace the execSync call on line 221 with execFileSync.
  2. Pass the command (Sign) and its arguments (-l Verbose, -a, authJson, -p, policyJson, -i, signInputJson) as separate elements in an array.
  3. Ensure that all paths (authJson, policyJson, signInputJson) are validated or sanitized before use.

Signed-off-by: Zeroday BYTE <github@zerodaysec.org>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 6, 2025
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 6, 2025
Copy link
Contributor

@skoeva skoeva left a comment

Choose a reason for hiding this comment

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

Hi, thanks for looking into this! Be sure to fix any frontend linting errors with make frontend-fixlint.

It would be also nice if you could tweak the commit & PR titles to match our commit guidelines.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joaquimrocha, odaysec

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2025
@joaquimrocha joaquimrocha self-requested a review July 7, 2025 17:57
@joaquimrocha
Copy link
Contributor

Ah, yeah, we need the linter complaint to be fixed. You should run make frontend-fixlint, @odaysec .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
Development

Successfully merging this pull request may close these issues.

4 participants