Skip to content

Disallow parent dir path in sanitize_params#1828

Merged
ryan-pratt merged 1 commit into
mainfrom
bug/sanitize-params-parent-dir
Jan 15, 2025
Merged

Disallow parent dir path in sanitize_params#1828
ryan-pratt merged 1 commit into
mainfrom
bug/sanitize-params-parent-dir

Conversation

@ryan-pratt

@ryan-pratt ryan-pratt commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

Patches the following CVEs:

@ryan-pratt ryan-pratt requested a review from ryanmelt January 14, 2025 18:13
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jan 14, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.58%. Comparing base (e319cdb) to head (fc7e113).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1828      +/-   ##
==========================================
+ Coverage   79.56%   79.58%   +0.01%     
==========================================
  Files         517      517              
  Lines       40739    40743       +4     
==========================================
+ Hits        32414    32425      +11     
+ Misses       8325     8318       -7     
Flag Coverage Δ
python 84.30% <ø> (+0.04%) ⬆️
ruby-api 48.69% <100.00%> (+0.04%) ⬆️
ruby-backend 82.61% <ø> (ø)

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.

value = arg.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "�").strip.tr("\u{202E}%$|:;/\t\r\n\\", "-")
end
if not allow_parent_dir
value = value.gsub(/(\.|%2e){2}/i, "-")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any reason to replace with - vs just remove completely?

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.

No particular reason, just matching the tr() above

@ryan-pratt ryan-pratt merged commit 2fcef55 into main Jan 15, 2025
@ryan-pratt ryan-pratt deleted the bug/sanitize-params-parent-dir branch January 15, 2025 21:40
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