Skip to content

Prevent path traversal in tool config names#2910

Merged
jmthomas merged 3 commits intomainfrom
save_tool_config
Mar 5, 2026
Merged

Prevent path traversal in tool config names#2910
jmthomas merged 3 commits intomainfrom
save_tool_config

Conversation

@jmthomas
Copy link
Copy Markdown
Member

@jmthomas jmthomas commented Mar 3, 2026

Reject tool and config names containing /, , or .. in ToolConfigModel to prevent writing arbitrary files within the shared /plugins directory. Added client-side validation in SaveConfigDialog.vue and backend validation in both Ruby and Python models with corresponding specs.

Reject tool and config names containing /, \, or .. in ToolConfigModel
to prevent writing arbitrary files within the shared /plugins directory.
Added client-side validation in SaveConfigDialog.vue and backend
validation in both Ruby and Python models with corresponding specs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@jmthomas jmthomas requested review from ryan-pratt and ryanmelt March 3, 2026 22:58
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.21%. Comparing base (f9d0650) to head (e6efccb).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2910      +/-   ##
==========================================
- Coverage   78.28%   78.21%   -0.08%     
==========================================
  Files         673      673              
  Lines       55204    55229      +25     
  Branches      728      728              
==========================================
- Hits        43216    43196      -20     
- Misses      11910    11955      +45     
  Partials       78       78              
Flag Coverage Δ
python 79.30% <ø> (-0.02%) ⬇️
ruby-api 79.29% <ø> (-0.82%) ⬇️
ruby-backend 82.18% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@ryanmelt ryanmelt left a comment

Choose a reason for hiding this comment

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

Generally regex is not a secure method to check for path traversal. Better would be to whitelist allowed characters if that makes sense for the given use case.

jmthomas and others added 2 commits March 4, 2026 08:45
Replace denylist regex that blocked specific dangerous characters with an
allowlist pattern that only permits letters, digits, hyphens, underscores,
spaces, and periods. This is more secure as it rejects unexpected characters
by default rather than trying to enumerate all dangerous ones.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@jmthomas jmthomas requested a review from ryanmelt March 4, 2026 16:13
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 4, 2026

ryan-pratt
ryan-pratt previously approved these changes Mar 4, 2026
@ryan-pratt ryan-pratt dismissed their stale review March 4, 2026 23:45

missed comment thread

@jmthomas jmthomas merged commit 479cb77 into main Mar 5, 2026
50 of 51 checks passed
@jmthomas jmthomas deleted the save_tool_config branch March 5, 2026 00:27
jmthomas added a commit that referenced this pull request Mar 21, 2026
Prevent path traversal in tool config names
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.

3 participants