Skip to content

fix(security): validate port is integer in kill_process_on_port - #806

Closed
CodeLine9 wants to merge 1 commit into
amd:mainfrom
CodeLine9:clawoss/fix/kill-port-validate
Closed

CodeLine9 wants to merge 1 commit into
amd:mainfrom
CodeLine9:clawoss/fix/kill-port-validate

Conversation

@CodeLine9

Copy link
Copy Markdown
Contributor

Bug

kill_process_on_port interpolates the port argument into shell commands with shell=True. If port is not an integer (e.g. a string like 8080; rm -rf /), arbitrary shell commands execute.

Fix

Add int(port) conversion at the top of the function with explicit ValueError for non-integer values. Since port is validated as an integer before any string interpolation, shell injection is no longer possible.

Closes #789

@CodeLine9

Copy link
Copy Markdown
Contributor Author

Closing — won't have bandwidth to address feedback on this. Apologies for the noise.

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.

Security: kill_process_on_port uses shell=True with unvalidated port interpolation

1 participant