Skip to content

Job endpoint instantiates any registered class with client supplied paths #1066

Backlog

Description

@Irozuku

Summary

POST /api/v1/job/ instantiates any registered class named by the client, with keyword arguments taken as is from the request. Dataset and document jobs accept filesystem paths from those arguments, which allows reading any local file into a dataset and deleting any directory.

Where

Found at 44d4e5a, still present on develop (f5b2c3e).

  • jobs.py#L177-L291: kwargs is parsed from the request and component_registry[job_type]["class"](**kwargs) is called. The lookup goes through every registry container (dependencies/registry/component_registry.py), so job_type is not limited to jobs; other classes fail afterwards, but their __init__ has already run.
  • DatasetJob uses kwargs["file_path"] as the dataloader source (dataset_job.py#L164, L310-L313), so any readable file can be loaded into a dataset and then downloaded through the dataset API.
  • DatasetJob and DocumentJob take kwargs["temp_dir"] and remove it with shutil.rmtree when the job ends or is cancelled (dataset_job.py#L427-L443, document_job.py#L100-L108, L274-L277). Without a multipart upload nothing overrides the client value, so any directory the user can write can be deleted.

#1063 fixes the upload file name in the same endpoint; it does not change the points above.

Impact

Arbitrary file read and recursive directory deletion, with no authentication. A cross site form post needs no CORS preflight, so a web page the user visits can create such a job blind, even with the CORS allowlist from #1063.

Suggested fix

  • Accept only an explicit allowlist of Job subclasses for job_type and reject anything else before instantiation.
  • Validate kwargs against each job's schema.
  • Never take filesystem paths (file_path, temp_dir and similar) from the client; derive them on the server from the upload or the stored dataset.

Activity

  1. added
    bug
    back
    priority: high
    on Dec 2, 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

    backbugpriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions