Skip to content

fix(file-service): return 404 for another dataset's version and 400 for a missing upload type - #9099

Merged
aicam merged 3 commits into
apache:mainfrom
tanishqgandhi1908:fix/dataset-endpoint-input-checks
Oct 26, 2026
Merged

aicam merged 3 commits into
apache:mainfrom
tanishqgandhi1908:fix/dataset-endpoint-input-checks

Conversation

@tanishqgandhi1908

@tanishqgandhi1908 tanishqgandhi1908 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Two dataset endpoints skipped input checks the model endpoints already make, so bad input produced a 500:

  1. A version from another dataset. The version file-list endpoints (owner and public) and versionZip checked access on did but loaded version dvid without checking it belongs to did. getDatasetVersionByID now filters on did as well, like getModelVersionByID, so a version from another dataset returns 404.
  2. No type on multipart upload. POST /dataset/multipart-upload called toLowerCase on a missing type. The model endpoint's check is now a shared ResourceUploadService.multipartOperationOrThrow, used by both, which returns 400 for a missing or unknown type.
                                                                    before   after
GET  /dataset/215/publicVersion/16/rootFileNodes   (16 belongs to 216)   500      404
GET  /dataset/215/publicVersion/15/rootFileNodes   (its own version)     200      200
POST /dataset/multipart-upload  (no type)                                500      400

Any related issues, documentation, discussions?

Closes #9098

How was this PR tested?

Added three cases to DatasetResourceSpec: another dataset's version returns 404 from the public and owner file-list endpoints and from versionZip, and a missing type returns 400. All fail without the fix.

sbt "FileService/testOnly *DatasetResourceSpec *ModelResourceSpec *ModelUploadResourceSpec"
# Tests: succeeded 197, failed 0

Also checked against a local stack with curl (table above).

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @kunwp1
    You can notify them by mentioning @kunwp1 in a comment.

@github-actions github-actions Bot added fix platform Non-amber Scala service paths labels Oct 23, 2026
@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Oct 23, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 October 23, 2026 00:56
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
🚫 release/v1.3 Label was removed earlier (opt-out); not re-added. Re-add it by hand if this fix should be backported here after all — the branch's release manager then has to approve before this PR can merge.
🚫 release/v1.2 Label was removed earlier (opt-out); not re-added. Re-add it by hand if this fix should be backported here after all — the branch's release manager then has to approve before this PR can merge.

Auto-label run.

@codecov-commenter

codecov-commenter commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.34%. Comparing base (8fbd4f2) to head (758a202).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9099      +/-   ##
============================================
+ Coverage     91.81%   92.34%   +0.53%     
+ Complexity     5069     5018      -51     
============================================
  Files          1271     1267       -4     
  Lines         55208    54433     -775     
  Branches       6987     6879     -108     
============================================
- Hits          50688    50265     -423     
+ Misses         2800     2490     -310     
+ Partials       1720     1678      -42     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.14% <ø> (-0.02%) ⬇️ Carriedforward from 8687c2a
amber 87.33% <ø> (+1.36%) ⬆️ Carriedforward from 8687c2a
computing-unit-managing-service 61.84% <ø> (ø)
config-service 87.50% <ø> (ø)
file-service 82.01% <ø> (+0.08%) ⬆️ Carriedforward from 8687c2a
frontend 96.49% <ø> (-0.01%) ⬇️ Carriedforward from 8687c2a
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.57% <ø> (+0.03%) ⬆️ Carriedforward from 8687c2a
workflow-compiling-service 72.43% <ø> (-0.18%) ⬇️ Carriedforward from 8687c2a

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chenlica
chenlica requested review from aicam and removed request for xuang7 October 26, 2026 06:03
@mengw15 mengw15 removed release/v1.2 back porting to release/v1.2 release/v1.3 back porting to release/v1.3 labels Oct 26, 2026
@aicam
aicam enabled auto-merge October 26, 2026 20:19
@mengw15 mengw15 closed this Oct 26, 2026
auto-merge was automatically disabled October 26, 2026 20:36

Pull request was closed

@mengw15 mengw15 reopened this Oct 26, 2026
@aicam
aicam added this pull request to the merge queue Oct 26, 2026
Merged via the queue into apache:main with commit dce6cf1 Oct 26, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dataset endpoints return 500 for a version from another dataset or a missing upload type

5 participants