Skip to content

[DT-3253] Filter document fetches by entity-allowed categories#2901

Merged
kevinmarete merged 4 commits into
developfrom
km-dt-3253-fix-fetch-documents
May 12, 2026
Merged

[DT-3253] Filter document fetches by entity-allowed categories#2901
kevinmarete merged 4 commits into
developfrom
km-dt-3253-fix-fetch-documents

Conversation

@kevinmarete
Copy link
Copy Markdown
Contributor

@kevinmarete kevinmarete commented May 11, 2026

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, updates FileStorageObjectService to 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.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@kevinmarete kevinmarete self-assigned this May 11, 2026
@kevinmarete kevinmarete marked this pull request as ready for review May 11, 2026 19:05
@kevinmarete kevinmarete requested a review from a team as a code owner May 11, 2026 19:05
@kevinmarete kevinmarete requested review from Copilot, eweitz and otchet-broad and removed request for a team and Copilot May 11, 2026 19:05
Comment thread src/main/java/org/broadinstitute/consent/http/db/FileStorageObjectDAO.java Outdated
Copy link
Copy Markdown
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, see comment around BindList. 👍🏽

…jectDAO.java

Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com>
@kevinmarete kevinmarete requested review from Copilot and removed request for Copilot May 11, 2026 20:31
@kevinmarete kevinmarete removed the request for review from eweitz May 11, 2026 20:32
Copilot AI review requested due to automatic review settings May 11, 2026 20:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FileStorageObjectService list/get/download/update/delete flows to use category-scoped DAO lookups based on DocumentEntity.
  • 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.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@otchet-broad otchet-broad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Thank you!

@kevinmarete kevinmarete merged commit dcca7a3 into develop May 12, 2026
15 checks passed
@kevinmarete kevinmarete deleted the km-dt-3253-fix-fetch-documents branch May 12, 2026 14:44
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.

4 participants