Sonar Vulnerability Disposition¶
This document records the reviewed disposition for the legacy SonarQube Cloud
vulnerability backlog tracked by issue #755. It is intentionally narrow: new
Sonar findings still fail the normal quality/security gates and this document is
not a rule exclusion, NOSONAR mechanism, or Quality Gate override.
2026-10-31 PR #1513 update: The public Sonar API reports all nine
pythonsecurity:S8707 findings for that PR as CLOSED/FIXED, with its
Quality Gate OK. The older open-finding counts below are dated historical
evidence; closing analyzer findings does not approve a same-UID agent as
an independent human or authorize Cloud remote-read deployment.
Reviewed baseline¶
The public SonarQube Cloud issues API on main@601d1831c6e5991805021147128c2c969f6fd7ce
reported 32 open/confirmed vulnerability findings before the transport hardening
change:
- 25
pythonsecurity:S8707path-construction findings; - 7
python:S5332HTTP findings.
The HTTP family includes a real security boundary: a bearer token protects authentication but does not provide confidentiality when the server is bound to a non-loopback interface over cleartext HTTP. The implementation therefore fails closed unless a non-loopback deployment has either direct TLS certificate termination or a declared protected public endpoint. Remote public endpoints must be HTTPS; loopback HTTP is allowed for local/container port publishing. The dashboard CLI is loopback-only.
S8707 disposition¶
The 25 remaining S8707 flows are not path components derived from model,
provider, artifact, or request content. They are explicit filesystem roots/files
selected by repository CLI entry points. Those commands are intentionally able
to evaluate caller-selected fixtures, policies, manifests, evidence directories,
and output files outside the repository checkout. Confining them mechanically to
REPO_ROOT or the current working directory would break supported CLI behavior
without creating a real trust boundary.
Where an untrusted child path exists inside a selected root, it is handled by a separate boundary. For example, release checksum artifact identities are validated as basenames before joining them to the selected artifact directory (the traversal fix delivered in #789). The rows below therefore accept only the specific top-level caller-selected path flow that Sonar reports; they do not accept traversal inside those roots.
| Sonar location | Flow source | Disposition | Technical evidence |
|---|---|---|---|
| scripts/check_agent_native_smoke_evidence.py (PR #1493, Sonar AaF6D2_upS4ABfZuERMJ) | historic --report caller-selected filesystem path | Remediated in source; Sonar re-analysis pending | The affected validator no longer opens paths derived from CLI values: only explicitly source-reviewed constant archive IDs map to fixed repository files. Arbitrary external evidence remains supported via size-limited stdin JSON envelopes containing base64 report/log bytes, not path components. Fixed-name metadata, digest binding, JSON duplicate-key refusal and readonly bounded archive reads remain in force. This does not reclassify the prior Sonar issue, suppress rules or claim a passing Quality Gate before server verification. |
scripts/check_live_model_release_policy.py:59 |
--github-output |
Accepted CLI contract | GitHub Actions explicitly supplies the output file path; model/provider data is never used as a path component. |
scripts/generate_gui_release_evidence.py:26 |
--cargo-lock |
Accepted CLI contract | Standalone packaging verifier intentionally reads a caller-selected Cargo lockfile. |
scripts/generate_gui_release_evidence.py:67 |
--cargo-lock |
Accepted CLI contract | Same explicit lockfile root; dependency parsing does not derive a new filesystem path from package data. |
scripts/generate_gui_release_evidence.py:188 |
--output-dir |
Accepted CLI contract | The caller intentionally selects the release-evidence output directory. |
scripts/generate_gui_release_evidence.py:218 |
--evidence |
Accepted CLI contract | Verification intentionally accepts a caller-selected evidence file. Evidence-declared artifact names are separately inventory-constrained before hashing. |
scripts/generate_release_evidence.py:44 |
--pyproject |
Accepted CLI contract | The CLI supports verification of an explicitly selected Python project file. |
scripts/generate_release_evidence.py:133 |
--checksums |
Accepted CLI contract | The checksum manifest itself is caller-selected; entries inside it are independently basename-validated before artifact access. |
scripts/generate_release_evidence.py:166 |
--output |
Accepted CLI contract | The output evidence path is explicitly selected by the caller. |
scripts/kicad11_headless_canary.py:221 |
--artifacts |
Accepted CLI contract | Canary artifacts are intentionally written below the caller-selected artifacts root. |
scripts/kicad_canary.py:748 |
analyzer flow from run CLI parse |
Analyzer limitation | The sink is _resolve_cli() over fixed environment/PATH candidates and does not receive the parsed --artifacts/--kicad-range values reported as the source. Candidates are required to exist and be files before resolution. |
scripts/kicad_canary.py:912 |
--artifacts |
Accepted CLI contract | The run command intentionally owns a caller-selected artifact directory. |
scripts/validate_mcp_manifest.py:317 |
positional manifest / registry publisher manifest | Accepted CLI contract | Validating an arbitrary supplied manifest is the command's documented purpose; registry publication separately validates repository metadata and package contracts. |
src/kicad_mcp/evals/baseline_promotion.py:65 |
--aggregate-report |
Accepted CLI contract | Baseline generation intentionally consumes a caller-selected aggregate evidence file. |
src/kicad_mcp/evals/baseline_promotion.py:71 |
--baseline-template |
Accepted CLI contract | Promotion can operate on an explicitly selected baseline template; no model value becomes a path component. |
src/kicad_mcp/evals/baseline_promotion.py:164 |
--aggregate-report |
Accepted CLI contract | Same caller-selected aggregate evidence boundary during promotion validation. |
src/kicad_mcp/evals/baseline_promotion.py:179 |
--output |
Accepted CLI contract | The protected workflow deliberately selects the candidate-baseline output path. |
src/kicad_mcp/evals/live_runner.py:422 |
--output |
Accepted CLI contract | Evaluation output location is a caller-selected evidence destination; model output is serialized as content, not a path. |
src/kicad_mcp/evals/nvidia_nim_adapter.py:299 |
--tools-reference |
Accepted CLI contract | Adapter/eval CLIs intentionally support an explicit tools-reference fixture; model/provider content does not select the file. |
src/kicad_mcp/evals/release_gate.py:31 |
--baseline |
Accepted CLI contract | Release evaluation accepts an explicitly selected reviewed baseline file. |
src/kicad_mcp/evals/release_gate.py:393 |
--output |
Accepted CLI contract | The gate writes its report to the caller-selected protected evidence path. |
src/kicad_mcp/evals/release_policy.py:116 |
--policy |
Accepted CLI contract | Policy classification deliberately supports an explicitly supplied policy file for local/protected evaluation. |
src/kicad_mcp/evals/release_policy.py:146 |
--baseline |
Accepted CLI contract | The approved baseline file is a caller/workflow-selected input, not a path derived from untrusted evidence. |
src/kicad_mcp/evals/smoke_assurance.py |
--output |
Remediated | The CLI value is restricted to the single reviewed artifacts/live-model-smoke-assurance/report.json destination, and the filesystem sink is constructed only from repository constants rather than the caller-controlled path. |
src/kicad_mcp/evals/tool_selection.py:255 |
--cases |
Accepted CLI contract | Eval runners intentionally load a caller-selected benchmark case file. |
src/kicad_mcp/evals/tool_selection.py:616 |
--thresholds |
Accepted CLI contract | Eval/release runners intentionally load a caller-selected threshold contract. |
KiCad Cloud local connector: PR #1513 S8707 source/sink review (2026-10-28)¶
Status: technical review, not a Sonar disposition or Quality Gate waiver. The four new alerts below remain open in Sonar until the exact PR-head analysis or a separate security review resolves them. Neither this document nor PR #1513 changes the rules, scanner scope, required checks, or issue states.
The reported taint sources are argparse command-line options to the
locally invoked cloud_pair --begin-pairing and
cloud_once --allow-once entry points. Sonar describes these sources as
HTTP-request content, but these commands do not accept an inbound HTTP
request, register a remotely callable MCP tool, or take a filesystem path
from a Cloud WebSocket/JSON frame. The human operator deliberately selects
the owner key file and local project directory. That selection is not
a sandbox guarantee against an operator who can already run local processes.
The paths nevertheless undergo independent on-disk enforcement: for key
files, require a POSIX absolute path with a validated leaf basename and no
lexical parent component; open the owner-owned, private-mode parent through
a component-by-component O_DIRECTORY|O_NOFOLLOW walk; then open the
regular mode-0600 owner-owned key by relative dir_fd, using
O_NOFOLLOW. Key creation uses O_CREAT|O_EXCL, and failed creation's
cleanup uses os.unlink(leaf, dir_fd=pinned_directory). For project files,
validate the owner-selected directory before the same no-follow descriptor
walk, then inspect only the three locally selected KiCad project/board/
schematic basenames with descriptor-relative os.stat(...,
follow_symlinks=False). No file contents, filename, path, native KiCad
operation, or directory listing are returned to Cloud.
| Open Sonar issue | Sink | Review evidence |
|---|---|---|
AaGAw8PCmfyg43yDg4Dy |
cloud_once._load_owner_key / os.open |
CLI key path; validated leaf, owner-private pinned directory, no-follow descriptor and owner-only regular PEM |
AaGAmNC-N2hGQSp2QaLy |
cloud_pair._create_private_key / os.open |
Locally selected key; exclusive create within owner-private pinned directory, no-follow, mode 0600 |
AaGAw8PBmfyg43yDg4Dx |
cloud_pair._create_private_key / os.unlink |
Cleanup only after this call's exclusive creation failed; unlink targets validated basename relative to that same pinned directory descriptor |
AaGAw8Dkmfyg43yDg4Dw |
cloud_readonly_boundary._open_operator_directory / os.open |
Locally chosen absolute project directory; rejects lexical .., NUL, oversized components, >128 hops, and traverses without following symlinks |
Regression evidence: tests/cloud/test_cloud_pair.py exercises symlink
key and ancestor rejection, insecure parent permissions and lexical
traversal; tests/cloud/test_local_readonly_boundary.py covers
ancestor/file symlinks, lexical upward navigation, relative and invalid
directory input, oversized and over-deep paths, disallowed operations,
and absence of local names or private bytes in the result. Additional
controlled directory-swap races assert that, after a validated directory
descriptor is pinned, a substituted symlink cannot redirect: (1) key
loading, (2) exclusive key creation, (3) failed-creation cleanup/unlink,
or (4) project file-presence inspection. The tests deliberately rename
the original parent and replace its former path with a symlink to a decoy;
the pinned directory remains authoritative. These tests demonstrate the
implemented kernel-level boundary but do not change Sonar issue states.
Cloud-only patch coverage in the latest local test measured 100% (6/6 modified
executable source lines); the official PR quality gates still decide
acceptance. A separate isolated real Python ↔ Cloud HTTP/WS + PostgreSQL
test completed one authorized read with no private project content;
its owner browser OAuth session was an explicit synthetic fixture.
Residual operator/agent authority boundary (not yet production-accepted):
cloud_pair and cloud_once parse the trusted Cloud origin, key file,
and/or local project directory from their invoking process's arguments.
--begin-pairing and --allow-once are opt-in flags, not independently
verified proof of human consent. A local AI agent with an unrestricted
shell under the operator's user identity could supply those arguments too;
O_NOFOLLOW protects filesystem traversal but cannot authenticate who
chose a permissible directory, project binding or Cloud origin. The same
caller-provided --cloud-origin is currently used as the trusted-origin
comparison in the one-shot CLI, not an independently pinned origin.
tests/cloud/test_agent_tool_boundary.py fails if the MCP server or
registered-tool source modules directly import these private Cloud CLIs or
their project-directory boundary. That test is a narrow regression check,
not an OS sandbox or proof against dynamic imports, subprocess shell
agents, or any other invocation path. Protecting users in those settings
requires a separately authenticated local consent/configuration boundary
and real-user acceptance before deployment; do not treat these four Sonar
issues as automatically false positives merely because the direct MCP tool
surface presently does not import the connector CLIs.
Foreground approval added after this review: cloud_once --allow-once
now fails closed on non-interactive stdin/stdout before opening an owner key
or initiating TLS/WSS. On a foreground terminal, the CLI displays the
literal selected Cloud origin, project UUID, project folder, and file stem
(using escaped representation) and requires an exact fresh random
APPROVE <code> response before key access. Tests deny piped/no-TTY
commands, wrong codes, EOF, Ctrl-C, and verify a deliberate valid
foreground approval allows the existing one-shot path. This reduces
accidental or unattended launches; a malicious agent with PTY access
under the same OS user can still read and enter the challenge. It is
not a separately authenticated human approval, origin pin, OS sandbox,
or valid reason to dismiss S8707. Real staging/release must review
that remaining OS authority and the owner-approved project-to-Cloud
identity binding independently.
Special-file substitution cannot hang owner-key loading: The PEM key
and its owner-only pairing sidecar were previously opened with
O_RDONLY|O_NOFOLLOW before fstat verified their regular-file types.
A same-UID process could replace either basename with a FIFO; a blocking
read-only open on the FIFO would then wait indefinitely before reaching
the inode-type check, potentially hanging the explicitly approved CLI.
RED-before-GREEN tests first reproduced each blocked reader in a
timeout-bounded subprocess. The committed regressions use controlled
threads with FIFO release cleanup instead of launching a subprocess. Both read-only opens now require
POSIX O_NONBLOCK in addition to no-follow, then reject non-regular
inodes immediately using fstat. Ordinary 0600 PEM and sidecar reads
retain their existing checks. This prevents one local DoS vector, but
does not remove the five S8707 path-taint reports or stop a
same-user agent capable of accessing approved paths and terminals.
Pairing CLI terminal redirection is also denied: Unlike the
one-shot read, the enrollment CLI initially permitted piped stdin/stdout
to reach the owner-key and remote challenge steps, with its browser
confirmation only requiring an Enter keypress. It now rejects non-TTY
stdin or stdout at the CLI entrypoint before calling enroll,
generating a key or posting a pairing challenge. Its interactive
browser-confirmation helper independently enforces the same condition.
Five targeted tests cover stdin/stdout redirection and foreground
confirmation. This prevents unattended pipe-driven enrollment, but
does not authenticate a human against a same-UID agent able to
create its own PTY or access the owner's browser account. Real owner
OAuth and independent operator consent remain required.
Local lease timebase regression: the 30-second cloud_once approval
window now uses time.monotonic_ns() for its local authorization cutoff,
not the adjustable Unix wall clock. Unix milliseconds remain necessary for
Cloud-signed request deadlines and the remote session expiry envelope. A
red-before-green regression proved that rolling the system wall clock back
previously extended the effective approval lease; it now permits a read at
29 seconds and rejects at the 30-second monotonic boundary. This does not
authenticate the invoking OS principal or settle the four S8707 findings.
Terminal approval must not renew after a delayed handshake:
Previously the 30-second wall-clock session cutoff and monotonic local
consent cutoff were both computed inside the dispatcher factory, which
Cloud calls only after the device/session TLS-WebSocket proof exchange.
This could extend a foreground approval by the whole handshake delay.
_confirm_local_read now captures both deadlines immediately after the
exact foreground response, and _connect receives those immutable
values. It rejects an already expired grant before opening the key and
again at the dispatcher factory after the remote proof exchange; each
subsequent read still checks the original monotonic cutoff. Two focused
tests confirm the grant clocks start when the foreground response returns
and that a delayed handshake at exactly 30 seconds cannot renew approval.
This does not independently authenticate who entered the terminal text.
Local result delivery must revalidate after completed metadata inspection:
Previously the LocalReadDispatch.read worker checked the operator grant
and signed request deadline before returning metadata to the async transport,
but _complete_authorized_read checked only device/session identity
before its actual connector.read_result WebSocket send. A grant or
short signed-frame deadline could expire in the scheduling gap between
asyncio.to_thread returning and the send. The transport now calls
assert_delivery_authorized against the exact original request bytes:
current local authorization, signed request deadline, device/session
identity, prior request-ID inspection, closed and in-flight state are
checked anew immediately before sending. Focused offline regression
covers both revoked grants and expired frame deadlines; real disposable
localhost TLS/WSS regression advances the owner monotonic clock after
the worker's last authorization but before the WebSocket send and
verifies that no connector.read_result is delivered. The
normal result/ACK fixture still passes. Like other pre-send checks,
this reduces but cannot make a filesystem check and asynchronous
network write one indivisible operation; Cloud must independently
revalidate owner, OAuth-client, project and device grant at delivery.
Neither this change nor the tests establish independent human/OS
principal authority over an agent sharing the owner's user account.
One-shot enforceability at the local dispatcher: general offline
LocalReadDispatch supports multiple sequenced reads for isolated lifecycle
testing, but the actual cloud_once CLI now constructs its dispatcher with
max_reads=1. A red-before-green regression proved that the former CLI
factory accepted a second authorized summary within the same 30-second lease
even though the current WebSocket transport handled only one. The updated
dispatcher rejects that second request independently of the transport;
tests also reject zero, excessive, boolean and non-integral budgets. This
defense-in-depth does not address who controls the local CLI arguments.
Informed local confirmation fields: the foreground cloud_once
prompt now prints the chosen owner account, device UUID and private-key
filename as escaped text as well as the Cloud origin, project UUID,
directory and project stem. A red-before-green test verifies those
identities are visible before the APPROVE <code> response. No key
contents are printed. This reduces inadvertent device/account/key
confusion; the invoking process still supplies every value, so it is
not independent identity verification or a resolution of S8707.
Paired Cloud origin and device binding: after a successful HTTPS browser
challenge and device redeem, the local enrollment CLI now writes a mode-0600,
owner-owned, exclusive-create <private-key>.cloud-binding-v1.json record in
the same pinned 0700 private directory, containing only the original
canonical Cloud HTTPS origin, disabled device UUID and public-key
fingerprint (no secrets or local KiCad paths). The one-shot CLI requires
this record and compares exact selected Cloud origin/device ID and the
loaded key's DER SHA-256 fingerprint before any outbound WSS
connection. Missing, symlink, world-readable, duplicate-key or tampered
records fail closed; the sidecar is never blindly overwritten. An already
enrolled private key cannot enroll a second remote device. Pre-existing
keys or failed enrollment keys lacking this record cannot be used as
one-shot identities; use a new owner-selected key path, a fresh browser
approval and explicit device enablement. No automatic migration, remote
re-enrollment or production rollout is performed by this code.
This protects against accidental/low-privilege Cloud endpoint substitution where the adversary cannot edit owner-only credentials. A same-OS-user agent with access to the 0600 key and 0700 directory can still replace both the metadata and private key, so the sidecar is not an independently authenticated human-origin approval or a resolution of the four S8707 alerts. Trusted OS session separation or independent approval and genuine owner OAuth staging remain release blockers.
No orphan device on pre-existing sidecar: Before creating a fresh
signing key or issuing a Cloud enrollment challenge, the local pairing
client inspects the corresponding sidecar name using a pinned owner-private
directory descriptor and os.stat(..., follow_symlinks=False). An existing
file, including a dangling symlink, is denied immediately instead of
discovering the O_EXCL collision only after remote device redeem.
Red-before-green tests assert zero Cloud requests and zero new key files for
both collision types. Final sidecar creation still uses O_EXCL|O_NOFOLLOW
because preflight cannot eliminate concurrent filesystem races. No existing
device or production enrollment was changed.
Failed enrollment-record persistence must not delete another inode:
cloud_once._save_owner_binding previously called os.unlink by sidecar
pathname after a write/fsync error. A RED-before-GREEN same-UID race test
proved that a process replacing the pathname at this instant caused the
failed writer to unlink the replacement. The writer no longer unlinks
anything by pathname after a failed write: it opens the newly created
record unbuffered and, if a write or fsync fails, truncates the originally
opened FD before closing. Another RED-before-GREEN test confirmed that
a completed but unsynced JSON record previously remained loadable on
fsync failure; it now fails closed in the simulated failure scenario.
If disk errors prevent the compensating truncate itself, fully reliable
rollback cannot be guaranteed; the CLI still reports failure and
requires operator inspection. An empty/incomplete owner-only sidecar
blocks automatic reuse/re-enrollment; recovery requires deliberate
inspection and a fresh enrollment key. These tests do not grant
independent protection against an agent with unrestricted owner account
access; they prevent this writer from deleting a substituted entry.
Failed owner key persistence must not delete a substituted file:
The same basename race existed in cloud_pair._create_private_key:
after an exclusive-create owner PEM write failed, the prior cleanup
unlinked the leaf pathname via its pinned parent FD. The parent FD
blocks directory swaps but not a same-directory basename swap.
Red-before-green regressions reproduced deletion of a concurrent
same-owner replacement file and verified the key's own original inode.
Now key persistence uses unbuffered I/O; on write/fsync failure it
truncates the open key inode, never unlinks a possibly changed
pathname. The old directory-swap cleanup regression was updated to
require a zero-byte, private unusable PEM, not an absent file. This
prevents accidental use or unintended deletion in the covered errors;
a failed truncate on catastrophic disk failure still requires manual
owner recovery. An empty key cannot enroll automatically; select a
fresh unused key path after inspection. This does not resolve the
same-user agent trust boundary, even though the nine PR-local S8707
analyzer findings have since closed.
Reopen this threat review before any change that allows server, model, MCP request, imported project metadata or Cloud wire content to select a filesystem path or any path component. Remote activation also requires trusted TLS ingress, real owner OAuth consent, device and project grants, and independent production approval. Do not mark these alerts as fixed, false-positive, accepted or suppressed solely to turn a red check green.
S5332 disposition¶
The seven pre-hardening python:S5332 findings were reviewed individually. The
real risk was not the existence of local HTTP itself; it was that a non-loopback
bind could previously carry a bearer token over plaintext. The transport policy
now removes that state from the supported configuration space.
| Pre-hardening location | Disposition after this change | Technical evidence |
|---|---|---|
src/kicad_mcp/config.py URL-scheme text |
Analyzer-only/message construction | The wording no longer embeds an http:// transport example and does not initiate network I/O. |
src/kicad_mcp/server.py auth/resource base URL (two flows) |
Remediated | Auth metadata uses advertised_http_base_url; non-loopback direct mode requires TLS, tls-proxy requires HTTPS, and loopback-proxy permits HTTP only on a loopback public origin. |
src/kicad_mcp/server_info.py advertised endpoint (two flows) |
Remediated | Discovery uses the same validated advertised base URL; remote plaintext advertisement is not a valid configuration. |
src/kicad_mcp/server.py dashboard/browser URLs (two flows) |
Accepted loopback-only HTTP | dashboard --host now rejects non-loopback hosts. Local dashboard HTTP remains intentionally supported and never represents a remote cleartext transport. |
This is an intentional security compatibility break for deployments that directly
bound remote plaintext HTTP with only a bearer token. Migration is explicit:
terminate TLS directly with KICAD_MCP_TLS_CERT_FILE and
KICAD_MCP_TLS_KEY_FILE, use tls-proxy with an HTTPS public base URL, or use
loopback-proxy only when a bind-all container port is published to host
loopback.
Review rules¶
These dispositions are valid only while the corresponding data flow remains a top-level caller-selected CLI path. Re-review is required if any of the following changes occur:
- model/provider/request/artifact content becomes part of a filesystem path;
- a selected root begins accepting unvalidated child names;
- one of these CLIs is exposed as a remote request handler with a filesystem sandbox promise;
- a workflow begins passing untrusted event text into one of these path options.
No Sonar rule, severity, exclusion, Quality Gate, CodeQL query, or coverage threshold is changed by this disposition.