Skip to content

CR: fix/watch-upload-body-limit (sleepypod/core#839) - #26

Closed
ng wants to merge 1 commit into
cr-base/839-c2eb5328from
fix/watch-upload-body-limit
Closed

ng wants to merge 1 commit into
cr-base/839-c2eb5328from
fix/watch-upload-body-limit

Conversation

@ng

@ng ng commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Review proxy for sleepypod#839. Do not merge.

Summary by CodeRabbit

  • Bug Fixes
    • Watch uploads from unrecognized hosts are now rejected with a 403 response.
    • Uploads with fewer bytes than declared are rejected with a 400 response, and are not sent for importing.

@ng

ng commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: aa9db6cc-121a-4827-b9ef-cc0f76cf9b79
📥 Commits

Reviewing files that changed from the base of the PR and between c2eb532 and 8aad07f.

📒 Files selected for processing: 5
  • app/api/biometrics/watch-upload/route.test.ts
  • app/api/biometrics/watch-upload/route.ts
  • proxy.ts
  • src/lib/hostAllowlist.ts
  • tests/proxy.test.ts

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.

📝 Walkthrough

The watch-upload route now rejects unrecognized hosts and incomplete uploads. The proxy matcher skips this route and its subpaths. Shared host rejection logic now resides in the host allowlist module, and tests cover the matcher and both route checks.

Changes: Watch upload validation

Layer / File(s) Summary
Host guard and proxy routing
src/lib/hostAllowlist.ts, proxy.ts, tests/proxy.test.ts
The host rejection helper is added to the host allowlist module and imported by the proxy. The proxy matcher excludes the watch-upload route and its subpaths. Matcher tests compile patterns with Next.js path parsing and check the updated paths.
Watch upload route checks
app/api/biometrics/watch-upload/route.ts, app/api/biometrics/watch-upload/route.test.ts
The route checks the host before its existing origin, query, and body checks. After streaming, it returns 400 if a positive declared content length differs from the received byte count. Tests verify host rejection and incomplete-upload handling, including that no file is staged and no importer request is made.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 8aad0

The upload can bypass proxy body buffering while retaining its Host check. No issue identified here prevents merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: fixing the watch-upload body limit. The issue reference adds useful context.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@ng

ng commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Upstream PR merged into sleepypod/core dev; findings addressed there.

@ng ng closed this Oct 18, 2026
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.

1 participant