[DT-3253] Filter document fetches by entity-allowed categories#2901
Merged
Conversation
rushtong
reviewed
May 11, 2026
rushtong
approved these changes
May 11, 2026
Contributor
rushtong
left a comment
There was a problem hiding this comment.
Looks good, see comment around BindList. 👍🏽
…jectDAO.java Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses DT-3253 by preventing cross-domain document retrieval when entity IDs overlap, by scoping file metadata lookups to the categories allowed for the requested document entity (dar, dac, dataset, study).
Changes:
- Added category-constrained DAO queries for fetching active files and listing file metadata.
- Updated
FileStorageObjectServicelist/get/download/update/delete flows to use category-scoped DAO lookups based onDocumentEntity. - Updated/added unit tests to assert the new category filtering behavior in both service and DAO layers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/java/org/broadinstitute/consent/http/db/FileStorageObjectDAO.java | Adds category-filtered queries for active-file lookup and metadata listing. |
| src/main/java/org/broadinstitute/consent/http/service/FileStorageObjectService.java | Routes document flows through category-scoped DAO methods and introduces entity→allowed-category mapping helper. |
| src/test/java/org/broadinstitute/consent/http/db/FileStorageObjectDAOTest.java | Adds DAO tests to verify category filtering for new queries. |
| src/test/java/org/broadinstitute/consent/http/service/FileStorageObjectServiceTest.java | Updates service tests to expect category-filtered DAO calls for entity document flows. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Addresses
https://broadworkbench.atlassian.net/browse/DT-3253
Summary
This PR fixes document retrieval so that DAO lookups return only files whose category is valid for the requested entity type (
dar,dac,dataset,study). It adds category-constrained DAO queries, updatesFileStorageObjectServiceto use them for list/get/file/update/delete flows, and updates tests to verify the new filtering behavior.Have you read CONTRIBUTING.md lately? If not, do that first.