docker: host paths resolve absolute symlinks in the container's namespace, not the host's #71
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From the #66 approval review.
hostPath(p)prefixes the host root (for example/host/opt/stack/compose.yaml), but symlinks under it are followed by the kernel inside OpsDeck's own mount namespace. If the compose file is an absolute symlink to/srv/stacks/compose.yaml, the target is looked up in the container rather than under/host. Two outcomes:pin_apply.tsreplaceFile).Deno.realPathusually fails with NotFound. The code then falls back to the link path, and the rename replaces the operator's symlink with a regular file. The real file at/srv/stacks/compose.yamlgoes stale.replaceFileis supposed to prevent exactly this.This affects more than the write path. Every
Deno.readTextFile(hostPath(p))inmod.tsandactions.tshas the same problem. It is not a regression from #66.pin_apply_test.ts:458uses an absolute symlink with no host-root prefix, so it cannot catch it.Fix. Write a resolver that follows links one hop at a time with
Deno.readLink. It should re-root absolute targets under the host root and re-check for escape after every hop. Then use it for both reads and writes.makeHostPathis currently sync and has many call sites, so the resolver needs either an async variant or a separateresolveHostPathused at the fs boundary.Test. Add a host-root fixture containing an absolute symlink whose target exists only under that fixture root.