fix(runtime): classify secret-gate source notation - #2205
Conversation
|
CI is red at this head on a single root: The failure looks like a genuine behaviour change rather than flake. Trigger let near_trigger = contains_trigger(after_last_sentence_boundary(&window[..raw_start]))
|| contains_trigger(before_first_sentence_boundary(&window[raw_end..]));The test fixture is: The trigger word The boundary rules consider a period followed by an alphanumeric byte Suggested direction: keep the intra-token span refinement, which is the part |
|
Six red boxes on this head, but they reduce to two independent roots — worth separating before Not signals: the two cancelled shards ( Root 1 — a real regression, and it is on this change's own subject. That is the relaxation landing wider than intended. The fixture is a sentence containing the word Worth checking alongside this: another open change to Root 2 — the secret scan, which is almost certainly a fixture rather than a real credential. The What the tree shows, though, is quite specific. I could not run gitleaks here to confirm it flagged that line, and the redacted log does not say, so Scope, if it is that line: it appears only in the newest commit. The preceding commit's copy of the |
|
This branch's head is currently turning the secret scan red on every other open pull request in the repository, not just this one. The mechanism is worth stating carefully because the finding itself is benign and the blast radius is not. What gitleaks is matching. A single finding, That line is a test fixture — a 40-hex-character constant bound to a Why it reaches other pull requests. With no The timeline matches that exactly. This commit was pushed at
Every scan that began before the push is green; every scan after it is red, across changes that share no files with this one. Runs on Two independent things to fix.
Worth adding There is also a structural tension here that will keep recurring: the secret gate's tests must contain secret-shaped strings to test the detector, so this file is inherently adversarial to a repo-wide credential scanner. A scoped scan plus a deliberate fixture convention for this one module would settle it more durably than per-finding allowlisting. |
The red
|
This
|
The sentence trim breaks label-to-value association, and an acceptance test already proves itNarrowing trigger context to matched spans is the right idea. The sentence trimming goes one step At this head both sides of the trigger context are trimmed to the current sentence: // crates/khive-runtime/src/secret_gate.rs:969-971
let near_trigger = contains_trigger(after_last_sentence_boundary(&window[..raw_start]))
|| contains_trigger(before_first_sentence_boundary(&window[raw_end..]))
|| has_inline_credential_trigger(raw_token);
let near_trigger = contains_trigger(&window[..raw_start])
|| contains_trigger(&window[raw_end..])
|| has_inline_credential_trigger(raw_token);Downstream there is no second chance. An off-trigger pure-hex token is allowlisted outright at The existing fixture The asymmetry is what makes this worth holding on. A false positive masks something harmless and is The new local test establishes that a detector name should not cross a sentence boundary. It does Suggested direction: keep the matched-span improvement, but do not let sentence scoping break For transparency on how this was produced: an automated pass over this diff ran on a model from the |
ohdearquant
left a comment
There was a problem hiding this comment.
Automated review. Posted by this repository's automated pull-request review pipeline; this is not a human read and does not gate the merge by itself.
Verdict on head 08be572: REQUEST-CHANGES, 3 blocking findings. Finding details are delivered to the review's recipients rather than posted here. Do not merge this head while blocking findings are outstanding; a pipeline comment on a newer head supersedes this one.
Two conflicts, both resolved toward main's newer structure with this branch's intent folded in rather than dropped: - `check_entropy_heuristic` now calls main's `entropy_trigger` helper, which already carries the inline-credential check and adds the line-local rule for a bare Git-length value. This branch's sentence-boundary narrowing moves inside that helper, so trigger context still stops at a sentence boundary. The preceding-label fallback stays exempt: that line was already required to end in an assignment delimiter. - The allowlist paragraph keeps both rules: this branch's path, revision and LaTeX exceptions, and main's line-local trigger rule for bare Git-length hex. One test is red at this commit and is not resolved here: forty_hex_bridge_fragments_keep_cross_line_detection_and_full_masking leaves the second bridge fragment in the masked output. It fails identically with the sentence-boundary narrowing removed, and identically with step 6's redaction target switched back to the whole token, so neither of those is the cause.
|
Main is merged in and the branch is mergeable again. Two conflicts, both in the
One test is red at this head and is deliberately not papered over:
So the narrowing is load-bearing and is not the cause, and step 6's return shape |
…e separator A 40-hex credential glued to a second fragment by U+200B is detected as one payload, but the masker redacted only the token the scan returned, so the rest of the same payload survived into stored text. The masker now extends a redaction across gaps made only of non-ASCII, non-alphanumeric characters and emits one marker per run inside the span, so the separator stays visible instead of being swallowed. Ordinary spaces and newlines are ASCII and are never walked; a non-ASCII password such as redis://:密码@host is alphanumeric and stays one marker.
Trigger context now stops at a sentence boundary, so a credential word in the previous sentence no longer flags a hash in the next one. The ingest fixture that checks masking without dropping the note put its trigger word across that boundary; keep the word and the hash in one sentence so the fixture keeps testing the ingest path rather than the boundary rule.
Summary
Verification
cargo test --manifest-path crates/Cargo.toml -p khive-runtime --lib issue_1988 -- --nocapture— 3 passed.cargo test --manifest-path crates/Cargo.toml -p khive-runtime --lib issue_2056 -- --nocapture— 2 passed.cargo test --manifest-path crates/Cargo.toml -p khive-runtime --lib issue_2076 -- --nocapture— 3 passed.cargo test --manifest-path crates/Cargo.toml -p khive-runtime --lib— 1,415 passed, 7 ignored.cargo clippy --manifest-path crates/Cargo.toml -p khive-runtime --all-targets -- -D warningscargo fmt --manifest-path crates/Cargo.toml --allgit diff --checkSecurity boundaries
Known-provider prefixes and inline credential assignments are unchanged. Repository references still block behind a direct credential label. LaTeX only exempts recognizable notation without credential-length hex or independently high-entropy alphanumeric runs. Exact public test-vector values do not receive a publication-based bypass.
Closes #2056
Closes #2076
Closes #1988