Harden the remote worker: TLS off loopback, full digests, filtered env

fluksio-worker now refuses ws:// and http:// engine and artifact URLs unless
they are loopback or --insecure is given; the engine still accepts both.
An artifact reference must be sha256: plus 64 hex digits before it is joined
into a path, and node code gets the host environment through the engine's
credential denylist instead of all of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GAeg4Jo6xjZzjwy9QDWMQ
This commit is contained in:
2026-10-06 12:18:30 +02:00
co-authored by Claude Opus 5.5
parent 17c2f4ff70
commit cf5329e3a8
5 changed files with 156 additions and 2 deletions
+11 -1
View File
@@ -144,7 +144,7 @@ class _Reporter(ModuleType):
def load_artifact(self, ref: dict[str, Any]) -> str:
"""Fetch an artifact and hand back a local path to read it from."""
digest = str((ref or {}).get("digest") or "")
if not digest.startswith("sha256:"):
if not _valid_digest(digest):
raise ValueError("not an artifact reference")
return _fetch(digest)
@@ -318,6 +318,16 @@ def _put_over_http(
pass
def _valid_digest(digest: str) -> bool:
"""The engine's own check: the digest becomes part of a path below."""
body = digest.removeprefix("sha256:")
return (
digest.startswith("sha256:")
and len(body) == 64
and all(c in "0123456789abcdef" for c in body)
)
def _fetch(digest: str) -> str:
"""A local path holding this artifact's bytes, downloading it if needed."""
for variable in (ARTIFACT_DIR_ENV, ARTIFACT_VOLATILE_DIR_ENV):