Repository navigation
sshole: a never-checked finding no longer reads as already fixed - #10
Merged
Merged
Conversation
repo.Find took any finding missing on rescan as gone, so fix (and Sensei's
/fix, which copies this package) reported it as already fixed even when it
was never checked or could not be checked this time. It now returns gone
only when the rescan checked what the scan reported, and otherwise
declines with "rescan to confirm":
- a not-checked finding (a skipped file, an unresolved image, a Buildroot
file with no C library) that is no longer on its line, naming the
finding there now when the reference resolves to a vulnerable pin;
- a file that cannot be read this time (oversized, not a regular file),
and a missing file for a not-checked finding;
- a line past the end of the file;
- an apk, end-of-life or build finding whose line is not checked this
time (the base image lookup failed, the FROM is now an unset variable);
- a Yocto finding when a build file the rescan needs cannot be read.
A checked finding that is gone from its line, or whose file is deleted,
still reads as gone.
Plan returned already=true for a line past the end of the file, and fix
skipped it silently; it declines now, and the always-false result is gone.
An unset variable in FROM (ARG BASE / FROM ${BASE}) expanded to an empty
image name, which reads as scratch, so an apk install of OpenSSH on it was
not reported at all. It is kept as written now and reported as not checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Find:
- Declines rules and files it never rescans (image, unknown rules, files
the scanner does not read) instead of calling them gone.
- Takes the package, the variable and the build system from the finding's
message. A not-checked finding about any of them, anywhere in the file,
holds the finding back; one about something else (an unset $EXTRA beside
a fixed pin) no longer does.
- Declines when the line still has a finding for the same package under
another rule (eol-base and apk-unpinned when the lookup fails, a pin
loosened to no floor), and when a build file still has its build
finding, moved and reworded.
- A Yocto finding is held back only by its own TCLIBC file, or a directory
holding it, being unreadable (or the walk's limit), not by any oversized
build file in the tree; an unreadable directory now counts.
- Past the end of the file declines only while the file still has findings
of that rule; otherwise the whole-file rescan settles it.
- Messages stored with "set on line N" still match.
Scanner:
- A pin through a variable no longer puts a line number in its message.
- FROM variables: an empty value or default expands to empty again
(ARG REGISTRY= / ${REGISTRY:-}); an unset prefix before a complete image
(${REGISTRY}alpine:3.21) is judged on the rest, with a note naming it;
an unset optional suffix (python:${PY}${FLAVOR}) still resolves online;
anything else, such as alpine:${MAJOR}.${MINOR}, is not known (it was a
false end-of-life finding, and the last commit made it fixable).
- ARG with no value is unset, not empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Find:
- Fails closed when the message gives no key (empty, prefixed or
reworded): any not-checked finding with a package, system or variable
holds the finding back, as does any other apk finding on the line, and
any build finding in a build file.
- On a line with findings for several packages, only the message's own
package is this finding (a fixed openssh-server pin no longer returns
the openssh pin beside it).
- A finding for the same package with the same spec elsewhere in the
file also holds it back (end-of-life, lookup down, line shifted).
- FuzzScanText checks that every finding's message gives back its own
package, variable and system, or none; a test checks it exactly for
every message kind.
Scanner:
- A variable in the tag keeps what the name says: alpine:${V},
python:${PY}-alpine and node:${NODE}-alpine3.14 are judged as Alpine
(with the branch when the name gives it whole), as on main, and never
looked up. Only an image whose name is a variable is not known.
- ARG and ENV values expand the variables already set (ARG TAG=3.21 /
ARG BASE=alpine:${TAG}).
- A tag that ends in ".", "_" or "-" is not a whole tag, so
alpine:3.${MINOR} is no longer end-of-life on "Alpine 3." nor rewritten.
- The prefix note names every unset variable before the image and the
image judged, not the stage name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The variable a finding came through is read only from the end of its
message (before the prefix note), so a spec quoting "(through $Y" is
not taken for variable Y; it is a FuzzScanText seed now.
- A spec with a space matches itself elsewhere in the file: the key keeps
the message after its verb, which starts with the whole spec.
- Find documents that callers must pass the message: with none, only the
exact line is looked at.
- An image whose name is a variable says nothing about glibc, but its tag
can still say Alpine (${IMG}:alpine), as on main.
- Tests for a moved build finding found with no message or a reworded
one, a variable image name, and a legacy ENV value that expands an
earlier one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The variable a finding came through is read after trimming a trailing full stop, spaces and newlines from the message, so a stored message that ends in one still names it and a removed ARG is not gone. - With no message, an apk finding no longer on its line declines while the file still has any apk finding (it may be this one, moved); before, only its own line was looked at and it read as gone. - Find's doc says which rules follow a moved finding: all of them with the message; with none, the apk rules and build-config decline, and star-account, password-config and ansible-apk read as gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
fixandrepo.Find(which Sensei's/fixuses) could report a sshole finding as already fixed when the rescan never checked the same thing again. This makes them say "gone" only when the rescan really checked it; everything else declines with "rescan to confirm".Cases that used to read as fixed and now decline
${VAR}base.Findnever produces.Behaviour changes callers see
Planno longer returnsalready; it returns(*Change, error). Sensei's callers change with the re-copy.FROMused to read as an empty (scratch) image, soapk add openssh-serveron it was dropped; it is now reported as not checked. Empty values and prefix variables (${REGISTRY}alpine:3.21) are judged on the image they name, with a note.alpine:3.${MINOR}is no longer read as the end-of-life tagalpine:3.and rewritten.FROMimage the scan cannot resolve gives anunknownnote, soscanexits 3 instead of 0 andfixexits 1 instead of 0.Verification
Three independent review rounds plus a final confirmation, each finding fixed with a test that failed first.
go test,go vet, gofmt and the sshole fuzzers pass (FuzzScanTextnow checks every message's key against its finding's properties).parity/sshole.pycould not run on the build host; CI runs the suite.Note: #9 also changes
detectors/sshole(size limits from its engine round), so whichever merges second resolves the overlap.🤖 Generated with Claude Code