Skip to content

fix(create-termui-app): validate project name to prevent path traversal#710

Open
Siddh2024 wants to merge 1 commit into
Karanjot786:mainfrom
Siddh2024:fix-path-traversal-705
Open

fix(create-termui-app): validate project name to prevent path traversal#710
Siddh2024 wants to merge 1 commit into
Karanjot786:mainfrom
Siddh2024:fix-path-traversal-705

Conversation

@Siddh2024
Copy link
Copy Markdown

Description

The \create-termui-app\ scaffolding tool accepts arbitrary project names from user input (CLI args or interactive prompt) and passes them directly to
esolve()\ and \join()\ for file system operations without any validation. This allows path traversal via names like ../../../etc/evil\ or ../../malicious, enabling arbitrary file writes outside the intended project directory.

Root Cause

At \index.ts:92\ and \index.ts:147:
\\ s
const projectDir = resolve(process.cwd(), projectName);
\\

\projectName\ comes from \�rgs.name\ (CLI argument) or \ extPrompt()\ (interactive) — both unsanitized.

The Fix

Added \�alidateProjectName()\ that checks the name against /^[a-zA-Z0-9@][a-zA-Z0-9_.-]*$/\ and rejects ./... Called after name resolution from both CLI args and the interactive prompt.

Closes #705

@Siddh2024 Siddh2024 requested a review from Karanjot786 as a code owner June 4, 2026 13:40
@github-actions github-actions Bot added the type:bug +10 pts. Bug fix. label Jun 4, 2026
@Karanjot786 Karanjot786 added gssoc:approved Approved PR. Earns +50 base points. quality:clean x 1.2 multiplier. Clean implementation. level:intermediate +35 pts. Moderate task. type:feature +10 pts. New feature. type:security +20 pts. Security fix. labels Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved PR. Earns +50 base points. level:intermediate +35 pts. Moderate task. quality:clean x 1.2 multiplier. Clean implementation. type:bug +10 pts. Bug fix. type:feature +10 pts. New feature. type:security +20 pts. Security fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GSSoC] Security bug

2 participants