Skip to content

Commit 5fd0e83

Browse files
committed
ci: fix entitlements AMFI parse error (remove XML comments)
The CI signing step was failing with: Failed to parse entitlements: AMFIUnserializeXML: syntax error near line 5 The entitlements plist was syntactically valid (plutil -lint passed), but AMFI's XML parser (used by codesign internally) is much stricter than plutil and rejects XML comments at the top of the file. The big comment block at the top of bin/ado.entitlements was triggering the parse error. Fix: move the comment block out to bin/ado.entitlements.README.md and keep the .entitlements file minimal (no comments, minimal indentation). The actual entitlements stay the same: com.apple.security.cs.allow-jit com.apple.security.cs.allow-unsigned-executable-memory com.apple.security.cs.disable-library-validation Verified locally: codesign --force --options runtime --entitlements bin/ado.entitlements --sign ... succeeds with the same Authority chain as before (Developer ID Application: Jianbo WANG (87R27UKGSF)) and flags=0x10000(runtime) confirming hardened runtime is enabled.
1 parent 1d7a773 commit 5fd0e83

2 files changed

Lines changed: 51 additions & 47 deletions

File tree

bin/ado.entitlements

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!--
3-
Entitlements for the `ado` CLI binary.
4-
5-
Hardened Runtime is enabled via `codesign --options runtime` in
6-
bin/sign.sh. Hardened Runtime restricts what a signed binary is
7-
allowed to do at runtime. By default this would prevent BEAM (the
8-
Erlang VM Burrito ships) from functioning, so we need to opt back
9-
in to specific capabilities via entitlements.
10-
11-
These are the minimum entitlements a BEAM-based CLI tool needs
12-
under Hardened Runtime:
13-
14-
- com.apple.security.cs.allow-jit
15-
BEAM compiles native code at runtime (the BEAM compiler,
16-
NIFs, etc.) and uses executable memory pages. The JIT
17-
entitlement lets the kernel map pages with MAP_JIT on
18-
Apple Silicon.
19-
20-
- com.apple.security.cs.allow-unsigned-executable-memory
21-
Allows BEAM to allocate pages marked PROT_EXEC | PROT_WRITE
22-
before writing machine code into them and flipping to
23-
PROT_EXEC. Required for BEAM's loadable modules.
24-
25-
- com.apple.security.cs.disable-library-validation
26-
Allows BEAM to dlopen() libraries that are not signed with
27-
the same Developer ID team. We don't use this directly, but
28-
some NIFs and Elixir libraries dynamically load shared
29-
objects at runtime. Disabling library validation is the
30-
standard escape hatch for "I trust my own code but I
31-
dlopen() other people's libs".
32-
33-
These are all "runtime" entitlements (set by --options runtime);
34-
the sandbox/file-access entitlements are intentionally NOT
35-
requested because this is a CLI tool, not a sandboxed GUI app.
36-
37-
Reference:
38-
https://developer.apple.com/documentation/security/hardened_runtime_entitlements
39-
https://developer.apple.com/documentation/security/hardened_runtime
40-
-->
412
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
423
<plist version="1.0">
434
<dict>
44-
<key>com.apple.security.cs.allow-jit</key>
45-
<true/>
46-
47-
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
48-
<true/>
49-
50-
<key>com.apple.security.cs.disable-library-validation</key>
51-
<true/>
5+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
8+
<true/>
9+
<key>com.apple.security.cs.disable-library-validation</key>
10+
<true/>
5211
</dict>
5312
</plist>

bin/ado.entitlements.README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Entitlements for the `ado` CLI binary
2+
3+
This file (`bin/ado.entitlements`) is the entitlements plist used by
4+
`codesign` via `bin/sign.sh` and the GitHub Actions release workflow.
5+
6+
## Why these specific entitlements?
7+
8+
The `--options runtime` flag (hardened runtime) is enabled in
9+
`bin/sign.sh`. Hardened Runtime restricts what a signed binary is allowed
10+
to do at runtime. By default this would prevent BEAM (the Erlang VM
11+
Burrito ships) from functioning, so we need to opt back in to specific
12+
capabilities via entitlements.
13+
14+
These are the minimum entitlements a BEAM-based CLI tool needs under
15+
Hardened Runtime:
16+
17+
- `com.apple.security.cs.allow-jit` — BEAM compiles native code at
18+
runtime and uses executable memory pages. The JIT entitlement lets
19+
the kernel map pages with `MAP_JIT` on Apple Silicon.
20+
21+
- `com.apple.security.cs.allow-unsigned-executable-memory` — Allows
22+
BEAM to allocate pages marked `PROT_EXEC | PROT_WRITE` before
23+
writing machine code into them and flipping to `PROT_EXEC`. Required
24+
for BEAM's loadable modules.
25+
26+
- `com.apple.security.cs.disable-library-validation` — Allows BEAM to
27+
`dlopen()` libraries that are not signed with the same Developer ID
28+
team. Some NIFs and Elixir libraries dynamically load shared
29+
objects at runtime.
30+
31+
These are all "runtime" entitlements (set by `--options runtime`);
32+
sandbox / file-access entitlements are intentionally **not** requested
33+
because this is a CLI tool, not a sandboxed GUI app.
34+
35+
## Why no comments in the plist itself?
36+
37+
AMFI's `AMFIUnserializeXML` parser (which `codesign` uses) is more
38+
strict than `plutil`. It rejects XML comments at the top of the
39+
entitlements file. So we keep the `.entitlements` file minimal and
40+
put the explanation in this sidecar README.
41+
42+
## Reference
43+
44+
- <https://developer.apple.com/documentation/security/hardened_runtime_entitlements>
45+
- <https://developer.apple.com/documentation/security/hardened_runtime>

0 commit comments

Comments
 (0)