Repository navigation
Reject malformed Arrow Flight Basic credentials - #115347
Conversation
|
Workflow [PR], commit [a83953a] Summary: ✅
AI ReviewSummaryThis PR makes Arrow Flight Basic authentication fail closed when the decoded credentials omit the required Missing context / blind spots
Final Verdict✅ No material issues found in the current diff. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 4/4 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units8 translation units recompiled, 12 s compile time in total, 8 of them have a recent master baseline. |
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115347&sha=8f516dc1cbcbb245067015d849f29908c312cebc&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29. It reproduces the huge |
|
Not superseded: #108650 is still the only fix for this signature, and it is still open. The row is STID 1367-1ab3, the write path. The fuzzer-injected #108650 reads the validation column in bounded batches instead of resizing to the untrusted per-mark granularity. It has had no review since 2026-06-26, and its base is 25045 commits behind master, so its two red checks ( |
|
Base refreshed: #108650 is now 75 commits behind master instead of 25045, and CI is running on the fresh head The fix still applies: master's three unbounded
While re-validating I found the regression test could go green with the fix reverted. The validator only runs on a plain |
…ect-colonless-basic
ReproducerShell reproducer — set #!/bin/bash
BIN="${BIN:-./clickhouse}" # path to the ClickHouse binary under test
# Arrow Flight: Basic credentials WITHOUT the ':' separator must be rejected.
# Pre-fix they were parsed as {username=<whole string>, password=""}, so
# "Basic base64('default')" authenticated as the passwordless `default` user.
set -uo pipefail
WORK=$(mktemp -d /tmp/afrepro.XXXXXXXX)
SRV_PID=""
cleanup() { [ -n "$SRV_PID" ] && kill -9 "$SRV_PID" 2>/dev/null; rm -rf "$WORK"; }
trap cleanup EXIT
python3 -c 'import pyarrow.flight' 2>/dev/null || { echo "INCONCLUSIVE: pyarrow.flight not importable"; exit 2; }
read -r TCP_PORT AF_PORT <<<"$(python3 - <<'PY'
import socket
def free():
s = socket.socket(); s.bind(("127.0.0.1", 0)); p = s.getsockname()[1]; s.close(); return p
print(free(), free())
PY
)"
cat > "$WORK/users.xml" <<XML
<clickhouse>
<profiles><default></default></profiles>
<quotas><default></default></quotas>
<users>
<default>
<password></password>
<profile>default</profile>
<quota>default</quota>
<networks><ip>::/0</ip></networks>
</default>
</users>
</clickhouse>
XML
cat > "$WORK/config.xml" <<XML
<clickhouse>
<logger><level>trace</level><console>0</console><log>$WORK/ch.log</log><errorlog>$WORK/err.log</errorlog></logger>
<listen_host>127.0.0.1</listen_host>
<tcp_port>$TCP_PORT</tcp_port>
<arrowflight_port>$AF_PORT</arrowflight_port>
<path>$WORK/data/</path>
<tmp_path>$WORK/tmp/</tmp_path>
<user_files_path>$WORK/user_files/</user_files_path>
<format_schema_path>$WORK/schemas/</format_schema_path>
<user_directories><users_xml><path>$WORK/users.xml</path></users_xml></user_directories>
<mark_cache_size>268435456</mark_cache_size>
</clickhouse>
XML
"$BIN" server --config-file="$WORK/config.xml" >"$WORK/stdout.log" 2>&1 &
SRV_PID=$!
for _ in $(seq 1 60); do
python3 -c "
import socket,sys
s=socket.socket(); s.settimeout(1)
sys.exit(0 if s.connect_ex(('127.0.0.1',$AF_PORT))==0 else 1)" && break
kill -0 "$SRV_PID" 2>/dev/null || break
sleep 1
done
python3 -c "
import socket,sys
s=socket.socket(); s.settimeout(1)
sys.exit(0 if s.connect_ex(('127.0.0.1',$AF_PORT))==0 else 1)" || {
echo "INCONCLUSIVE: Arrow Flight port never opened (feature absent / not built)"
grep -iE "arrowflight|arrow flight" "$WORK/ch.log" "$WORK/stdout.log" 2>/dev/null | tail -3
exit 2
}
timeout 60 python3 - "$AF_PORT" <<'PY'
import base64, sys
import pyarrow.flight as flight
port = sys.argv[1]
client = flight.FlightClient(f"grpc://127.0.0.1:{port}")
def get(cred):
opts = flight.FlightCallOptions(headers=[(b"authorization", f"Basic {cred}".encode())])
return client.do_get(flight.Ticket(b"SELECT 1"), opts).read_all()
# Sanity: well-formed credentials must work, otherwise the verdict is meaningless.
try:
get(base64.b64encode(b"default:").decode())
except Exception as e:
print("INCONCLUSIVE: well-formed Basic auth failed:", type(e).__name__, str(e)[:200])
sys.exit(30)
# The bug: same base64, no ':' separator.
try:
t = get(base64.b64encode(b"default").decode())
print("BUG: 'Basic base64(\"default\")' (no separator) authenticated, SELECT 1 returned", t.num_rows, "row(s)")
sys.exit(10)
except (flight.FlightUnavailableError, flight.FlightTimedOutError) as e:
print("INCONCLUSIVE: transport failure -", type(e).__name__, str(e)[:200])
sys.exit(30)
except Exception as e:
# Any rejection counts as clean: 25.8/26.3 reject with an IOError status,
# the fix rejects with Unauthenticated. Only authenticating is the bug.
print("CLEAN: rejected -", type(e).__name__, str(e).splitlines()[0][:200])
sys.exit(20)
PY
RC=$?
case "$RC" in
10) exit 1 ;;
20) exit 0 ;;
124) echo "TIMEOUT"; exit 2 ;;
*) exit 2 ;;
esacResults:
Backport the fix to CC component owner: @yakov-olkhovskiy @vitlibar Analysis metadata
Introducing change: not identified
|
Reject decoded Arrow Flight Basic credentials that omit the required
:separator, preventing them from falling through as thedefaultuser with an empty password. Adds an integration regression test.Related: #115085
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Arrow Flight server: reject malformed Basic authentication credentials that omit the username/password separator.
Workflow [PR]
Sync PR [sync-upstream/pr/115347]
Version info
26.8.1.1871(included in26.8and later)