Skip to content

fix: check dataset read permission in publisheddata formpopulate - #2887

Merged
omkar-ethz merged 6 commits into
SciCatProject:masterfrom
knQzx:formpopulate-read-check
Aug 18, 2026
Merged

omkar-ethz merged 6 commits into
SciCatProject:masterfrom
knQzx:formpopulate-read-check

Conversation

@knQzx

@knQzx knQzx commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

The publisheddata formpopulate endpoint looked up the dataset without a read check, leaking dataset and proposal information for datasets the user cannot read. This checks the dataset read permission first.

Summary by Sourcery

Protect published-data form population by checking dataset read access before retrieving related information.

Bug Fixes:

  • Enforce dataset read permissions before populating published-data forms to prevent unauthorized dataset and proposal information disclosure.

Tests:

  • Update published-data controller test dependencies and the v4 formpopulate integration request to reflect permission-checked access.

@knQzx
knQzx requested a review from a team as a code owner August 12, 2026 16:23

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new use of checkPermissionsForDatasetExtended changes the behavior for unauthorized access; consider explicitly handling and standardizing the error/response (e.g., 403 vs empty form data) so clients get a clear, consistent signal.
  • The dataset lookup and form population logic in both v4 and non-v4 controllers are nearly identical; consider extracting a shared helper to avoid duplication and keep permission checks consistent across versions.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new use of `checkPermissionsForDatasetExtended` changes the behavior for unauthorized access; consider explicitly handling and standardizing the error/response (e.g., 403 vs empty form data) so clients get a clear, consistent signal.
- The dataset lookup and form population logic in both v4 and non-v4 controllers are nearly identical; consider extracting a shared helper to avoid duplication and keep permission checks consistent across versions.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@omkar-ethz
omkar-ethz merged commit 4016262 into SciCatProject:master Aug 18, 2026
16 checks passed
minottic pushed a commit that referenced this pull request Aug 19, 2026
* fix: check dataset read permission in publisheddata formpopulate

* fix: add missing imports, fix formatting and test

* fix: export DatasetsController from DatasetsModule

* fix: e2e test

---------

Co-authored-by: Omkar Zade <[email protected]>
where: { pid: pid[0] },
})) as unknown as DatasetClass;
const dataset =
(await this.datasetsController.checkPermissionsForDatasetExtended(

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.

To be refactored: #2901

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.

3 participants