Skip to content

Fix cross-note block mutation vulnerability by requiring noteId - #73

Merged
egeozcan merged 2 commits into
masterfrom
fix/note-ownership-block-mutation-16124615787883183077
Oct 6, 2026
Merged

egeozcan merged 2 commits into
masterfrom
fix/note-ownership-block-mutation-16124615787883183077

Conversation

@egeozcan

@egeozcan egeozcan commented Oct 6, 2026

Copy link
Copy Markdown
Owner

This PR ensures that noteId is explicitly required for any block mutation requests (such as updating content, updating state, or deleting a block). Previously, omitting noteId in requests would skip the authorization checks, allowing cross-note modifications. The frontend API client and the test suite have been updated to include noteId consistently.


PR created automatically by Jules for task 16124615787883183077 started by @egeozcan

Make `noteId` required in block mutation API handlers (UpdateBlockContent, UpdateBlockState, DeleteBlock) to properly validate note ownership and prevent IDOR-like modifications across different notes. Append `noteId` explicitly in frontend requests to match the requirement. Update associated integration tests.

Co-authored-by: egeozcan <185294+egeozcan@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.

The handler change made noteId mandatory on PUT/PATCH/DELETE block routes,
but the mr CLI, the e2e API client, the OpenAPI spec, the docs and the
bundled editor (public/dist) still sent or described the old optional form.
The CLI now looks the block up to send its owning noteId, openapi marks
noteId required, and tests pin the missing-noteId refusal on all four routes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@egeozcan

egeozcan commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

Review (automated): the handler change is correct (noteId required, ownership checked before mutate on PUT/PATCH/DELETE/POST-delete), but it left callers broken or stale. Fixed in 6927aca: mr CLI update/update-state/delete now look up the block and send its noteId (previously would 400); e2e API client helpers likewise; openapi.yaml marks noteId required on 4 operations; docs-site API/concepts/custom-block-types docs and the retake-screenshots skill updated (docs said noteId was optional); public/dist/main.js was not rebuilt after the blockEditor.js change, now rebuilt. Added tests pinning the missing-noteId 400 on all four routes (red on master handler, green now) and wrong-noteId on state/POST-delete. Ran: full go test (json1 fts5), Postgres block/scoped api_tests, E2E blocks+plugin-blocks, CLI project (352), cli-doctest. Note: remaining behaviour change is breaking for external API clients that omitted noteId, intended per the PR.

@google-labs-jules

Copy link
Copy Markdown
Contributor

Review (automated): the handler change is correct (noteId required, ownership checked before mutate on PUT/PATCH/DELETE/POST-delete), but it left callers broken or stale. Fixed in 6927aca: mr CLI update/update-state/delete now look up the block and send its noteId (previously would 400); e2e API client helpers likewise; openapi.yaml marks noteId required on 4 operations; docs-site API/concepts/custom-block-types docs and the retake-screenshots skill updated (docs said noteId was optional); public/dist/main.js was not rebuilt after the blockEditor.js change, now rebuilt. Added tests pinning the missing-noteId 400 on all four routes (red on master handler, green now) and wrong-noteId on state/POST-delete. Ran: full go test (json1 fts5), Postgres block/scoped api_tests, E2E blocks+plugin-blocks, CLI project (352), cli-doctest. Note: remaining behaviour change is breaking for external API clients that omitted noteId, intended per the PR.

Acknowledged. Thanks for fixing the callers, CLI, openapi.yaml, and rebuilding the frontend! The intention is indeed to break external clients that omit noteId to properly enforce authorization.

egeozcan added a commit that referenced this pull request Oct 6, 2026
Closing as obsolete since the fix is already covered by #73 and #71, as noted in the review comment.

Co-authored-by: egeozcan <185294+egeozcan@users.noreply.github.com>
@egeozcan
egeozcan merged commit d6f029f into master Oct 6, 2026
6 checks passed
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