Skip to content

sshole: a never-checked finding no longer reads as already fixed - #10

Merged
devGregA merged 6 commits into
mainfrom
devgrega/sshole-notchecked
Nov 19, 2026
Merged

devGregA merged 6 commits into
mainfrom
devgrega/sshole-notchecked

Conversation

@devGregA

Copy link
Copy Markdown
Contributor

fix and repo.Find (which Sensei's /fix uses) 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

  • A not-checked finding that is no longer on its line (a skipped file that now reads clean, a reference that now resolves to a vulnerable pin).
  • A file that cannot be read this time (too large, not a regular file), a line past the end of the file, a failed base-image lookup, an unset ${VAR} base.
  • A real finding for the same package still in the file under another rule (end-of-life vs unpinned, a loosened pin), or a not-checked finding for the same package anywhere in the file.
  • Rules or file kinds Find never produces.
  • A message that does not parse (empty, prefixed, reformatted): declines instead of matching nothing.

Behaviour changes callers see

  • Plan no longer returns already; it returns (*Change, error). Sensei's callers change with the re-copy.
  • An unset variable in FROM used to read as an empty (scratch) image, so apk add openssh-server on 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 tag alpine:3. and rewritten.
  • A FROM image the scan cannot resolve gives an unknown note, so scan exits 3 instead of 0 and fix exits 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 (FuzzScanText now checks every message's key against its finding's properties). parity/sshole.py could 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

devGregA and others added 6 commits November 18, 2026 03:23
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>
@devGregA
devGregA merged commit 8e3ba25 into main Nov 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant