Skip to content

fix(security): prevent cross-book reply hijacking (IDOR)#850

Merged
d-oit merged 3 commits into
mainfrom
jules-12959796695073421035-bfd3ab55
Jul 25, 2026
Merged

fix(security): prevent cross-book reply hijacking (IDOR)#850
d-oit merged 3 commits into
mainfrom
jules-12959796695073421035-bfd3ab55

Conversation

@d-oit

@d-oit d-oit commented Jul 25, 2026

Copy link
Copy Markdown
Owner

This pull request addresses an Insecure Direct Object Reference (IDOR) and tenant isolation bypass vulnerability when replying to existing comments. Previously, the API did not verify if the parent comment referenced by parentCommentId belonged to the same book as the new comment or was accessible to the replying user.

We have implemented robust validation on parentCommentId in the POST /api/books/:bookId/comments route. Now, the parent comment is fetched and checked against the following security boundaries:

  1. It must exist and not be marked as 'deleted'.
  2. It must belong to the requested bookId to prevent cross-book comment nesting and notification leak.
  3. Its visibility must either be 'shared' or it must be owned by the replying user (for internal comments).

If any of these conditions are violated, the API returns a clean, standard JSON error response (400 Bad Request or 403 Forbidden).

We have also added 5 comprehensive unit test cases in apps/worker/src/__tests__/security.comments-idor.test.ts to cover these edge cases, and upgraded js-yaml and react-router-dom to patch high-severity vulnerabilities reported by pnpm audit. All quality gates, linting workflows, and test suites across the workspace have passed 100% successfully.


PR created automatically by Jules for task 12959796695073421035 started by @d-oit

Implements parentCommentId verification on comment creation to ensure the
parent comment exists, is active, belongs to the same book, and is visible
to the current user. Also upgrades js-yaml and react-router-dom to patch
known vulnerabilities.

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown

🚀 Performance Report

⚡ Startup & Interaction

Metric Value (ms) Limit (ms) Trend Status
First Contentful Paint 312.00 1500 -
Chapter Switch Latency 0.00 300 -
Offline Rehydrate Time 210.60 800 -
DOM Interactive 35.30 - - -
Load Event End 199.70 - - -

🛠️ CI & Workflow

Metric Value Limit Status
Total CI Duration 6.05 min 15.00 min
Pnpm Cache Hit Hit -

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploying do-epub-studio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 89b343e
Status: ✅  Deploy successful!
Preview URL: https://ed3c57ff.do-epub-studio.pages.dev
Branch Preview URL: https://jules-12959796695073421035-b.do-epub-studio.pages.dev

View logs

@codacy-production

codacy-production Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 6 complexity · 12 duplication

Metric Results
Complexity 6
Duplication 12

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

google-labs-jules Bot and others added 2 commits July 25, 2026 06:42
Pins `brace-expansion` and `react-router` to secure versions, resolving high-severity dependency vulnerabilities. Implements parentCommentId verification in the comments router to prevent IDOR and cross-contamination.

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
Pins `brace-expansion` and `react-router` to secure versions, resolving high-severity dependency vulnerabilities. Implements parentCommentId verification in the comments router to prevent IDOR and cross-contamination. Resolves Codacy as any warning.

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
@d-oit
d-oit merged commit d29a5ef into main Jul 25, 2026
28 checks passed
@d-oit
d-oit deleted the jules-12959796695073421035-bfd3ab55 branch July 25, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant