Commit Graph

66 Commits

Author SHA1 Message Date
Jamie Tanna 29a7b9c5f5 fix(util/http): allow blocking requests to internal hosts
To harden Renovate from being able to access internal hosts, we can add
a level of enforcement on all outgoing requests.

We can split this into two types of traffic:

- where the response becomes configuration (i.e. `extends`)
- where the response does not become configuration (i.e.
  `customDatasources`)

To harden this, we enforce on every outbound HTTP request:

- check the resolved URL before anything, including cache lookups, can
  proceed
  - catching IP-literal hosts in every spelling the WHATWG URL parser normalizes
  - blocking known Cloud metadata IPs, too
- a `dnsLookup` wrapper validates every address a hostname resolves to,
  on every new connection, which also defeats DNS rebinding
- a `beforeRedirect` hook re-runs the URL check on each redirect
  target, with the new host getting its own grant lookup rather than
  inheriting the original host's verdict

We default this enforcement to `warn`, to not break existing deployments
and instead give them visibility into required configuration before a
future major version (major+1) enables `block` by default.

We'll also remove allow in a future major version (major+2), to give
time for admins to migrate over.

When a request is blocked, this degrades like an unreachable registry,
so a Renovate run isn't aborted by a blocked request.

As part of this, we can also provide a worked example of the different
cases that do/do not need allowing via `hostRules`.

Requests through an admin-configured proxy resolve DNS at the proxy, so
`dnsLookup` never runs for them, so we can resolve the hostname locally
and validate every address before the request instead.

This doesn't catch everything, especially as the proxy may resolve the
name to a different result, and if we can't resolve the name - possible
in locked-down corporate environments - we fail open.

Child processes aren't currently able to route traffic through
Renovate's HTTP layer, so are unrestricted.

Co-authored-by: Claude Fable 5 <jamie.tanna+claude-code@mend.io>
Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-09-10 14:52:01 +01:00
Jamie Tanna b62fe59594 fix: remove references to "bot" (#39305)
We dropped the "bot" from our terminology long ago, but it looks like
we've got some outdated docs + code that reference it.

We should remove this to keep things consistent.

A `fix`, as we're changing the commit author's name, and log lines.

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-02 08:56:20 +00:00
Sebastian Poxhofer 874f3e3953 feat(presets): support relative paths inside a preset repo (#45211)
* feat(presets): support relative `extends` references inside presets

Presets which are fetched from a repository can now reference sibling
presets relatively, instead of repeating their own source, repository and
tag:

- `./x` resolves against the directory of the preset file with the
  reference
- `../x` resolves against the parent directory of that file
- `/x` resolves against the root of the preset repository

The source, repository and tag of the preset which holds the reference are
inherited, so `./system/registries` inside `github>org/repo#v2.0.0`
resolves to `github>org/repo//system/registries#v2.0.0`. A reference which
resolves to the `default` preset at the repository root is emitted in the
plain repository form, so `github>org/repo#v2.0.0`, which keeps it
deduplicated against the way consumers spell the very same preset.

A reference must stay inside its repository, its final path segment must
name a preset file rather than a directory, and it can carry parameters
but neither its own `#tag` nor a `:subPreset`. Parameters may contain a
Handlebars template, including a sub-expression such as
`./group({{ lower (env.TEAM) }})`, while a templated path cannot be
resolved and is left alone. A reference must also not carry a source
prefix, so strings such as `local>./x` or `github>../x` are rejected as
invalid.

References are canonicalized lazily, while the preset which holds them is
fetched in `getPreset()`, after migration and massaging. Only presets from
a repository hosted source, so `github`, `gitlab`, `gitea`, `forgejo` and
`local`, are walked. A relative reference which has no parent preset, for
example in a repository config, an inherited config or in `globalExtends`,
is reported as a validation error for that entry.

Relative entries of a preset's `ignorePresets` are resolved in the same
way, so a preset can neutralize a preset which it references relatively,
as long as the consuming repository does not set `ignorePresets` itself.
A reference which cannot be resolved is kept raw and logged, which lets
consumers neutralize it with `ignorePresets`, and it only fails per entry.

Because relative references cannot be resolved while a config is
validated, they are stripped from a `packageRules` entry before its
presets are resolved. A rule which is then left without any selector is
reported as a warning rather than as an error, since the stripped preset
may still provide the missing selectors. Rules without relative references
keep failing hard as before.

The `renovate-config` manager reports relative and unparsable `extends`
entries with a skipReason, instead of dropping them, and ignores templated
entries which can only be resolved at runtime.

Behavior change: an `extends` string which starts with `./`, `../` or `/`,
such as `./x`, `../x` or `/x`, is now read as a relative reference. Before
it was parsed as a local repository name, which in rare cases could
accidentally resolve through the dot segment normalization of the request
URL. For the same reason a source prefixed relative looking string, such
as `local>/org/repo`, `github>./x` or `npm>./x`, is now rejected as an
invalid preset.

* fix(presets): parse scoped npm presets with explicit `npm>` prefix

`npm>@scope/name` was parsed as a local preset, because the heuristic for
local presets matched before the `npm>` prefix was stripped.

Every other use of `npm>` keeps its current behavior, so `npm>foo` still
falls back to the npm package `renovate-config-foo`, `npm>owner/repo` is
still resolved as a local preset and nested prefixes such as
`local>npm>foo` keep working.

* refactor: remove duplicated preset source

* docs: streamline new docs

* add more docs for skipReason and add requested changes

* Apply suggestions from code review

Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>

* test(presets): drop object literal type casts in relative preset spec

---------

Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
2026-08-13 13:54:50 +00:00
Jamie Tanna 128f446e08 docs: ensure that config in documentation is error and warning free (#43727)
* docs: skip validation on JSON files that aren't Renovate config

As part of future changes, we'll enable validation on all JSON code
snippets to run Config Validation.

Before we do that, we should opt-out JSON snippets that aren't anything
related to Renovate config.

* docs: don't validate invalid Renovate config

As it's intentionally referencing a manager that doesn't exist.

* docs: don't validate partial Renovate config

As part of future changes, we'll enable validation on all JSON code
snippets to run Config Validation.

There are several code snippets we have that are part of a Renovate JSON,
but it doesn't make sense to convert these to a fully passing config, as
it'd reduce clarity on what we're trying to explain.

* docs: convert `baseBranchPatterns` snippets to code blocks

So we can validate them.

* docs: make sure that `datasourceTemplate` is set

So this passes validation.

* docs: clarify that `force` is global config

As it may not be clear, so we can make it extra clear with a `.js` file,
and note that it's global self-hosted config.

* docs: make sure `packageRules` is an array

* docs: `matchBaseBranches` needs `baseBranchPatterns` to be set

* docs: correct typo for `prBodyColumns`

* docs: mark global config snippets as such

As part of future changes, we'll use this to detect whether it's global
self-hosted configuration.

* docs: make sure `packageRules` wraps its children

* docs: add `allowedHeaders`

* docs: ignore deprecation warnings

As part of future changes, we'll use this to note that we don't care
about the validation warnings.

* docs: make sure `customManagers` wraps its children

* docs: make sure `fleet` wraps its children

* docs: validate JSON snippets are valid Renovate config

To make sure that we're always presenting valid JSON configuration to
our users, we can validate them as part of `check-fenced-code`.

As well as configuration errors we can warn for warnings, but allow code
blocks to opt-out, for instance when there's a known deprecation
affecting the code block.

We need to make sure to set `allowedEnv` for various code snippets that
reference environment variables.

* docs(development): document fenced code block checks

* docs: wrap `configType` and `ignoreConfigWarnings` in `{ ... }`

As otherwise we see build failures i.e.

    WARNING -  Doc file 'modules/platform/gitlab/index.md' contains a link
       '../../../self-hosted-configuration.md#autodiscoverrepoorder', but the doc
       'self-hosted-configuration.md' does not contain an anchor '#autodiscoverrepoorder'.

This needs to be wrapped alongside all other options like `title`.

* fixup! docs: wrap `configType` and `ignoreConfigWarnings` in `{ ... }`
2026-06-02 13:29:48 +00:00
Jamie Tanna bc1850c5cb docs(presets): clarify local> usage (#43679) 2026-06-01 08:31:45 +00:00
Jamie Tanna 0ccf83253f feat(presets): support fetching .jsonc files (#43680)
* test(presets): validate filename construction

Ahead of future changes to add JSONC support, we should cover explicitly
how the filename is constructed.

* feat(presets): support fetching `.jsonc` files

Similar to 6fb540d494, as we now support a
`.jsonc` file for configuration, we should make sure that we can also
use it for a preset.

We can also add additional tests across a few presets to make sure that
we have sufficient coverage.
2026-05-29 15:10:13 +00:00
Sebastian Poxhofer 9a27d7aa78 ci(prettier): add prettier plugin for admonitions (#43615)
* ci: add local mkdocs-admonitions plugin for prettier to allow admonition preservation

* docs: remove uses of `prettier-ignore` for admonitions

* test: rather use await expect

* chore: use named group exclusively
2026-05-27 09:39:52 +00:00
Jamie Tanna 4b0146ab7b docs: use 2-space indentation for Markdown (#43537)
As noted in #39090, MkDocs requires 4 spaces for indentation (in
particular, for nested lists) whereas our Prettier/markdownlint
configuration expects 2 spaces.

This means that when trying to use i.e. nested lists, we need to ignore
prettier and markdownlint, otherwise it fails.

To handle this, we can add a Markdown hook to override the indentation
level to 2 spaces.

This also requires we update:

- admonitions
- indented text in `index.md`

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
2026-05-26 09:05:42 +00:00
Anne Stellingwerf 9fae0192a1 docs: introduce JSON schema validation and migration checks (#38145)
* docs: introduce JSON schema validation and migration checks

* refactor(tools): enhance code clarity with additional typings, comments, and optional chaining

* ci(workflows): add build steps to lint and type-check jobs

* Update tools/check-fenced-code.mjs

Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>

* Partial revert

* docs(jsonata): fix wording in code block title in readme

* ci(workflows): remove redundant build steps from workflows

* ci(workflows): remove redundant build steps from workflows

* refactor(tools): simplify error reporting

* Incorporate feedback

* Incorporate feedback

* Incorporate feedback

---------

Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
2025-10-07 10:54:48 +00:00
Rhys Arkins 93fa41b26f chore: remove rarkins from maintainers (#37585)
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
2025-08-29 08:36:42 +00:00
Patrick Schratz 6c2bd9d197 feat: add forgejo as a standalone platform (#37075)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-07-21 14:24:07 +00:00
Aleksandr Mezin e49d205448 feat(presets): substitute entire parameter string for {{args}} (#36771) 2025-07-02 19:30:17 +00:00
RahulGautamSingh 8c7e931da3 feat(config)!: support jsonc in existing config + preset files (#36141)
Use JSONC parser for JSON config files.

Renovate will now officially support JSONC syntax in config files which are either explicitly (e.g. `renovate.json`) or implicitly (e.g. `.renovaterc`) JSON files.
You may continue using "pure" JSON in such files, or use JSONC syntax instead (e.g. trailing commas, comments).
Support for files ending in `.jsonc` will be added soon.

Note: this is not technically a breaking change as it is backwards-compatible with existing JSON support.
2025-06-19 11:01:54 +02:00
Risu 865ce91f72 docs(config-presets): use inline code for preset patterns (#32622) 2024-11-19 16:27:54 +00:00
Benjamin Richardson ebf7f56ca5 docs: fix typo in json example in config-presets.md (#30467) 2024-07-30 05:03:51 +00:00
lstoeferle 91e8a86e2e feat: allow templating of the extends field (#27955)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2024-05-14 12:18:20 +00:00
Rhys Arkins 9d0c425e10 docs: clarify preset file name recommendations (#28443)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-05-05 07:47:40 +00:00
RahulGautamSingh 14899d836d docs: typos and american spellings (#28215)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2024-04-04 07:16:15 +00:00
Aleksandr Mezin a9a33dd94d feat(presets): fetch presets from HTTP URLs (#27359) 2024-02-24 07:16:34 +00:00
Valen Varangu-Booth eea63ff779 feat(onboarding): search parent groups for presets (#25856)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-12-14 15:45:54 +00:00
Michael Kriese 4b7a5e7b62 docs: use relative links (#26044) 2023-11-29 18:10:17 +00:00
Rhys Arkins 3a0adb033a docs: clarify monorepo preset contribution 2023-10-19 12:30:50 +02:00
HonkingGoose 76c9c63417 docs: use simple words (#23989) 2023-08-22 14:07:21 +02:00
Michael Kriese f9e3e80e0c feat(presets)!: rename config:base to config:recommended (#21136)
Closes #12024

Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Bastian Gutschke <bastian.gutschke@gmx.de>

BREAKING CHANGE: Preset config:base is now called config:recommended
2023-07-04 19:21:52 +02:00
HonkingGoose e8c5fa6e57 docs: explain how to use presets (#21534)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-04-17 13:59:21 +00:00
Róbert Papp bd497257b3 docs: refresh links around presets (#21484) 2023-04-13 13:42:22 +00:00
Bryan Shell ae9cc2845e docs(preset): add examples for paths without tags (#18610) 2022-10-30 07:51:48 +02:00
HonkingGoose dc4e0dd772 docs(shareable config presets): partial rewrite (#16521) 2022-07-25 07:59:40 +02:00
HonkingGoose 4002f1bc04 docs: create key concept page for presets (#15396) 2022-05-09 13:17:40 +02:00
Oscar Dominguez e218379958 feat(presets): add support to presets ending with .json5 or .json (#15377)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-05-02 16:34:09 +02:00
HonkingGoose 5a52b04c96 docs: replace contain(s) with has or have (#14692) 2022-03-16 14:50:20 +01:00
Rhys Arkins b7eab64efb feat(config): deprecate non-default npm presets (#14444)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2022-02-28 15:14:58 +01:00
HonkingGoose b083d508eb docs: add admonition for deepExtract deprecation (#13904) 2022-01-28 21:00:28 +01:00
HonkingGoose d3e7e3caa9 docs(config-presets): use admonitions (#13671) 2022-01-28 12:19:57 +01:00
Michael Kriese ce241e170c docs(presets): fix samples (#13029) 2021-12-09 12:44:47 +01:00
Michael Kriese baaea71728 fix(config/preset): readd subpreset support (#12733) 2021-11-18 10:45:17 +01:00
Nejc Habjan 34f13fee3e test: enforce valid JSON in fenced markdown code blocks (#12196) 2021-11-11 11:11:55 +01:00
Michael Todorovic 7579875415 feat: support preset versioning with git tags (#11565)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>
2021-11-05 13:12:47 +00:00
biergit 7869d6dcb6 feat(bitbucket): support user repo for preset (#12281) 2021-10-31 06:57:52 +00:00
HonkingGoose fe45377b6d docs: fix display style of word ESLint (#11689) 2021-09-12 16:09:08 +02:00
Mathias Brodala e3778043c1 Mention access level for private GitLab repositories (#11357)
With a Guest level access Renovate is not able to access the repository.

See https://docs.gitlab.com/ee/user/permissions.html
2021-08-20 10:50:37 -07:00
HonkingGoose aef018da22 fix: deprecate use of renovate.json as preset (#10678)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2021-07-08 15:04:04 +00:00
HonkingGoose 5f325748b1 docs: shareable configs only work with JSON format (#10100)
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2021-05-21 16:16:22 +00:00
HonkingGoose 021e16bf6b docs: use monospaced text for renovate-config reference (#9840) 2021-05-04 09:37:18 +02:00
HonkingGoose 75b5e9d6b3 docs: master branch -> main branch, default branch -> base branch (#9808)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2021-05-03 07:34:15 +00:00
HonkingGoose 43907c1696 docs: update preset hosting docs (#8591)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2021-04-22 13:45:42 +00:00
Clément Tessier 44c8508311 docs: fix preset typo (#9555) 2021-04-14 17:04:38 +02:00
Sergei Zharinov b160644db7 feat(preset): Support Azure local presets (#9458) 2021-04-08 19:49:46 +02:00
Sergei Zharinov 0a68e19d73 feat(presets): Support Bitbucket Cloud local presets (#9422) 2021-04-07 11:14:45 +02:00
Armaan Tobaccowalla e5c92e4cd9 feat(config): Support presets in subdirectories (#8724) 2021-03-20 23:03:10 +00:00