Skip to content

fix(#3577): remove shell=True and convert commands to argument lists to prevent command injection#3578

Open
guptapratykshh wants to merge 4 commits intoaugurlabs:mainfrom
guptapratykshh:fix/command-injection-facade-worker
Open

fix(#3577): remove shell=True and convert commands to argument lists to prevent command injection#3578
guptapratykshh wants to merge 4 commits intoaugurlabs:mainfrom
guptapratykshh:fix/command-injection-facade-worker

Conversation

@guptapratykshh
Copy link
Copy Markdown
Contributor

Description

this PR fixes #3577 by removing shell=True from git command execution and converting all f-string commands to argument lists infacade worker.

Signed commits

  • Yes, I signed my commits.

Copy link
Copy Markdown
Collaborator

@shlokgilda shlokgilda left a comment

Choose a reason for hiding this comment

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

took a look at this - the fix is solid. nice catch on the shell=True issue.

couple notes from testing:

  1. git itself actually blocks the injection chars (backticks, $(), ;) in branch names - so the real attack surface was narrower than we initially thought. but | and & are still allowed, which could be exploited with shell=True, so this fix is still the right call.
  2. please confirm the intent behind the switch from git remote show origin | sed to git symbolic-ref.
  3. tiny nit: cmd: list could be cmd: list[str] for better type hints

…nt lists to prevent command injection

Signed-off-by: guptapratykshh <[email protected]>
…d strict typing

Replaces git symbolic-ref with git remote show origin parsed in Python to ensure accuracy while preventing command injection. Updates type hints.

Signed-off-by: guptapratykshh <[email protected]>
@guptapratykshh guptapratykshh force-pushed the fix/command-injection-facade-worker branch from b1913f4 to 3da58ce Compare January 15, 2026 16:52
Copy link
Copy Markdown
Collaborator

@shlokgilda shlokgilda left a comment

Choose a reason for hiding this comment

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

PR looks good. Once you create the helper function, I think we are GTG

@guptapratykshh guptapratykshh force-pushed the fix/command-injection-facade-worker branch from 1ca8aad to a71e04f Compare January 15, 2026 18:24
shlokgilda
shlokgilda previously approved these changes Jan 15, 2026
Copy link
Copy Markdown
Collaborator

@shlokgilda shlokgilda left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Collaborator

@MoralCode MoralCode left a comment

Choose a reason for hiding this comment

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

Overall i like the move to the list-based args and not using shell=True. Theres a couple unrelated changes in here though


getremotedefault = (
f"git -C {absolute_path} remote show origin | sed -n '/HEAD branch/s/.*: //p'")
getremotedefault = ["git", "-C", absolute_path, "symbolic-ref", "refs/remotes/origin/HEAD"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Need to confirm that this is functionally the same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes

@guptapratykshh guptapratykshh force-pushed the fix/command-injection-facade-worker branch from bd88239 to 8d7d2a3 Compare January 15, 2026 19:35
Copy link
Copy Markdown
Collaborator

@shlokgilda shlokgilda left a comment

Choose a reason for hiding this comment

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

LGTM

@sgoggins sgoggins added the high priority Blocking multiple other things, causing data loss, or other incredibly urgent things label Jan 20, 2026
@sgoggins sgoggins self-assigned this Jan 20, 2026
@MoralCode MoralCode added this to the v0.93.0 milestone Jan 21, 2026
Comment on lines -417 to +418
return_code_remote, remotedefault = facade_helper.run_git_command(
return_code_remote, output = facade_helper.run_git_command(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this feels like we are maybe duplicating a lot of code here. Can we maybe refactor some of this git access type of stuff into shared functions?

@MoralCode
Copy link
Copy Markdown
Collaborator

Hello! Just wanted to check in to see if you were still interested in helping the maintainers merge this PR. We noticed it has been a little while since this last had activity, and are considering closing it or taking it over if it remains in its current state.

Please react to or reply to this to confirm your interest in the next 7 days or let us know if you are no longer interested in this so we can best prioritize everyone's contributions.

Thanks!

@MoralCode MoralCode added stale Stuff that's abandoned or not making forward progress and may need taking over/reassignment/closing security Related to keeping Augur secure labels Feb 9, 2026
@MoralCode MoralCode modified the milestones: v0.93.0, v0.94.0 Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority Blocking multiple other things, causing data loss, or other incredibly urgent things security Related to keeping Augur secure stale Stuff that's abandoned or not making forward progress and may need taking over/reassignment/closing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shell=True could lead to injection in Facade Worker

4 participants