Skip to content

Defect content drive search leaks info with limited user#34783

Merged
dario-daza merged 18 commits intomainfrom
34354-defect-content-drive-search-leaks-info-with-limited-user
Mar 4, 2026
Merged

Defect content drive search leaks info with limited user#34783
dario-daza merged 18 commits intomainfrom
34354-defect-content-drive-search-leaks-info-with-limited-user

Conversation

@dario-daza
Copy link
Contributor

@dario-daza dario-daza commented Feb 26, 2026

Content Drive: Permission Filtering & Cursor-Based Pagination

Problem

Content Drive was not filtering results by user permissions, allowing users to see content they should not have access to. Additionally, the offset-based pagination strategy (startRow) skipped raw DB rows before applying permission filters, which produced sparse or empty pages — items were silently removed from an already-sliced result.

Solution

Content is now filtered by the requesting user's permissions before the page is assembled. The DB is scanned in configurable chunks; after each chunk, inaccessible items are discarded and only user-visible content is accumulated. Scanning stops as soon as enough visible items are collected to fill the page.

This guarantees that:

  • Every page contains exactly maxResults items whenever enough visible content exists
  • Users never see content they are not allowed to read
  • Restricted users browsing large folders always get correctly sized pages, regardless of how many items are hidden from them

Cursor-based pagination
Both folders and content now use cursor-based pagination instead of an offset:

  • contentCursor — the DB row position where the next content scan should resume
  • folderCursor — the index into the folder list where the next folder page should resume

The request & response

Now returns nextContentCursor and nextFolderCursor, which clients pass on the next request to continue exactly where the previous page ended — no gaps, no duplicates.
Plus we also return hasMore and hasMore to know we could retrieve more content or folders for the next page.

Original Request Proposed Request
image image
Original Response Proposed Response
image image

This PR fixes: #34354

This PR fixes: #34354

@dario-daza dario-daza changed the title 34354 defect content drive search leaks info with limited user Defect content drive search leaks info with limited user Feb 26, 2026
@github-actions github-actions bot added the Area : Backend PR changes Java/Maven backend code label Feb 26, 2026
@dario-daza dario-daza marked this pull request as ready for review March 3, 2026 10:41
@dario-daza dario-daza added this pull request to the merge queue Mar 4, 2026
Merged via the queue into main with commit 4c0979d Mar 4, 2026
48 checks passed
@dario-daza dario-daza deleted the 34354-defect-content-drive-search-leaks-info-with-limited-user branch March 4, 2026 15:33
oidacra pushed a commit that referenced this pull request Mar 5, 2026
## Content Drive: Permission Filtering & Cursor-Based Pagination

### Problem
Content Drive was not filtering results by user permissions, allowing
users to see content they should not have access to. Additionally, the
offset-based pagination strategy (startRow) skipped raw DB rows before
applying permission filters, which produced sparse or empty pages —
items were silently removed from an already-sliced result.


### Solution
Content is now filtered by the requesting user's permissions before the
page is assembled. The DB is scanned in configurable chunks; after each
chunk, inaccessible items are discarded and only user-visible content is
accumulated. Scanning stops as soon as enough visible items are
collected to fill the page.

**This guarantees that:**
- Every page contains exactly maxResults items whenever enough visible
content exists
  - Users never see content they are not allowed to read
- Restricted users browsing large folders always get correctly sized
pages, regardless of how many items are hidden from them

**Cursor-based pagination**
Both folders and content now use cursor-based pagination instead of an
offset:

- `contentCursor` — the DB row position where the next content scan
should resume
- `folderCursor` — the index into the folder list where the next folder
page should resume

#### The request & response
Now returns `nextContentCursor` and `nextFolderCursor`, which clients
pass on the next request to continue exactly where the previous page
ended — no gaps, no duplicates.
Plus we also return hasMore and hasMore to know we could retrieve more
content or folders for the next page.

Original Request           |  Proposed Request
:-------------------------:|:-------------------------:
<img width="446" height="243" alt="image"
src="https://github.com/user-attachments/assets/a1537ce6-2e1f-4be6-ad4b-954ac266d048"
/> | <img width="423" height="254" alt="image"
src="https://github.com/user-attachments/assets/39a41c41-3bd2-4900-870e-ff7bf0579856"
/>
**Original Response**  |  **Proposed Response**
<img width="282" height="223" alt="image"
src="https://github.com/user-attachments/assets/90e32e37-18a9-4042-b24a-6d8d4efe647a"
/> | <img width="254" height="277" alt="image"
src="https://github.com/user-attachments/assets/c69e9372-204c-4785-8f91-29cb35fb5eb6"
/>

This PR fixes: #34354
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[DEFECT] Content Drive Search leaks info with limited user

4 participants