Commit Graph

55 Commits

Author SHA1 Message Date
Jamie Tanna c98f4f71c8 fix(util/host-rules): enforce allowedHeaders within add()
We previously enforced `allowedHeaders` by making sure that each
`hostRules.add()` call had `filterAllowedHeaders`.

This isn't super future proofed, and although we could add a linting
rule, we should instead enforce this by making sure that
`hostRules.add()` applies the filtering.

This also catches cases like host rules from `.npmrc` which wasn't
currently being filtered - albeit there was no means to bypass
`allowedHeaders`.

Moving `filterAllowedHeaders` into `lib/util` removes a dependency from
the global bootstrap and `config-validator` importing from
`lib/workers/repository/init/`.

While doing so, we can also make sure that:

- we log only one WARN for global `hostRules` being invalid, rather than
  once per `repositories[]`
- `renovate-config-validator` validates a global config file's
  `hostRules` against that file's own `allowedHeaders`, like a real run
  would after parsing it

Co-authored-by: Claude Fable 5 <jamie.tanna+claude-code@mend.io>
2026-09-03 08:01:41 +01:00
Jamie Tanna 432bb00cd2 fix(workers/global): enforce allowedHeaders for the admin's own hostRules
For some time, admin configuration for `hostRules[].headers` was
enforced through `allowedHeaders`, but no validation feedback was given
to administrators, as it was silently ignored when `applyHostRule` runs.

To provide visibility to administrators who were setting headers that
were silently being ignored, we can instead provide validation at the
time we set our global host rules.

In a future change, we'll align the behaviour of `allowedHeaders` and
`allowedEnv` to make it so admin-controlled `hostRules` aren't bound by
the `allowedHeaders` flag.

We can also make it clear in the documentation that this is the
behaviour.

Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
2026-09-03 08:01:41 +01:00
silverwind 11a217ea2e fix(config-validator): warn when RE2 is not in use (#44894)
* fix(config-validator): warn when RE2 is not in use

Without RE2 the validator checks patterns with the JS RegExp engine, which
accepts syntax RE2 rejects, so configs can validate clean here and then be
rejected when Renovate runs.

Co-Authored-By: Claude (Opus 5) <noreply@anthropic.com>

* fix(config-validator): debug log for the RE2 opt-out

Setting RENOVATE_X_IGNORE_RE2 is deliberate, so it does not warrant a warning,
matching what the global worker already does.

Co-Authored-By: Claude (Opus 5) <noreply@anthropic.com>

---------

Co-authored-by: Claude (Opus 5) <noreply@anthropic.com>
Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
2026-07-30 11:00:48 +00:00
Sebastian Poxhofer c41b46bac3 feat(logging): do not use dynamic fields in log messages with severity WARN or higher (#44560)
* ci(linter): add renovate/logger-static-message rule

Adds a custom oxlint rule that enforces a static msg component for
logger.warn/error/fatal calls (including logger.once variants) so the
messages can be grouped in metrics and error catching services, per
docs/development/best-practices.md. It also flags metadata properties
named 'error' that hold error-ish values, because the bunyan serializer
only handles the 'err' key.

The rule is enabled as an error for lib/ production code and disabled
for spec files. All 33 pre-existing violations are fixed by moving
interpolated values into the metadata object, making messages static,
and renaming 'error' metadata keys to 'err'. Affected log-message
assertions in co-located specs are updated accordingly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci: ignore validator output

* fixup new merged in log messages

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 06:53:37 +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
Jamie Tanna e1e5c398e0 chore: ensure we use productLinks for docs site links where possible (#44066)
* chore: ensure we use `productLinks` for docs site links where possible

Where possible, we should be making sure that we're using the
`productLinks`' configuration for  the documentation site, especially
where self-hosted users may create a mirror of their docs[0].

To make sure we catch this in the future, we can introduce a custom
linting rule with Oxlint to enforce this.

Where we (currently) can't wire in the config, we can disable it against
that line.

[0]: https://www.jvt.me/posts/2024/11/19/renovate-private-docs/

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

* fixup! chore: ensure we use `productLinks` for docs site links where possible

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

* fixup! chore: ensure we use `productLinks` for docs site links where possible

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

---------

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
2026-06-18 08:55:27 +00:00
Jamie Tanna 16c4b9348e fix(config-validator): correctly warn when no files are being validated (#43732)
As this was previously firing if `returnVal !== 0`, even if there were
files being validated.
2026-06-02 11:10:24 +00:00
Sebastian Poxhofer a1772c2a02 ci: do not allow nested tenary operators (#43600) 2026-05-26 17:36:20 +00:00
Jamie Tanna 46d996b2b0 chore(config-validator): make it clearer how many file(s) are being validated (#43284)
As noted in #43280, there may be cases where users attempt to perform
config validation via stdin, or in a directory that doesn't contain any
configuration files, and it may be unexpected to see that the `Config
validated successfully`, if we didn't actually process anything.

To improve this, we can track how many file(s) are being validated, and
more visibly note when 0 files have been validated.
2026-05-18 16:04:20 +00:00
Peter Tripp c3bd57bde8 fix(config-validator): Allow warnings to flush before process.exit (#43327) 2026-05-13 17:13:42 +00:00
Michael Kriese a75daaf9e6 chore(config-validator): log config migration diff (#43123) 2026-05-11 15:02:26 +00:00
Michael Kriese b651a176ff fix(config-validator): initialize host rules (#43124) 2026-05-06 18:15:29 +00:00
Jamie Tanna 31562cb128 fix: correctly initialise logger for renovate-config-validator (#41844)
As part of changes in e438887dfb, we'd
missed the `renovate-config-validator` logging.
2026-03-12 12:42:16 +00:00
Jamie Tanna 98523e23e8 fix(renovate-config-validator): don't error on --version (#41669)
As noted in #41667, we didn't correctly handle the `--version` flag's
code coming back, so were unnecessarily reporting an error.

Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io>
2026-03-04 17:05:30 +00:00
Michael Kriese ea089ac660 build: lazy load initialization modules (#41408)
* build: lazy load initialization modules

* test: fix otel test

* test: drop unused
2026-02-23 14:17:18 +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
Jamie Tanna 239b94f655 feat(renovate-config-validator): detect global environment options (#40534)
feat(renovate-config-validator): automagically detect global configuration

A long-standing issue with `renovate-config-validator` has been that
setting global configuration options such as `RENOVATE_ALLOWED_ENV` or
`RENOVATE_ALLOWED_COMMANDS` has no effect.

To make it possible to validate alongside the `config.js` (or other
self-hosted global configuration) as well as setting environment
variables while performing validation, we can ensure that we partially
initialise the `GlobalConfig`.

We can also make sure that this is documented as part of this change.

Functionality such as authenticating to the platform to retrieve remote
presets will be done at a future point.
2026-01-22 19:58:12 +00:00
Jamie Tanna 9a4ae7ae31 feat(renovate-config-validator): add --no-global flag (#40547)
As we want to be able to wire in Global Configuration (i.e. from a
`config.js` or environment variables) in the future, we need to first
make sure that we first make it possible to specify whether a specific
file is global or repo config.
2026-01-21 16:51:20 +00:00
Jamie Tanna 2a8c345a3c fix(renovate-config-validator): refactor to use Commander (#40529)
As part of recent proposed changes with `renovate-config-validator`,
we've found that before new changes are made, we should align
`renovate-config-validator` with `renovate` in using Commander for a
lightweight framework for command-line applications.

As a replacement for #39953, we can introduce a more targeted help
message, providing more examples about usage.

We also introduce `@commander-js/extra-typings` to make sure that we
have better types for the `action` function.

We also need to make sure we call `parseAsync`, as we're using an
`async` function.
2026-01-20 08:02:15 +00:00
Sergei Zharinov fe1573fed9 chore(lint): add oxlint for faster syntax linting (#40236)
feat(lint): add oxlint for faster syntax linting

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-01-13 14:43:43 +00:00
RahulGautamSingh a86b32ea0f feat: configurable repo config filenames (#36644)
* feat: configurable repo config filenames

* docs: configFileNames

* fix tests

* update tests

* fix coverage

* Apply Suggestions

* refactor: remove platform-based filename filtering

* docs

* refactor

* docs: add note for config-validator use

* feat: add inherited config support

* fix: build

* fix lint

* fix test
2025-10-20 06:19:01 +00:00
RahulGautamSingh 37a1a93a06 refactor(config): move code for easier testing (#37297)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-08-04 15:04:55 +00:00
RahulGautamSingh 49fa1be464 feat(util): getEnv (#35161)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-05-06 18:37:28 +00:00
Michael Kriese bb5377b3d8 test: fix code coverage (#34495) 2025-02-26 12:40:30 +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
Michael Kriese 41ba7c3025 fix: overide punycode built-in module (#32502) 2024-11-13 14:55:29 +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
Rhys Arkins 49971b9af1 refactor(config): use enum for config type (#27891) 2024-03-13 05:11:40 +00:00
RahulGautamSingh 6b41552bbd feat(config): warn if globalOnly option found in repo config (#24561)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-01-16 10:42:26 +00:00
Michael Kriese 5fed6d1cdb fix: Revert "feat(config-validator): throw an error when the config cannot be found" (#25861) 2023-11-19 10:52:25 +00:00
Bryan Lee 9b33fee639 feat(config-validator): throw an error when the config cannot be found (#23815)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-11-15 21:01:37 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Florian Greinacher c38e46f34b fix(config-validator): don't ignore arguments after --strict option (#23813) 2023-08-11 05:26:00 +00:00
Florian Greinacher 7b7670c2e4 feat(config-validator): add --strict option (#23677) 2023-08-03 12:26:43 +00:00
RahulGautamSingh 444ea13dd5 refactor: remove string interpolations (#22840)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-06-24 09:32:50 +00:00
Michael Kriese c00732f262 chore: replace shelljs (#21870) 2023-04-28 12:17:48 +00:00
Michael Kriese 2aa461a9db feat: add source-map support (#19551) 2022-12-23 12:12:32 +00:00
Maxime Brunet cbe8bfc4cf feat(config-validator): read filenames from CLI arguments (#16475) 2022-08-04 06:25:18 +00:00
Michael Kriese ef470f7f92 feat(config): parse json files as json5 (#15187) 2022-04-29 08:34:55 +00:00
Nejc Habjan 9aa97af5b3 feat(config)!: parse JSON5/YAML self-hosted admin config (#12644)
Adds support for alternative admin config file formats.

BREAKING CHANGE: Renovate will now fail if RENOVATE_CONFIG_FILE is specified without a file extension
2021-12-09 13:45:48 +01:00
Nejc Habjan 0f1256317c refactor(config): use async readFile and dynamic import to load config file (#12649)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2021-11-17 06:49:53 +00:00
Rhys Arkins 982e36963d chore: re-enable eslint no-console 2021-11-09 07:48:31 +01:00
HonkingGoose ab018191fa chore: report and fix unused ESLint disable directives (#12548) 2021-11-08 20:20:03 +01:00
Rhys Arkins 11694e9294 refactor: move config/parse into global worker (#10282) 2021-06-02 12:06:16 +02:00
Rhys Arkins d4d0e74c7a refactor: dequal (#9071) 2021-03-10 23:04:12 +01:00
Michael Kriese 74d7691bef refactor: optimize type usage (#8947) 2021-03-02 21:44:55 +01:00
renovate[bot] 8ee891675f build(deps): update dependency json5 to v2.2.0 (#8554)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2021-02-05 11:48:47 +01:00
Michael Kriese e6d497a6ae fix(validator): wrong file name in logs (#8520) 2021-02-03 12:34:30 +01:00
Rhys Arkins c8cc447d61 fix(config-validator): migrate and massage before validating (#8503) 2021-02-03 10:35:30 +01:00