test: stop printing the asserted Result in the seven flagged assertions - #1611
Merged
Merged
Conversation
Seven `rust/cleartext-logging` alerts are open on `main`, all of them the same shape: an assertion in the integration suite formatting a `Result` that CodeQL traced back to `create_project_secrets`. The source is the function's NAME. `SensitiveDataCall` matches on `HeuristicNames::nameIndicatesSensitiveData`, so `create_project_secrets` is a taint source because it contains "secret", not because of anything its `Result<()>` can carry — and #1599 already made it impossible for a payload to reach one of those errors. The fix that would have corrected the model rather than the sinks needs a barrier model, which needs a configuration this repository owns, which the organization's `Glyndor baseline` pins away. That was #1603 and it is closed. This is what is left. Removing the formatted value removes the sink. That is certain rather than hoped: `resources_health.rs:209` already asserts on the same tainted result with a plain message and is not flagged, and eighteen `.unwrap()` calls on the same values across the suite are not flagged either. Only `assert!` interpolating the value is a sink. Seven changed, eleven left alone. There are eighteen occurrences of the pattern in the suite and CodeQL flagged seven; the other eleven are on paths the query does not reach. Nothing syntactic separates them, so each of the three files gains a note saying why the inconsistency is deliberate — without it, the next reader tidies it up and the alerts come back. The `matches!` assertion in `commands_networking.rs` lost the most, so it is split instead of flattened. `expect_err` first, which prints the `Ok` value — here `()` — then the variant check. That keeps the difference between "the run succeeded" and "it failed with the wrong variant", which a single flat message would have thrown away. Driven red by expecting `Unsupported` instead: "expected RunExited, got a different ComposeError variant". The cost, stated rather than discovered: these seven no longer say which error they got, and nothing prevents an eighth. A syntactic gate cannot tell the seven from the eleven, so there is no check to add that would not also ban the assertions that are fine. Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
4 tasks
Jaro-c
added a commit
that referenced
this pull request
Aug 30, 2026
Eight pull requests, no version bump and no tag. Both branches stay at 5.4.0 and release.yml fires only on a v* tag or a manual dispatch. Update path: #1612 podup update's refusal on an apt-owned binary now says when apt will never do it either; #1609 that refusal now happens for Homebrew and Scoop too, which it never did; #1607 glyndor-archive-keyring becomes a hard Depends. Security: #1611 the seven assertions CodeQL flagged stop printing the Result they assert on. Housekeeping: #1606 podup stops publishing to crates.io; #1604 the two crates excluded from the workspace get their own Dependabot entries; #1605 the two files closest to the line-limit cap are split; #1601 the README says what depending on unattended-upgrades does not buy. This promotion also measured the code_scanning rule added to protect-main earlier today. With seven rust/cleartext-logging alerts open on main, it came back CLEAN. GitHub's documented behaviour -- that the rule blocks on alerts introduced by the pull request rather than pre-existing ones -- is confirmed rather than read. What it does not fix: code scanning still runs on the default branch only, so none of the eight was scanned on its own pull request. #1603 would have changed that and is closed, because the organization's Glyndor baseline pins CodeQL to default setup across fifteen repositories. Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Seven
rust/cleartext-loggingalerts are open onmain, all the same shape: an assertion in the integration suite formatting aResultthat CodeQL traced back tocreate_project_secrets.The source is the function's name.
SensitiveDataCallmatches onHeuristicNames::nameIndicatesSensitiveData, socreate_project_secretsis a taint source because it contains "secret" — not because of anything itsResult<()>can carry, and #1599 already made it impossible for a payload to reach one of those errors.The fix that corrects the model rather than the sinks needs a
ModelsAsDataBarrier, which needs a configuration this repository owns, which the organization'sGlyndor baselinepins away. That was #1603 and it is closed. This is what is left.Why removing the value is certain to work
Not hoped — measured, twice, from the scan's own results:
resources_health.rs:209already asserts on the same tainted result with a plain message and is not flagged..unwrap()calls on the same values across the suite are not flagged either.Only
assert!interpolating the value is a sink.Seven changed, eleven left alone
There are eighteen occurrences of the pattern in the suite. CodeQL flagged seven. The other eleven are on paths the query does not reach.
Nothing syntactic separates them, so each of the three files gains a note saying the inconsistency is deliberate. Without it the next reader tidies it up and the alerts come back — which is the failure this repository keeps meeting in prose form.
The one that lost the most is split, not flattened
commands_networking.rs'smatches!assertion would have gone from naming what it got to saying nothing:expect_errprints theOkvalue, which here is(), so it is safe and it keeps the difference between the run succeeded and it failed with the wrong variant. A single flat message would have thrown that away.Test plan
cargo fmt --all --checkandcargo clippy --locked --all-targets --all-features -- -D warnings, both cleanrun_flagsandcommands_networkingall green, including the restructured oneUnsupportedinstead ofRunExited— reports "expected RunExited, got a different ComposeError variant"The cost, stated rather than discovered
These seven no longer say which error they got. And nothing prevents an eighth: a syntactic gate cannot tell the seven from the eleven, so there is no check to add that would not also ban the assertions that are fine.
Whether the alerts actually clear will not be visible until this reaches
main, because code scanning runs on the default branch only.Checklist
developgit commit -s) and signedCargo.tomlanddebian/changeloguntouchedRefs #3, #4, #5, #6, #7, #8, #9.
Signed-off-by: Jaro-c 75870284+Jaro-c@users.noreply.github.com