Skip to content

Commit 583af47

Browse files
committed
[Auditor] Use ldid_jll to avoid calling the executable inside the sandbox
1 parent d4af135 commit 583af47

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
3131
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
3232
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
3333
ghr_jll = "07c12ed4-43bc-5495-8a2a-d5838ef8d533"
34+
ldid_jll = "df1af0dd-2f85-5d2f-b099-55d224f7db60"
3435

3536
[compat]
3637
ArgParse = "1.1"
@@ -52,6 +53,7 @@ SHA = "0.7, 1"
5253
Scratch = "1.0"
5354
TOML = "1"
5455
ghr_jll = "0.13, 0.14, 0.17"
56+
ldid_jll = "2.1"
5557
julia = "1.7"
5658

5759
[extras]

src/auditor/codesigning.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
using ldid_jll: ldid
2+
13
function check_codesigned(path::AbstractString, platform::AbstractPlatform)
24
# We only perform ad-hoc codesigning on Apple platforms
35
if !Sys.isapple(platform)
46
return true
57
end
68

7-
ur = preferred_runner()(dirname(path); cwd="/workspace/", platform=platform)
8-
# TODO: can we run directly `ldid` with the JLL without entering the sandbox?
9-
return run(ur, `/usr/local/bin/ldid -d $(basename(path))`)
9+
return run(`$(ldid()) -d $(basename(path))`)
1010
end
1111

1212
function ensure_codesigned(path::AbstractString, prefix::Prefix, platform::AbstractPlatform;
@@ -16,10 +16,7 @@ function ensure_codesigned(path::AbstractString, prefix::Prefix, platform::Abstr
1616
return true
1717
end
1818

19-
rel_path = relpath(path, prefix.path)
20-
ur = preferred_runner()(prefix.path; cwd="/workspace/", platform=platform)
21-
with_logfile(prefix, "ldid_$(basename(rel_path)).log"; subdir) do io
22-
# TODO: can we run directly `ldid` with the JLL without entering the sandbox?
23-
@lock AUDITOR_SANDBOX_LOCK run(ur, `/usr/local/bin/ldid -S -d $(rel_path)`, io; verbose=verbose)
19+
with_logfile(prefix, "ldid_$(basename(path)).log"; subdir) do io
20+
run(pipeline(`$(ldid()) -S -d $(path)`; stdout=io, stderr=io))
2421
end
2522
end

0 commit comments

Comments
 (0)