Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(scripts): avoid subshell pipe in TLS dependency check

Steven Enamakelece9d1c0c52c
diff --git a/scripts/__tests__/check-linux-tls-dependencies.test.mjs b/scripts/__tests__/check-linux-tls-dependencies.test.mjs
index cfed4b3a4e..022579b0c0 100644
--- a/scripts/__tests__/check-linux-tls-dependencies.test.mjs
+++ b/scripts/__tests__/check-linux-tls-dependencies.test.mjs
@@ -34,6 +34,16 @@ const CLEAN_TREE = [
"tokio v1.40.0",
].join("\n");
+// Cargo 1.90 `cargo tree --prefix none --invert sentry` emits unindented
+// package lines, for example `sentry v0.47.0` followed by
+// `openhuman v0.64.4 (/checkout/crates/openhuman-core)`. The path below is
+// normalized; the line shape and column-zero owner are taken from Cargo.
+const SENTRY_OWNER_TREE = [
+ "native-tls v0.2.14",
+ "sentry v0.47.0",
+ "openhuman v0.64.4 (/checkout/crates/openhuman-core)",
+].join("\n");
+
/**
* A temporary tree holding the cargo stub and the fixtures it answers from.
*
@@ -208,7 +218,19 @@ for (const interpreter of interpreters) {
test(`[${interpreter} ${version}] a Sentry-owned TLS package fails the policy`, SKIP, () => {
const tree = makeTree({
tauri: "native-tls v0.2.14",
- owners: { "native-tls": "native-tls v0.2.14\nsentry v0.36.0" },
+ owners: { "native-tls": SENTRY_OWNER_TREE },
+ });
+ assert.match(SENTRY_OWNER_TREE, /^sentry v0\.47\.0$/m);
+ const result = run(interpreter, tree);
+ assert.equal(result.status, 1);
+ assert.match(result.stderr, /Sentry owns native-tls in tauri/);
+ assert.match(tree.calls(), /--invert native-tls/);
+ });
+
+ test(`[${interpreter} ${version}] an early TLS match in a large tree still checks owners`, SKIP, () => {
+ const tree = makeTree({
+ tauri: `native-tls v0.2.14\n${"other-package v1.0.0\n".repeat(20000)}`,
+ owners: { "native-tls": SENTRY_OWNER_TREE },
});
const result = run(interpreter, tree);
assert.equal(result.status, 1);
diff --git a/scripts/check-linux-tls-dependencies.sh b/scripts/check-linux-tls-dependencies.sh
index 6b37189c45..63c1b5820f 100755
--- a/scripts/check-linux-tls-dependencies.sh
+++ b/scripts/check-linux-tls-dependencies.sh
@@ -52,7 +52,7 @@ check_world() {
printf 'error: could not check reqwest %s owners in %s\n' "$version" "$label" >&2
exit 2
fi
- if printf '%s\n' "$owners" | grep -Eq '^sentry v'; then
+ if grep -Eq '^sentry v' <<< "$owners"; then
printf 'error: Sentry owns reqwest %s in %s\n%s\n' \
"$version" "$label" "$owners" >&2
exit 1
@@ -62,7 +62,7 @@ check_world() {
for package in native-tls openssl openssl-sys; do
# Cargo returns an error for --invert when the package is absent.
- if ! printf '%s\n' "$tree" | grep -Eq "^${package} v"; then
+ if ! grep -Eq "^${package} v" <<< "$tree"; then
continue
fi
if ! owners="$(
@@ -72,13 +72,13 @@ check_world() {
printf 'error: could not check %s owners in %s\n' "$package" "$label" >&2
exit 2
fi
- if printf '%s\n' "$owners" | grep -Eq '^sentry v'; then
+ if grep -Eq '^sentry v' <<< "$owners"; then
printf 'error: Sentry owns %s in %s\n%s\n' \
"$package" "$label" "$owners" >&2
exit 1
fi
if [[ "$label" == tauri ]] &&
- printf '%s\n' "$owners" | grep -Eq '^motosan-ai-oauth v'; then
+ grep -Eq '^motosan-ai-oauth v' <<< "$owners"; then
printf 'error: motosan-ai-oauth owns %s in %s\n%s\n' \
"$package" "$label" "$owners" >&2
exit 1