Skip to content

fix(core): stop following a symlinked manifest signing key - #364

Open
DeryFerd wants to merge 1 commit into
qybaihe:mainfrom
DeryFerd:fix/manifest-key-symlink-read
Open

DeryFerd wants to merge 1 commit into
qybaihe:mainfrom
DeryFerd:fix/manifest-key-symlink-read

Conversation

@DeryFerd

@DeryFerd DeryFerd commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

readManifestSigningKeyOrThrow read the private key with readFileSync(resolved, "utf8"), which follows a symbolic link at the key path. Manifest verification already refuses a final-component symlink (hashArtifactBytesSync in manifest-verify.ts), and the project config reader opens with O_NOFOLLOW; the signing-key read was the one security-relevant read in core that still followed a link.

What changed

  • readManifestSigningKeyOrThrow in src/core/manifest-signing.ts now lstats the resolved path first and refuses a symlink or a non-regular file with a message that says symlinks are not followed, matching the rule the verifier applies to artifacts.
  • tests/manifest-signing.test.ts gains a symlinked-key case that asserts the refusal. It is skipped on Windows, where the other symlink tests in the suite also skip.

Why this matters

A signing key is a security-relevant read, and a key path that quietly aliases another file is exactly what the final-component-symlink rule exists to catch. Bringing the signing-key read under the same rule keeps every key and artifact read in core on one policy.

Tests

  • npx vitest run tests/manifest-signing.test.ts tests/verify-manifest-command.test.ts tests/verify-manifest-pinned-key.test.ts tests/one-click-defend.test.ts passes, 24 tests with 1 skipped.

Compatibility

A regular key file reads exactly as before. A symlinked key path that used to be followed now throws a named error instead of reading the link target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant