Commit Graph

54 Commits

Author SHA1 Message Date
Sebastian Poxhofer 97327c3d28 refactor(linters): add prefer-coerce-array rule (#45492)
* refactor(linters): add prefer-coerce-array rule

Refs #45217

`x ?? []` and `coerceArray(x)` say the same thing, but only the second
one is searchable and consistent. The rule flags a `??` whose default is
a bare `[]` literal; a non-empty default or an asserted `([] as Foo[])`
still passes.

Applying it across `lib/` surfaced three spots the helper cannot cover,
which keep `?? []` with a disable comment or a narrower fix:

- `package-files.ts` destructures a tuple, which `coerceArray()` widens
- `generate.spec.ts` defaults `matchAll()`, an iterator rather than an array
- `mise/upgradeable-tooling.ts` declares a `Record` return, so its
  `?? []` fallback was wrong to begin with and becomes `coerceObject()`

* refactor(platform/github): hoist the GHE version header lookup

`Object.entries(...).find()` returns a tuple, and defaulting it with
`?? []` only to destructure the second element reads as an array
default when it is not one. Name the found entry instead, which drops
the `?? []` rather than routing a tuple through `coerceArray()`.
2026-08-28 09:27:58 +00:00
Jameel Al-Aziz 6c7d345057 fix(vulnerabilities): scope Go stdlib OSV remediation to the toolchain directive (#45334)
* fix(vulnerabilities): scope Go stdlib OSV remediation to the `toolchain` directive

The module `go` directive was already excluded from OSV alerts, but the toolchain
rule still matched it via shared datasource/packageName and go-mod-directive ranges.

* fix(vulnerabilities): scope OSV remediation rules to the vulnerable depType

Remediation rules are generated per dependency. When that dep has a depType,
constrain the rule so it cannot match another dep that shares datasource and
packageName.

* fix(vulnerabilities): set matchDepTypes only for Go toolchain OSV rules

A generic matchDepTypes would stop an npm `dependencies` rule from also
matching `overrides` of the same package. Only the existing toolchain path
sets depType on the generated rule.
2026-08-21 08:56:12 +00:00
Beto Aveiga a84e007f46 feat(vulnerabilities): match OSV Packagist sub-ecosystems (#45203)
Allow osvVulnerabilityAlerts to match OSV sub-ecosystems such as
Packagist:https://packages.drupal.org/8, based on #40004. Adds a
negative test so unrelated prefixes like PackagistSomething do not match.

Co-authored-by: Stephan Zeidler <stephan@ramsalt.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 16:28:55 +00:00
Sebastian Poxhofer 9717259ffc refactor(oxlint): enable no-else-return and unicorn/no-lonely-if (#44553)
Enable no-else-return (with allowElseIf: false) and unicorn/no-lonely-if
as errors in .oxlintrc.json and fix all 131 pre-existing violations
(91 no-else-return, 40 unicorn/no-lonely-if) across 98 files.

The no-else-return violations were fixed with the oxlint autofix
(iterated to a fixpoint, plus two else-if chains that required
--fix-dangerously) followed by Prettier formatting. One comment dropped
by the autofix in lib/modules/manager/pub/artifacts.ts was restored
manually. The unicorn/no-lonely-if violations were merged by hand,
preserving comments and coverage-ignore hints.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 12:11:21 +00:00
Sebastian Poxhofer 914c64afbd test(linter): zod schema and infered type naming rule (#43736)
* ci: add linting rule for schema and infered types

* refactor: remove usages of Schema and differently named types
2026-06-02 12:07:35 +00:00
Sebastian Poxhofer 15f4bd8eff chore: migrate from zod/v3 to zod/v4 (#43691)
* chore: migrate from zod/v3 to zod/v4

This commit contains the logic changes

* chore: migrate imports from zod/v3 to zod/v4

This contains import updates and adds explicit record keys as zod/v4 requires these now

* ci: enforce usage of zod/v4
2026-05-30 16:01:58 +00:00
Johannes Feichtner b05b21802d feat(vulnerabilities): support golang-version toolchain directive for OSV vulnerability alerts (#43333) 2026-05-14 06:05:17 +00:00
Jamie Tanna 83a415072d fix(vulnerability): set datasource if overriding allowedVersions (#43308)
As noted in #43304, when using `osvVulnerabilityAlerts`, we can
sometimes produce an `allowedVersions` that is valid for the ecosystem,
but without setting the `versioning`, we produce an invalid rule, which
then results in a `config-validation` result, breaking any updates on
the repo.

We should therefore wire in the default `versioning` for the given
datasource.
2026-05-13 13:41:16 +00:00
Jamie Tanna 01f2479eab feat(osv): mark malicious packages with skipReasons (#42510)
* fix(workers/repository): don't include `skipReason`'d dependencies in flattened updates

When we're preparing the final, flattened, list of branches to prepare
updates for, we're not filtering out any dependencies that have a
`skipReason` in them.

In the case that, as part of future changes like #42510, a `skipReason`
may be added after the `lookup` phase, we can still get PRs raised even
when they shouldn't be.

We already filter out `enabled=false`, so we should make sure to also
filter anything with a `skipReason`.

* feat(osv): mark malicious packages with `skipReason`s

As part of current ongoing supply chain attacks, there have been cases
where Renovate updates packages to a malicious version.

We'll be introducing a more in-depth means to surface these, including
from different API sources, as part of the Enrichment functionality,
but in the short-term we can utilise osv.dev's ingestion of OpenSSF's
Malicious Packages data.

To do this, we need to:

- look for any `MAL-` advisories
- match it against the current dependency's version, and if affected, mark it
  as `skipReason: malicious-version-in-use` (which will be unset in
  the `lookup()` function, so we still perform updates
- match it against the dependency's available updates, and if any are
  affected, mark the dependency
  as `skipReason: malicious-update-proposed`

* fixup! feat(osv): mark malicious packages with `skipReason`s

* fixup! feat(osv): mark malicious packages with `skipReason`s

* test(workers/repository): add missing coverage

Co-authored-by: Claude Opus 4.6 <jamie.tanna+claude-code@mend.io>

* chore: simplify type

* wip-opus

* Revert "wip-opus"

This reverts commit e7b5f297c9.

* simplify

* sq

* sq

* fixup

Co-authored-by: Claude Opus 4.6 <jamie.tanna+claude-code@mend.io>

---------

Co-authored-by: Claude Opus 4.6 <jamie.tanna+claude-code@mend.io>
2026-04-14 13:11:04 +00:00
Jamie Tanna 5e5af62224 refactor(vulnerability): extract ecosystem<->datasource translation (#42435)
As part of the addition of the new Enrichment modules, we should perform
a prefactor that'll introduce a shared helper for the how we translate
an "Ecosystem" according to OSV with a datasource that Renovate
understands.

Co-authored-by: Claude Opus 4.6 <jamie.tanna+claude-code@mend.io>
2026-04-08 14:41:28 +00:00
Jamie Tanna 76ae34045a refactor(vulnerability): extract shared functionality into util functions (#42433)
As part of the addition of the new Enrichment modules, we should perform
a prefactor that'll introduce helper methods that can be used across
both GitHub and OSV Vulnerability Alerts.

Because each module uses a slightly different input (Datasource ID or an
"Ecosystem" according to OSV) we need to handle both types of inputs.

Co-authored-by: Claude Opus 4.6 <jamie.tanna+claude-code@mend.io>
2026-04-08 07:25:37 +00:00
Johannes Feichtner 0bcfef096f refactor(vulnerabilities): revert cleanup ae-cvss-calculator import (#41568) 2026-03-02 06:06:12 +00:00
Michael Kriese d98ad0b462 refactor: cleanup ae-cvss-calculator import (#41525) 2026-02-26 18:18:10 +00:00
Michael Kriese 6460e6e0fc fix(osv): ensure singleton database instance (#41512)
* fix(osv): ensure singleton database instance

* Update lib/workers/repository/process/vulnerabilities.spec.ts

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>

---------

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
2026-02-26 10:41:56 +00:00
Johannes Feichtner 4fce8ec749 fix(vulnerabilities): fix CJS interop for ae-cvss-calculator import (#41337)
* fix(vulnerabilities): fix CJS interop for ae-cvss-calculator import

* avoid as any
2026-02-25 22:58:31 +00:00
Michael Kriese 07c6e733bd chore(instrumentation): instrument osv getVulnerabilities (#41480) 2026-02-25 09:38:07 +00:00
renovate[bot] 4a2578d18d build(deps): update dependency zod to v4 (main) (#41225)
* build(deps): update dependency zod to v4

| datasource | package | from    | to    |
| ---------- | ------- | ------- | ----- |
| npm        | zod     | 3.25.76 | 4.3.6 |

* fix: zod migration

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-18 07:37:50 +00:00
Sergei Zharinov 2b0e80b884 feat!: Switch to ESM modules (#40756) 2026-01-29 14:21:41 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
Michael Kriese f212641b42 chore: lint fix (#39630) 2025-11-29 13:31:19 +00:00
RahulGautamSingh 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
Johannes Feichtner 17293d503b feat(vulnerabilities): add support for CVSS 4.0 in OSV alerts (#35209) 2025-09-12 04:57:36 +00:00
Adam Setch 2180cd330c fix: CVSS4.0 vector parse exception - vulnerability severity fallback (#35003)
Signed-off-by: Adam Setch <adam.setch@outlook.com>
2025-03-25 13:55:45 +00:00
renovate[bot] 55845508b6 chore(deps): update eslint monorepo to v9 (major) (#33573)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-20 11:31:13 +00:00
renovate[bot] c26f836fb5 build(deps): update dependency @renovatebot/osv-offline to v1.6.0 (#34301)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-19 08:26:17 +00:00
RahulGautamSingh b3bd91be5c feat(logger): replace INFO with DEBUG logs (#33478) 2025-01-16 09:11:05 +00:00
RahulGautamSingh 0d23707604 refactor(logger): remove templating from WARN log messages (#33488) 2025-01-14 13:03:05 +00:00
Janus Troelsen 1caffcc310 feat(vulnerabilities): Add Hackage support (#33328)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-01-01 21:17:44 +00:00
Johannes Feichtner fbdb8c2478 fix(vulnerabilities): do not force exact patch version for NuGet datasource (#31127) 2024-08-31 12:53:22 +00:00
Sebastian Poxhofer 3681b2a945 chore: eslint to enforce for typed imports (#30844) 2024-08-19 13:15:27 +00:00
renovate[bot] eb8c08079e chore(deps): update typescript-eslint monorepo to v8 (major) (#30750)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-08-14 10:33:02 +00:00
Johannes Feichtner 26337ac124 fix(vulnerabilities): do not force exact patch version in OSV alerts (#29666) 2024-06-15 06:27:04 +00:00
Johannes Feichtner 88ab15c022 fix(vulnerabilities): describe last_affected version as ecosystem-specific version constraint (#27363) 2024-02-16 17:22:37 +00:00
Michael Kriese 179da735b6 fix(osv): trim github token prefix (#27361) 2024-02-16 16:13:49 +00:00
Jarek Porzucek 16c7b94e60 feat(osv): pass GitHub token for DB download (#26808)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-01-26 20:21:53 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Rhys Arkins 36e2b328bb chore: update types reference 2023-08-15 11:31:15 +02:00
renovate[bot] fe739befbf chore(deps): update linters to v6 (major) (#23325)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-08-02 15:07:49 +00:00
Sergei Zharinov 45328c57b6 refactor: Extract datasource result filters to separate file (#23587) 2023-07-28 08:09:41 +00:00
Adam Setch 1c82218197 feat(vulnerabilities): handle medium and unknown severities (#22257)
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2023-05-16 15:38:23 +00:00
Adam Setch a2e036e334 feat(vulnerabilities): set, maintain and expose vulnerabilitySeverity for templated fields (#21939) 2023-05-11 15:00:20 +00:00
Sebastian Poxhofer 75a1ab04eb refactor(vulnerabilities): return interface for Vulnerabilities (#21310) 2023-04-18 09:07:36 +00:00
Sebastian Poxhofer 9d2871085c refactor(vulnerabilities): rename fetchVulnerabilities to appendVulnerabilityPackageRules (#21468) 2023-04-12 20:34:13 +00:00
Johannes Feichtner 08466a1668 fix(vulnerabilities): skip withdrawn security advisories (#21294) 2023-04-03 04:39:48 +00:00
Rhys Arkins cc33d34ca8 refactor: PackageFile types (#20498)
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-02-20 14:58:49 +00:00
Johannes Feichtner 199124225b fix(vulnerabilities): prevent exception due to invalid OSV event version (#20512) 2023-02-20 09:43:40 +00:00
Rhys Arkins 3cef2f2e4f refactor: PackageFile -> PackageFileContent (#20502) 2023-02-19 12:43:48 +00:00
Johannes Feichtner a9ef562eff feat(vulnerabilities): add additional severity indicators and improve layout (#20363)
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
2023-02-13 18:00:36 +00:00
Johannes Feichtner a91ca62b46 feat(vulnerabilities): add feature-flagged support for OSV (#20226)
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-02-10 10:13:47 +00:00
Jamie Magee dc663e131a chore: migrate to @renovatebot/osv-offline (#17799) 2022-09-16 13:32:25 +02:00