Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion install
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ openssl_ed25519() {

# Before anything from the download runs. Dev builds aren't signed, but a signature one carries must hold.
if [ "$os" = darwin ] && [ "$channel" != dev ]; then
/usr/bin/codesign --verify --strict "-R=$MACOS_REQUIREMENT" "$binary" 2>/dev/null ||
# A bare binary has no stapled ticket, so codesign only finds it online, and only when asked to.
/usr/bin/codesign --verify --strict --check-notarization "-R=$MACOS_REQUIREMENT" "$binary" 2>/dev/null ||
fail "opencode-console $version isn't signed and notarized by Anomaly; nothing was installed"
elif [ "$os" = linux ]; then
if [ -f "$binary.sig" ] && openssl_ed25519; then
Expand Down
16 changes: 10 additions & 6 deletions src/update/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export * as Signature from "./signature"
// (a65a5e37): `src/updater/macos.rs`'s code-signing requirement and `src/updater/linux.rs`'s ed25519 check, with the
// message and key layout of `.github/release/sign-linux.sh`.
//
// macOS `codesign --verify --strict -R=<requirement>`: a Developer ID from Anomaly's team, identified as
// `anomaly.opencode-console`, and notarized
// macOS `codesign --verify --strict --check-notarization -R=<requirement>`: a Developer ID from Anomaly's team,
// identified as `anomaly.opencode-console`, and notarized (a bare binary's ticket is only found online)
// Linux `package/bin/opencode-console.sig`: ed25519 by Anomaly's release key over the binary's SHA-256
// Windows Authenticode: Valid, by Anomaly's Artifact Signing certificate (Hex's `windows.rs` pins the same signer)
//
Expand Down Expand Up @@ -92,10 +92,14 @@ export function verifyLinux(binary: string, channel: CliInstall.Channel, key = L
/** macOS: `codesign` against `requirement`, without running the binary. */
export function verifyMacos(binary: string, requirement = MACOS_REQUIREMENT) {
return new Promise<void>((resolve, reject) => {
const child = spawn("/usr/bin/codesign", ["--verify", "--strict", `-R=${requirement}`, binary], {
stdio: ["ignore", "ignore", "pipe"],
env: UpdateEnvironment.tool(),
})
const child = spawn(
"/usr/bin/codesign",
["--verify", "--strict", "--check-notarization", `-R=${requirement}`, binary],
{
stdio: ["ignore", "ignore", "pipe"],
env: UpdateEnvironment.tool(),
},
)
const errors: Buffer[] = []
const timer = setTimeout(() => child.kill("SIGKILL"), 60_000)
child.stderr.on("data", (chunk: Buffer) => errors.push(chunk))
Expand Down