Skip to content

v1.3.1 - Security fix: path traversal in the upload route, plus OCIO Clip Repair

Choose a tag to compare

@SlavaSexton SlavaSexton released this 23 Aug 01:29
· 31 commits to main since this release

Security fix

Affected: every release up to and including 1.3.0. Update to 1.3.1.

/ocio/upload built its destination by joining a caller-supplied subfolder onto the ComfyUI input directory, after passing it through os.path.basename. That call strips a directory component but leaves a relative segment intact, so a crafted value could resolve above the input directory. The route is unauthenticated, and ComfyUI's local server carries no CSRF protection, so it was reachable from the browser on the same machine.

The Comfy Registry classified this as an arbitrary file write during review and banned 1.3.0. The same code path is present in every earlier release, so this is not specific to 1.3.0.

What changed. 1.3.1 resolves the destination before writing and refuses anything that does not land inside the input directory, the approach ComfyUI core takes in server.py. Resolution goes through realpath, so a symlink inside input/ pointing elsewhere is refused as well, and a comparison that cannot be made at all is treated as outside. The destination directory is created only after the check passes, so a refused upload leaves nothing behind. Covered by tools/test_upload_confinement.py, which asserts both sides: traversal is refused, and an ordinary upload still succeeds.

Not changed. The read routes still take a path, because the disk browser in OCIO Read depends on it. Narrowing that is a separate change with its own trade-off rather than a side effect of this fix.

New node: OCIO Clip Repair

A compositing utility, and the first node here that is not a colour node. It takes a plate and an SDR-to-HDR reconstruction of the same frames, and composites the reconstruction into the plate's clipped highlights only, leaving everything that was never damaged as the plate had it.

A reconstruction pass regenerates the whole frame, which moves tone and texture in the large majority of the picture that never clipped. Masking it to the clipped ends keeps the plate wherever the plate still held information, and takes recovered range only where it ran out.

Shadow repair is off by default: on the material measured, the pass returned smooth gradients where the plate carried real grain, which reads worse than the damage. Thresholds are widgets because detail dies before a code reaches 1.0, and where it dies is a property of the plate.

Full description in docs/NODES_IO.md.