Skip to content

/jobs/{jobId}/{filename} serves job output without an authority or ownership check #2980

Backlog

Description

@johngrimes

FileController maps GET /jobs/{jobId}/{filename} and returns the named file from the job's output directory (server/src/main/java/au/csiro/pathling/FileController.java:62-77). The route is outside the FHIR servlet, so the only control on it is anyRequest().authenticated() (server/src/main/java/au/csiro/pathling/config/SecurityConfiguration.java:113-114). The $result operation reads the same files but requires pathling:export or pathling:bulk-submit, a registry entry for the job, and a match between the job's owner and the caller (server/src/main/java/au/csiro/pathling/operations/bulkexport/ExportResultProvider.java:88-112). No manifest produced by the server refers to a /jobs/ URL.

Reproduced on a build of release/server/3.2.0 (f70763af29) with authorisation enabled. A user with the subject alice ran a $sql-export job. A second token had the subject bob and no authorities at all:

Request with bob's token Result
GET /fhir/$result?job=<alice's job>&file=patients.00000.csv 403, "Missing authority for any of: export, bulk-submit"
GET /jobs/<alice's job>/patients.00000.csv 200, with the content of the file

The caller needs the job identifier and the file name. Job identifiers are random UUIDs, except for bulk submit, where the directory is named after the client-chosen submissionId. File names from $sql-export follow the pattern <name>.00000.<ext>. The route does not consult the job registries, so it continues to work after a restart, when $result returns 404.

This route was also the read path in GHSA-5h9r-m7r5-8jxq.

Suggested change: remove FileController. If the route has to stay, give it the same registry lookup, authority check and owner check as $result.

Acceptance: the second request in the table no longer returns the file, covered by an integration test.

Activity

  1. added
    security
    server
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securityserver

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions