Repository navigation
docs(worker): state the job-variable trust model and the absence of limits - #434
Merged
Merged
Conversation
…imits The policy asks each SDK to decide and document two things about job variables. Neither was stated anywhere a handler author would look. The README documents the trust model of the process execution strategy, but that is a different question, and nothing said that variables and custom headers are untrusted input or what the SDK does and does not do about them. Documents the current position rather than changing it: deserialisation is JSON-only and never instantiates a class from the payload, each job gets its own context, and there is no size limit, no depth limit and no content validation. Says what to use instead -- fetch_variables to bound what a worker receives, your own bound on recursion, search_variables_as_dto to validate. No limit is invented here: choosing one would be a design decision with a behaviour change behind it, and it is not this issue's to make. A new README subsection for end users, mirrored in the JobContext attribute docs so it reaches IDE hovers. Closes #426 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The documentation misstates input validation and trust boundaries by presenting an unvalidated variable search as validation of job inputs and attributing model-defined custom headers to instance callers or message payloads.
2 open issues
What changed in this PR
Documents the job-variable trust model for SDK handler authors, addressing #426 without changing runtime behavior. This complements the separate process-pool trust documentation in #420.
Changes:
- Adds README guidance on untrusted inputs, JSON deserialization, per-job isolation, and the absence of SDK-enforced size, depth, and schema checks.
- Mirrors the guidance in
JobContextattribute documentation for IDE hovers and refreshes the generated copy.
| File | Description |
|---|---|
runtime/job_worker.py |
Adds trust and validation guidance to JobContext attribute docs. |
README.md |
Adds the “Job Variables Are Untrusted Input” section. |
generated/camunda_orchestration_sdk/runtime/job_worker.py |
Mirrors the source docstring in the generated SDK. |
Review effort: Balanced
From Copilot's review, two factual corrections to the new section. Custom headers are defined in the BPMN model at modelling time, not supplied by whoever starts an instance, so lumping them in with variables misstated the trust boundary. They are now given their own origin, and the trust that follows from it: as far as control over who may deploy a process definition goes. search_variables_as_dto does not validate the variables a job handed you. It runs a separate search, derives its query from a model's fields, and returns a VariableMap whose values stay unvalidated until .validate() is called. The handler's own input is validated with MyModel.model_validate( job.variables.to_dict()), which is what the docs now say. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
This was referenced Nov 13, 2026
Decision record: job-variable payload size and depth is not limited by the SDKs
camunda/sdk-infra#98
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Requested by Joshua Wulf · Slack thread
Before: The policy asks each SDK to decide and document two things about job variables — whether it enforces size and depth limits, and the trust model for handler authors. Neither was stated anywhere a handler author would look. The README documents the trust model of the
processexecution strategy, and does it well, but that is a different question. Nothing said thatjob.variablesandjob.custom_headersare untrusted input, or what the SDK does and does not do about them.After: Both are written down, for end users in the README and in the
JobContextattribute docs so they reach IDE hovers.A handler author can now see, where they are already looking, that variable content comes from whoever started the process instance and what the SDK does not check.
How: This documents the current position rather than changing it. What the SDK does: deserialisation is JSON-only, into plain containers, never instantiating a class from the payload; each job gets its own context, so variables are not shared or mutated across concurrent jobs. What it does not do: no size limit, no depth limit beyond CPython's own recursion limit during parsing, and no validation of content against a schema. Each "does not" is paired with what to use instead —
WorkerConfig.fetch_variablesto bound what a worker receives, the handler's own bound on recursion,search_variables_as_dtoto validate.No limit is invented. The issue asks for a documented decision, and the decision recorded here is the one the code already makes. Picking a maximum payload size or nesting depth would be a behaviour change that could break a working deployment, and it needs a product decision and a cross-SDK number, not a guess in a docs PR. If you want limits enforced, that is a separate issue and I am happy to open it.
No code behaviour changes: a docstring and a README section.
Deliberately kept clear of PR #420. That PR documents the
processstrategy's pickle boundary and inserts into the README's execution-strategies section (around line 583) and into theJobContextclass docstring's opening prose. This one adds a new### Job Variables Are Untrusted Inputsection about 110 lines earlier, before "Using the Client in a Job Handler", and addsvariables/custom_headersentries to the docstring's existingAttributes:block. I ran a trial merge of this branch with #420's branch: it auto-merges cleanly, inREADME.md,runtime/job_worker.pyand the regenerated copy. The two can land in either order, and the README section here links to the execution-strategies section rather than restating it.Verification on Python 3.13 (
make generate-only, then the Makefile validation steps):ruff check .,ty check,ty check examples/, the README snippet check and the config-reference generator are clean;pytest tests/acceptanceis 842 passed, 1 skipped — unchanged, as expected for a docs change. The README section contains no fenced code block, so it does not interact with the snippet-injection rule.Commits follow the repo's split rule: the
runtime/and README change, then the regenerated copy, then the same pair again for Copilot's two factual corrections — custom headers come from the BPMN model rather than from whoever starts an instance, andsearch_variables_as_dtosearches rather than validating what a job handed you, so the docs now point atMyModel.model_validate(job.variables.to_dict()).Closes #426
🤖 Generated with Claude Code
https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda