Skip to content

[dtq-dev-9-base][v7→v9 adapted] fix(security): filter unreadable items/bitstreams from public usage statistics (port of #1540) - #1585

Open
Kasinhou wants to merge 2 commits into
dtq-dev-9-basefrom
v9base/port-1540
Open

Kasinhou wants to merge 2 commits into
dtq-dev-9-basefrom
v9base/port-1540

Conversation

@Kasinhou

Copy link
Copy Markdown

⚠️ PORT z v7 — CHERRY-PICK NEBOL ČISTÝ, MUSEL BYŤ UPRAVENÝ PRE v9

Tento fix pochádza z dtq-dev (v7). Cherry-pick do dtq-dev-9-base sa NEDAL aplikovať úplne čisto a bolo ho treba manuálne prispôsobiť v9. Prosím o dôkladný review.

Čo bolo treba upraviť: produkčný kód (UsageReportUtils) sa zlúčil čisto; konflikt bol len v teste StatisticsRestRepositoryIT (poradie importov Calendar/Date) — vyriešené ponechaním oboch. Logika nezmenená.


Port of #1540 z dtq-dev do dtq-dev-9-base. Part of UFAL/Propagate PRs to v9: dataquest-dev/dspace-customers#1107

🤖 Generated with Claude Code

…tatistics (#1540)

* Filter unreadable items/bitstreams from public usage-statistics reports

Site-level TopItems and item TotalDownloads reports returned the name and
UUID of items/files without checking the caller's READ permission, leaking
withdrawn/embargoed/restricted content to anonymous users.

Inject AuthorizeService and BitstreamService into UsageReportUtils and only
add a point when the current user has READ on the resolved item/bitstream.
Drop the unresolved raw-handle fallback in the site report.

* Resolve download bitstreams legacy-safe and add non-admin READ test

Use BitstreamService#findByIdOrLegacyId with a null/blank guard instead of
UUID.fromString so migrated statistics rows with legacy numeric ids do not
crash the TotalDownloads report. Add a test proving a non-admin eperson with
an explicit READ policy still sees the restricted bitstream while another
eperson without it does not.

* fix: repair usage report tests and return canonical legacy UUIDs

---------

Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
(cherry picked from commit a88553d)
@Kasinhou Kasinhou self-assigned this Oct 29, 2026

This branch has not been deployed

No deployments
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