We can pass multiple pipeline dirs for melange configs, so we should
accept multiple in dag.NewPackages.
Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
This pipeline is intended for local devel use only. Using it in elastic
will, at best, slow things down by caching things unnecessarily.
There may be other side-effects as well - let's just block them.
Signed-off-by: dann frazier <dann.frazier@chainguard.dev>
Now we can run:
```
wolfictl lint foo bar baz
```
This diff feels a little goofy but I didn't want to touch the actual
linter code, and this keeps the diff small and simple.
Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
octo-sts will [add CVE/GHSA
comments](352a0137b9) whenever it
bumps a package's epoch to fix a security issue. This is good, but we
should remove those comments when we invoke `wolfictl bump`, otherwise
they will wrongly imply that the manual bump was related to the
security fix as well.
I tried to be conservative here and only remove the comments that
start with "(CVE|GHSA)-", because there is a possibility to find an
actual human-made comment and we don't want to touch those (although
IMO it should be considered bad practice to leave manual comments
right after the `epoch` definition).
Signed-off-by: Sergio Durigan Junior <sergiodj@chainguard.dev>
Add a linter to find variables that are defined in the var-transform
section but don't get referenced elsewhere and thus are unnecessary
definitions. As an unneeded variable definition does not cause build
failures, the lint check reports at level 'warning'.
Sample result from wolfi-dev/os:
```
$ wolfictl lint at-spi2-core.yaml
2025/10/15 21:27:32 ERRO Package: at-spi2-core: [unused-var-transform]: var-transform creates unused variable "mangled-package-version" (WARNING)
```
Testcases are added for flagging simple cases as well as to ensure
that false positives don't occur.
v2: remove no longer used argument in walkNode().
v3: report all unused variable definitions, rather than the first one
found, and adjust testcase for multiple unused variables.
Signed-off-by: Steve Beattie <steve.beattie@chainguard.dev>
Not all gitlab-* packages should be treated as GitLab, but most of them are - as seen in
```
if strings.HasPrefix(name, "gitlab-") {
attr.Vendor = "gitlab"
attr.Product = "gitlab"
attr.SWEdition = "community"
return &attr
}
```
Added in 1c050aa720
One notable exception is gitlab-operator, which is a Kubernetes operator
for managing GitLab installations, and not part of GitLab itself with
source @ https://gitlab.com/gitlab-org/cloud-native/gitlab-operator
Adding an explicit exception for this package to not match on `gitlab-*`
The reason for this change is because new gitlab-operator package was being matched with all older gitlab CVEs which is incorrect.
Signed-off-by: philroche <phil.roche@chainguard.dev>
Syft logs a warning if you're using a directory source but don't set a 'source.Alias' value for the source. This log message isn't warning about anything that impacts the accuracy of the analysis, but it's nonetheless noisy and annoying. This PR plugs in an alias value to avoid the warning. It also moves the Syft-to-clog wiring slightly earlier to make the effect of this change reproducible with the local CLI.
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
As part of the work to garbage collect older apk files we need to be
able to withdraw more packages that can be supported as command line
arguments from APK indexes; add option to pass the list of packages to
withdraw as a file to support larger withdrawal options.
Update test golden files to match the new vulnerability output
from grype 0.97.0. The new version produces different vulnerability
matches due to updated vulnerability database and matching logic.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
Add nil as second parameter to distro.FromRelease to handle the new
fix channels API requirement. Since wolfictl doesn't scan Red Hat
systems and has no need for EUS channel functionality, passing nil
is appropriate.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
The update identifier must match the github repository because, otherwise,
updating the package fails. Actualy, we have had a case already where a package
definition was copied & pasted from another and these values were not updated
to match.
To catch any further mismatches like that this commit adds a new linter rule:
update-identifier-must-match-git-repository.
It checks, in a case insensitive manner, whether the GitHub repository URL
contains a GitHub identifier that matches the one from the update section of
the package yaml.
Furthermore, because a single package can have multiple pipelines, this linter
looks for a single match, i.e. a single repository URL from all of the
pipelines that are using git-checkout must match the update identifier in order
to pass.
Note that is possible to opt-out from it by using the #nolint feature with this
linter name. See:
update-identifier-not-matching-git-checkout-repository-nolint.yaml to see how
that is done.
Signed-off-by: Konrad Zapałowicz <konrad.zapalowicz@chainguard.dev>
The assert.Equal() expects the parameters to follow the "expected, actual"
order. However, the test assertions for linter rules were written in the
reversed order. While doing so has no functional consequences the output was
confusing.
This commit fixes that by introducing the proper order of parameters.
Signed-off-by: Konrad Zapałowicz <konrad.zapalowicz@chainguard.dev>
This causes spurious cycles, and the reason for doing this (#1217) is no
longer relevant. If a transitive build dependency's runtime dependency
is important enough that we want to consider it for build ordering, it's
straightforward to add it as a direct build dependency.
Fixes#1385
Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
The merge logic was using map iteration which resulted in non-deterministic
ordering of findings. This caused integration tests to fail intermittently
as the output order would change between runs.
Fixed by adding a sort step after merging to ensure consistent ordering
using the existing Findings sort interface (by location, then name, then
vulnerability ID).
Updated all integration test golden files to reflect the new deterministic
output ordering.
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
Use index-based iteration instead of value copying for Finding structs
to avoid copying 216 bytes on each iteration. Also fixed:
- Changed packageKey field from 'type_' to 'typ' (avoiding reserved keyword)
- Ensured all files end with a newline
All tests pass and no functional changes were made.
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
Update integration test golden files to reflect the new behavior where
duplicate vulnerability findings are merged. The changes show:
- Reduced finding counts across all test cases (e.g., crane-0.14.0-r0
dropped from 73 to 72 findings)
- Proper alias preservation in merged findings (e.g., GHSA findings now
include their CVE aliases)
- Consistent deduplication behavior across different architectures
These changes are expected and demonstrate that the merge logic is working
correctly by:
1. Eliminating duplicate reports of the same vulnerability
2. Preserving all alias information in the remaining findings
3. Maintaining separation of findings from different packages
The reduction in findings improves the signal-to-noise ratio for users
while ensuring no vulnerability information is lost.
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
Add logic to merge findings that represent the same vulnerability but are
reported under different identifiers (e.g., CVE-2023-1234 vs GHSA-xxxx).
This reduces noise in scan results when Grype reports the same vulnerability
multiple times through different matchers.
The implementation:
- Groups findings by package (name, type, location) before merging
- Identifies related findings when their ID/alias sets overlap
- Preserves the union of all aliases seen across merged findings
- Prefers findings with more complete alias data (GHSA > CVE)
This ensures that vulnerability filtering and advisory matching work
correctly by having access to all known aliases for each vulnerability,
while presenting cleaner output to users.
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
We've to discard other locations from the list, in part to keep the list of locations per finding minimal and thus easier to reason about as we're examining vulnerabilities for a package over time.
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>