Skip to content

fix: prevent shell injection in update script and avoid nil panic in SNI handler - #151

Merged
gosunuts merged 1 commit into
gosuda:mainfrom
fr4iser90:security-fixes-two-findings
Mar 24, 2026
Merged

fix: prevent shell injection in update script and avoid nil panic in SNI handler#151
gosunuts merged 1 commit into
gosuda:mainfrom
fr4iser90:security-fixes-two-findings

Conversation

@fr4iser90

Copy link
Copy Markdown
Contributor

This PR addresses two small but relevant robustness and security issues:

  1. frontend/update-shadcn.cjs

    • Replaced execSync with execFileSync to avoid shell string interpolation
    • Added basic validation for component names (^[a-z0-9_-]+$)

    This removes potential command injection vectors and aligns with safer process execution practices.

  2. portal/server.go

    • Added a nil-check before closing wrappedConn in the error path of handleSNIConn
    • Falls back to closing the original connection if wrapping failed

    This prevents a possible nil dereference panic during connection handling.

Both changes are minimal, backward-compatible, and do not alter intended behavior.

Use argument-based child process execution in the shadcn update script to avoid shell interpolation risks and add a nil-safe close fallback in SNI inspection error paths to prevent panics.

Made-with: Cursor
@gosunuts

Copy link
Copy Markdown
Member

LGTM

@gosunuts
gosunuts merged commit 10283d3 into gosuda:main Mar 24, 2026
1 check 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.

2 participants