๐ก๏ธ Sentinel: [HIGH] ๋น ASCII ํค๋๋ก ์ธํ DoS ์ทจ์ฝ์ ์์ - #434
๐ก๏ธ Sentinel: [HIGH] ๋น ASCII ํค๋๋ก ์ธํ DoS ์ทจ์ฝ์ ์์ #434seonghobae wants to merge 2 commits into
Conversation
|
๐ Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a ๐ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Review limit reached
Next review available in: 21 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review detailsโ๏ธ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: โ Files ignored due to path filters (1)
๐ Files selected for processing (1)
๐ WalkthroughWalkthroughAuthorization ํ ํฐ ๋น๊ต๋ฅผ UTF-8 ๋ฐ์ดํธ ๊ธฐ๋ฐ์ผ๋ก ๋ณ๊ฒฝํ๊ณ , ๋นASCII ํค๋ ์ ๋ ฅ์ด 500 ๋์ 401์ ๋ฐํํ๋ ํ ์คํธ์ ์ทจ์ฝ์ ๋์ ๊ธฐ๋ก์ ์ถ๊ฐํ์ต๋๋ค. ChangesAuthorization ์ธ์ฆ ๊ฐํ
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: ๐ฅ Pre-merge checks | โ 5โ Passed checks (5 passed)
โจ Finishing Touches๐งช Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
๐ค Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.jules/sentinel.md:
- Line 93: Update the โ2024-05-15 - DoS via non-ASCII headers in HMAC
comparisonโ heading in sentinel.md by adding a blank line before the heading and
another blank line after the vulnerability description, satisfying markdownlint
MD022 without changing the content.
๐ช Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
โน๏ธ Review info
โ๏ธ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 581717bd-4a70-4da1-a73f-9814e4e80391
๐ Files selected for processing (3)
.jules/sentinel.mdsrc/newsdom_api/main.pytests/test_auth.py
| **Vulnerability:** The `_safe_upload_filename` function used `filename.replace`, `PurePosixPath`, and `re.sub` on unbounded client input, making it vulnerable to ReDoS or CPU/memory exhaustion (DoS) when fed extremely long strings. | ||
| **Learning:** Even fast standard library functions like `PurePosixPath` and string replacements can cause significant lag when chained on strings in the megabytes. String processing operations should always bound their inputs first if the input is untrusted and can be arbitrarily large. | ||
| **Prevention:** Cap the length of client-provided filename strings early by slicing them (e.g. `filename = filename[-512:]`) before doing more complex string parsing or regex replacements, especially when only the basename suffix is relevant. | ||
| ## 2024-05-15 - DoS via non-ASCII headers in HMAC comparison |
There was a problem hiding this comment.
๐ Maintainability & Code Quality | ๐ก Minor | โก Quick win
์ ๋ชฉ ์๋ค์ ๋น ์ค์ ์ถ๊ฐํ์ธ์.
markdownlint์ MD022 ๊ฒฝ๊ณ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด ์ ์ ๋ชฉ ์๊ณผ ์ทจ์ฝ์ ์ค๋ช
๋ค์ ๋น ์ค์ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
์์ ์์
+
## 2024-05-15 - DoS via non-ASCII headers in HMAC comparison
+
**Vulnerability:** The API crashed with a 500 Internal Server Error when a non-ASCII string was provided in the `Authorization` header, because `hmac.compare_digest()` raises a `TypeError` for non-ASCII inputs.๐ Committable suggestion
โผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## 2024-05-15 - DoS via non-ASCII headers in HMAC comparison | |
| ## 2024-05-15 - DoS via non-ASCII headers in HMAC comparison | |
๐งฐ Tools
๐ช markdownlint-cli2 (0.23.0)
[warning] 93-93: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
[warning] 93-93: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
๐ค Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.jules/sentinel.md at line 93, Update the โ2024-05-15 - DoS via non-ASCII
headers in HMAC comparisonโ heading in sentinel.md by adding a blank line before
the heading and another blank line after the vulnerability description,
satisfying markdownlint MD022 without changing the content.
Source: Linters/SAST tools
There was a problem hiding this comment.
Pull request overview
This PR hardens the optional bearer-auth gate on POST /parse by preventing a TypeError crash when the Authorization header contains non-ASCII characters, eliminating a potential DoS vector in the auth check.
Changes:
- Encode both the provided and expected bearer strings to UTF-8 bytes before calling
hmac.compare_digest(). - Add a regression test ensuring non-ASCII
Authorizationinput returns401 Unauthorized(not500). - Document the vulnerability/learning/prevention entry in the Sentinel log.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/newsdom_api/main.py |
Makes bearer token comparison robust to non-ASCII header values by comparing UTF-8 bytes. |
tests/test_auth.py |
Adds a regression test covering non-ASCII Authorization input to ensure a 401 response. |
.jules/sentinel.md |
Records the vulnerability and prevention guidance for future reference. |
๐ก Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # CVE-2026-61632 applies to pymdown-extensions via mkdocs-material. | ||
| # An upstream fix is not yet available for this vulnerability. | ||
| # Revisit by 2026-10-31 or when an upstream patch is available. | ||
| CVE-2026-61632 |
๐จ Severity: HIGH
๐ก Vulnerability:
Authorizationํค๋์ ๋น ASCII ๋ฌธ์๊ฐ ํฌํจ๋ ๊ฒฝ์ฐhmac.compare_digest()์์TypeError๊ฐ ๋ฐ์ํ์ฌ 500 Internal Server Error๋ฅผ ๋ฐํํ๋ DoS ์ทจ์ฝ์ ์ด ๋ฐ๊ฒฌ๋์์ต๋๋ค.๐ฏ Impact: ์ ์์ ์ธ ์ฌ์ฉ์๊ฐ ํน์ ๋ฌธ์๊ฐ ํฌํจ๋ ์ธ์ฆ ํค๋๋ฅผ ์ ์กํ์ฌ ์๋น์ค์ ์๊ธฐ์น ์์ ์ค๋ฅ๋ฅผ ์ ๋ฐํ๊ณ ๋ฆฌ์์ค๋ฅผ ๊ณ ๊ฐ์ํฌ ์ ์์ต๋๋ค.
๐ง Fix:
hmac.compare_digest()๋ก ๋น๊ตํ๊ธฐ ์ ์ ์ ๋ ฅ๊ฐ์.encode('utf-8')์ ํตํด ๋ฐ์ดํธ ๋ฐฐ์ด๋ก ์ธ์ฝ๋ฉํ๋๋ก ์์ ํ์ฌ ์์ธ๋ฅผ ๋ฐฉ์งํ์ต๋๋ค.โ Verification:
tests/test_auth.py์ ๋น ASCII ์ธ์ฆ ํค๋๋ฅผ ์ ์กํ์ฌ 401 ์๋ฌ๋ฅผ ๋ฐํํ๋์ง ํ์ธํ๋ ํ ์คํธ(test_parse_rejects_non_ascii_bearer_without_500)๋ฅผ ์ถ๊ฐํ๊ณ ๋ชจ๋ ํ ์คํธ๊ฐ ํต๊ณผํ๋์ง ํ์ธํ์ต๋๋ค.PR created automatically by Jules for task 12033426029127814609 started by @seonghobae
Summary by CodeRabbit
๋ฒ๊ทธ ์์
WWW-Authenticateํค๋ ๋์์ ์ ์ง๋ฉ๋๋ค.ํ ์คํธ