Skip to content

πŸ”’οΈ(backend) require present document access for thread/comment writes - #2840

Merged
lunika merged 1 commit into
mainfrom
fix/comment-access
Oct 19, 2026
Merged

lunika merged 1 commit into
mainfrom
fix/comment-access

Conversation

@lunika

@lunika lunika commented Oct 14, 2026

Copy link
Copy Markdown
Member

Purpose

The comment permission/abilities were not checking if the current user
still have access to the document, it was only checking if it is the
creator to allow it to perform update and destroy actions.
We now check the document's comment abilities before checking if it can
update or destroy a comment/thread

Proposal

  • πŸ”’οΈ(backend) require present document access for thread/comment writes

@lunika lunika self-assigned this Oct 14, 2026
@lunika lunika added the bug Something isn't working label Oct 14, 2026
@coderabbitai

coderabbitai Bot commented Oct 14, 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: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 4e471e15-50e9-42a7-aed9-34cdb368413a
πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 33f9ae1 and a484577.

πŸ“’ Files selected for processing: 2
  • CHANGELOG.md
  • src/backend/core/tests/documents/test_api_documents_comments.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

Thread and comment permission checks now require current document access. Model abilities and API tests cover revoked access, including denied writes and checks that stored state remains unchanged. The changelog records the backend permission fix.

Priority: βž– Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Medium

Suggested reviewers: antolc

Merge Risk: βšͺ Minimal Β· up to a4845

Thread and comment writes are denied when the actor no longer has document comment access, with no concrete merge risk identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main authorization change for thread and comment writes.
Description check Passed The description explains that document access is now checked before comment and thread updates or deletions, which matches the changeset.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 5 files. (1 skipped: 1…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 5 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
πŸ“ 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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

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

@lunika
lunika requested a review from jmaupetit October 14, 2026 14:16

@jmaupetit jmaupetit left a comment

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.

@lunika
lunika force-pushed the fix/comment-access branch from 33f9ae1 to d3d195a Compare October 19, 2026 09:10
@lunika
lunika enabled auto-merge (squash) October 19, 2026 09:11
The comment permission/abilities were not checking if the current user
still have access to the document, it was only checking if it is the
creator to allow it to perform update and destroy actions.
We now check the document's comment abilities before checking if it can
update or destroy a comment/thread
@lunika
lunika force-pushed the fix/comment-access branch from d3d195a to a484577 Compare October 19, 2026 10:05
@lunika
lunika merged commit 6838cf9 into main Oct 19, 2026
50 checks passed
@lunika
lunika deleted the fix/comment-access branch October 19, 2026 10:28
lunika added a commit that referenced this pull request Oct 21, 2026
Added

- ✨(docspec) handle DocSpec 4xx/5xx import errors distinctly #2552
- 🌐(frontend) add Crowdin translator context #2785
- ✨(frontend) open the emoji picker when adding a document emoji #2777

Changed

- πŸ’„(frontend) limit heading choices to levels 1–3

- ♻️(frontend) replace outdated AGPL mentions of BlockNote XL packages #2775
- πŸ’„(frontend) update upload loader and error ui #2778
- ⬆️(yhub) upgrade @y/hub to 0.10.1 #2853
- ♿️(frontend) allow opening the home button in a new tab #2839
- πŸ’„(frontend) use 12px for error page home links #2809

Fixed

- πŸ›(frontend) don't add a reader's duplicate to the doc tree #2860
- πŸ›(frontend) fix confirmation modal for duplicating sub-docs #2860
- πŸ›(frontend) wrap long unbroken document titles #2852
- πŸ›(frontend) wrap long text in the print export #2813
- πŸ”’οΈ(backend) bind comment thread to the path document on creation #2838
- πŸ›(frontend) fix search highlight hidden inside code blocks #2681
- πŸ”’οΈ(backend) require present document access for thread and comment
  writes #2840
- πŸ›(backend) enforce resource server action restrictions on the external
  API #2745
- πŸ›(backend) mark only the top duplicate as a copy, after its title #2855
- πŸ›(yhub) measure migration durations with a monotonic clock #2814
- πŸ›(backend) send the mention email when the cache is unreachable #2803
- πŸ›(backend) give media-auth its own throttle scope
- πŸ’„(frontend) remove the vertical line next to nested blocks #2825
lunika added a commit that referenced this pull request Oct 21, 2026
Added

- ✨(docspec) handle DocSpec 4xx/5xx import errors distinctly #2552
- 🌐(frontend) add Crowdin translator context #2785
- ✨(frontend) open the emoji picker when adding a document emoji #2777

Changed

- πŸ’„(frontend) limit heading choices to levels 1–3

- ♻️(frontend) replace outdated AGPL mentions of BlockNote XL packages #2775
- πŸ’„(frontend) update upload loader and error ui #2778
- ⬆️(yhub) upgrade @y/hub to 0.10.1 #2853
- ♿️(frontend) allow opening the home button in a new tab #2839
- πŸ’„(frontend) use 12px for error page home links #2809

Fixed

- πŸ›(frontend) don't add a reader's duplicate to the doc tree #2860
- πŸ›(frontend) fix confirmation modal for duplicating sub-docs #2860
- πŸ›(frontend) wrap long unbroken document titles #2852
- πŸ›(frontend) wrap long text in the print export #2813
- πŸ”’οΈ(backend) bind comment thread to the path document on creation #2838
- πŸ›(frontend) fix search highlight hidden inside code blocks #2681
- πŸ”’οΈ(backend) require present document access for thread and comment
  writes #2840
- πŸ›(backend) enforce resource server action restrictions on the external
  API #2745
- πŸ›(backend) mark only the top duplicate as a copy, after its title #2855
- πŸ›(yhub) measure migration durations with a monotonic clock #2814
- πŸ›(backend) send the mention email when the cache is unreachable #2803
- πŸ›(backend) give media-auth its own throttle scope
- πŸ’„(frontend) remove the vertical line next to nested blocks #2825
lunika added a commit that referenced this pull request Oct 21, 2026
Added

- ✨(docspec) handle DocSpec 4xx/5xx import errors distinctly #2552
- 🌐(frontend) add Crowdin translator context #2785
- ✨(frontend) open the emoji picker when adding a document emoji #2777

Changed

- πŸ’„(frontend) limit heading choices to levels 1–3

- ♻️(frontend) replace outdated AGPL mentions of BlockNote XL packages #2775
- πŸ’„(frontend) update upload loader and error ui #2778
- ⬆️(yhub) upgrade @y/hub to 0.10.1 #2853
- ♿️(frontend) allow opening the home button in a new tab #2839
- πŸ’„(frontend) use 12px for error page home links #2809

Fixed

- πŸ›(frontend) don't add a reader's duplicate to the doc tree #2860
- πŸ›(frontend) fix confirmation modal for duplicating sub-docs #2860
- πŸ›(frontend) wrap long unbroken document titles #2852
- πŸ›(frontend) wrap long text in the print export #2813
- πŸ”’οΈ(backend) bind comment thread to the path document on creation #2838
- πŸ›(frontend) fix search highlight hidden inside code blocks #2681
- πŸ”’οΈ(backend) require present document access for thread and comment
  writes #2840
- πŸ›(backend) enforce resource server action restrictions on the external
  API #2745
- πŸ›(backend) mark only the top duplicate as a copy, after its title #2855
- πŸ›(yhub) measure migration durations with a monotonic clock #2814
- πŸ›(backend) send the mention email when the cache is unreachable #2803
- πŸ›(backend) give media-auth its own throttle scope
- πŸ’„(frontend) remove the vertical line next to nested blocks #2825
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants