check-linux-tls-dependencies.sh: the Sentry ownership checks can never fire, because they grep an inverted tree's dependents at column 0
Summary
scripts/check-linux-tls-dependencies.sh runs cargo tree --invert <pkg> and then greps the output for ^sentry v to decide whether Sentry owns reqwest 0.13, native-tls, openssl or openssl-sys. In an inverted tree the dependents are never at column 0, so those four checks pass unconditionally.
Problem
Lines 44-58 and 61-76 (current main):
owners="$(
cargo tree --locked --manifest-path "$manifest" --target "$target" \
--invert "reqwest@$version" 2>/dev/null || true
)"
if printf '%s\n' "$owners" | grep -Eq '^sentry v'; then
The --invert calls do not pass --prefix none (the forward cargo tree call on line 11 does). With the default --prefix indent, cargo tree --invert X prints X on the first line and every reverse dependency below it with tree glyphs:
$ cargo tree --invert serde_json --depth 1
serde_json v1.0.151
├── axum v0.8.9
├── reqwest v0.12.28
└── ...
So the only line that can ever match ^sentry v is the root, and the root is the package being inverted ([email protected], native-tls, ...), never sentry. The same applies to the ^motosan-ai-oauth v check on line 70.
The forbidden-package checks earlier in the script (aws-lc, native-tls/openssl in core) are unaffected: they grep the forward tree, which is printed with --prefix none.
Two ways to see it:
printf 'reqwest v0.13.2\n└── sentry v0.36.0\n' | grep -Eq '^sentry v'; echo $?prints1.- Run the script with
cargostubbed to answer the invert calls withreqwest v0.13.2\n└── sentry v0.36.0: it passes.
Solution (optional)
Either pass --prefix none to the --invert calls as well, which puts every reverse dependency (direct and transitive) at column 0 and makes the existing grep correct, or keep the indented output and match '^[[:space:]│├└─]*sentry v'. The first is the smaller change and matches what "Sentry must never own that tree" reads as: any path from Sentry to the package.
Either way the fix should come with a test that stubs cargo with output in the real inverted shape, so the check's shape stays tied to cargo's.
Related
- Found while fixing #6530 (the
mapfilefailure on bash 3.2). That fix is scoped to the bash-4 dependency and leaves the grep as it is; its test fixtures follow the shape the script currently greps for, and say so.
The grep for sentry in inverted tree output never matches because dependents are indented, so Sentry ownership checks pass unconditionally.
Labelled priority: p1.
This one looks already fixed on current main — re-checked at 60a03436b4 before writing, since the report is from before the fix landed.
Both --invert calls now pass --prefix none, so the reverse dependencies sit at column 0 and the existing ^sentry v / ^motosan-ai-oauth v greps can actually match:
scripts/check-linux-tls-dependencies.sh:50— the reqwest 0.13 owner queryscripts/check-linux-tls-dependencies.sh:70— thenative-tls/openssl/openssl-sysowner query
Landed in fb1fcd1a5a ("fix: address release CI failures (#6707)", merged as #6711 on 2026-09-28), four days after this was filed.
The test this asked for is there too, in scripts/__tests__/check-linux-tls-dependencies.test.mjs, with cargo stubbed and the fixtures in the real inverted shape:
a Sentry-owned reqwest 0.13 fails the policy— expects exit 1 and asserts the call carried--prefix none --invert [email protected]a Sentry-owned TLS package fails the policy— expects exit 1 and pins the whole call log, so dropping--prefix noneagain breaks ita motosan-owned Tauri TLS package fails the policy— covers the^motosan-ai-oauth vcheck from line 70 of the original report
So the checks fire now and the flag is held in place by an assertion rather than by convention. Nothing left to do here as far as I can see — closing suggestion only, no objection if someone sees a gap I missed.
Fixed on main by fb1fcd1a5 (#6707, 2026-09-28): both --invert calls now pass --prefix none, so every reverse dependency is at column 0 and the ^sentry v / ^motosan-ai-oauth v greps match real output. The script test's owner fixtures were updated to the same shape in that change. Closing.