Skip to content

Commit 72c5bdb

Browse files
committed
fix(security-strings): allowlist 'telnet' from rst grammar URI schemes
The rst tree-sitter grammar (added in the 89-grammar bump) contains a valid_schemas[] array listing URI schemes (http, https, ftp, mailto, telnet, ssh) in vendored/grammars/rst/tree_sitter_rst/chars.c. The 'telnet' string ends up in the binary's string table and tripped the dangerous-command detector, blocking smoke on every platform. Add an allowlist mechanism for known-benign matches with a comment pointing at the source file, so future false positives can be documented the same way.
1 parent ec23b4f commit 72c5bdb

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

scripts/security-strings.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,19 @@ echo ""
117117
echo "--- Dangerous command detection ---"
118118

119119
DANGEROUS_CMDS='wget|netcat|ncat|/dev/tcp|telnet'
120+
# Known-benign matches (vendored grammar URI scheme tables, etc.). Each entry
121+
# is a regex matched against the full line; matches are stripped before
122+
# evaluation. Document the source so reviewers can verify the false positive.
123+
ALLOWED_DANGEROUS=(
124+
'^telnet$' # rst tree-sitter grammar: valid_schemas[] in vendored/grammars/rst/tree_sitter_rst/chars.c
125+
)
120126
if grep -wE "$DANGEROUS_CMDS" "$STRINGS_FILE" > "$SEC_CMDS" 2>/dev/null && [ -s "$SEC_CMDS" ]; then
127+
for allow in "${ALLOWED_DANGEROUS[@]}"; do
128+
grep -vE "$allow" "$SEC_CMDS" > "${SEC_CMDS}.tmp" || true
129+
mv "${SEC_CMDS}.tmp" "$SEC_CMDS"
130+
done
131+
fi
132+
if [ -s "$SEC_CMDS" ]; then
121133
echo "BLOCKED: Dangerous commands found in binary:"
122134
cat "$SEC_CMDS"
123135
FAIL=1

0 commit comments

Comments
 (0)