4 Commits
Author SHA1 Message Date
David Gageot b285b0abf1 refactor: migrate UUID generation and parsing to Go 1.27 stdlib
Use crypto/rand-backed stdlib uuid.NewV4().String() for random UUIDs and stdlib parsing instead of github.com/google/uuid, wherever the stdlib can express the behavior.

github.com/google/uuid is kept only in pkg/model/provider/base/opencode.go for uuid.NewSHA1, since the stdlib has no UUIDv5 support; the namespace and resulting IDs are unchanged.

pkg/userid/userid.go keeps a compatibility helper that preserves every legacy persisted-ID form the Google parser accepted, without rewriting or rotating existing IDs. pkg/evaluation/eval.go keeps reading the first 4 UUID bytes as big-endian to preserve existing decimal evaluation names.

Added tests covering v4 bit layout, legacy persisted-ID forms, the evaluation name format, and the OpenCode UUIDv5 fallback.

Signed-off-by: David Gageot <david.gageot@docker.com>
2026-09-23 15:44:22 +02:00
David Gageot d1e48b331b refactor(userid): introduce Resolver type for parallel-safe tests
Replace package-level mutable state with a Resolver struct that owns
its directory and cache. Tests create isolated instances via New(t.TempDir())
and can now run with t.Parallel() without sharing global state.
Remove ResetForTests as it is no longer needed.

Assisted-By: Claude
2026-06-30 11:45:32 +02:00
David Gageot deec8cb680 fix(userid): tighten config dir perms to 0o700 to match file 0o600
The save helper created the config directory with 0o755, letting

any local user enumerate it and observe that the user-uuid file

exists (and its mtime via ls -la), even though they cannot read

its 0o600-protected contents.

Since the UUID is a persistent per-install identifier forwarded as

X-Cagent-Id on every gateway request, directory-level enumeration

on a shared/multi-user host is a mild privacy leak. Use 0o700 on

the directory to match the 0o600 protection on the file itself,

consistent with other sensitive paths in the codebase (sandbox

tokens, sqlite stores, log files).

Assisted-By: docker-agent
2026-05-06 11:34:42 +02:00
David Gageot 63607f600b feat(httpclient): forward cagent install UUID on gateway-bound requests 2026-05-06 09:39:31 +02:00