Commit Graph

33 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
Michael Kriese c953fafcdc fix(platform/github): abort branch update when PR is in merge queue (#45252)
* fix(platform/github): skip PR update when PR is in merge queue

Updating a PR that is queued for merging can remove it from the merge
queue. Check the PR's merge queue status via GraphQL before updating
and skip the update if it is queued. The check is skipped on GHES
<3.12.0 and fails open on errors.

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

* fix(platform/github): dequeue PR from merge queue instead of skipping update

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

* docs(platform/github): note re-queue behavior after dequeue

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

* refactor(platform/github): dequeue merge queue PR in commitAndPush

Dequeue on push instead of on PR metadata update, since pushing to the
branch is what invalidates the queued merge result.

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

* refactor(platform/github): extract dequeuePr to pr.ts

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

* fix(platform/github): abort branch update when PR is in merge queue

Instead of dequeueing the PR, throw PR_ALREADY_IN_MERGE_QUEUE from
commitAndPush and handle it gracefully in processBranch.

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

* feat(platform/github): check merge queue enablement per base branch

Cache merge queue enablement per base branch like branchForceRebase and
skip the per-PR merge queue check when the base branch has no merge
queue. Errors are treated as enabled.

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

* feat(platform/github): fetch default branch merge queue status in initRepo

Include mergeQueue in repoInfoQuery so no extra query is needed for the
default branch, stripping it on GHES <3.12.0 like other unsupported
fields.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 07:05:12 +00:00
Michael Kriese e438887dfb build: lazy load and initialize logger (#41425)
* build: lazy load initialization modules

* build: lazy load and initialize logger

* chore: lint fix

* Update lib/constants/error-messages.ts

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

* Apply suggestion

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

---------

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
2026-03-10 16:57:29 +00:00
Jamie Tanna ef09ba01c9 fix(types): correct comments for error types (#40202)
This was incorrectly added to all types as part of
58d6f4125b.
2025-12-29 17:40:59 +00:00
Jamie Tanna 58d6f4125b fix(types): make result a strong type (#39783)
As a way to make it more predictable what the possible states the
`result` in a given `Repository finished` log message can be, we can
wrap these into a type.

This requires a slight refactor where these are used to make sure that
Typescript is happy with the value being returned.

We can capture the common groups of errors (which are then present as a
`RepositoryResult`) and expose that to be used.
2025-12-08 18:17:54 +00:00
RahulGautamSingh 5adb95593f feat(config): variables (#35350) 2025-07-06 07:24:33 +00:00
Rhys Arkins e4ab753d88 feat(config): inheritConfig (#27864)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
2024-03-23 08:12:36 +00:00
Rhys Arkins 3bdd530ae5 feat: forkCreation (#27686) 2024-03-02 10:42:43 +00:00
Rhys Arkins 2caf0b304b fix(github): skip forked repos when in fork mode (#27684) 2024-03-02 07:16:07 +00:00
Rhys Arkins 43fa615e05 fix: Revert "feat(github): forkOrgs, forkCreate (#18770)"
This reverts commit 2f77695ba5.
2023-06-19 15:10:21 +02:00
Rhys Arkins 2f77695ba5 feat(github): forkOrgs, forkCreate (#18770)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2023-06-19 03:29:32 +00:00
RahulGautamSingh 04f4875865 fix(platform): handle unexpected github-graphql error (#22512)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-05-31 16:03:28 +00:00
Gabriel-Ladzaretti d88d63b4f9 feat(config-error): raise a warning issue for misconfigured matchConfidence (#22296)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2023-05-18 17:02:13 +00:00
Maron 6246a61bf4 fix(datasource/docker): Docker tags list for library images not working (#16509) 2022-07-25 08:23:42 +02:00
Sergei Zharinov d0fe5f904e feat(fs): Scope checks for filesystem functions (#16511) 2022-07-14 07:53:26 +00:00
Yun Lai 793095c1a0 fix(git): add options to getRepoStatus (#16253) 2022-07-06 05:17:39 +00:00
Maximilian Brandau 7e425e6045 feat: gitUrl global option (#11221) 2021-08-20 11:30:56 +00:00
Rhys Arkins cbf8ea4e55 feat(config): delay preset resolution until after platform initialization (#9415)
Delay config preset resolution in admin config until after platform initialization. This will enable resolution of private “local>…” presets to work.

BREAKING CHANGE: Config presets will be resolved after platform initialization, so from now on platform credentials cannot be placed in presets.
2021-04-22 08:47:58 +02:00
Rhys Arkins af1e4ee1a7 feat: secrets (#8070) 2021-03-22 15:51:38 +01:00
Rhys Arkins 948039d52b refactor: INTERRUPTED -> TEMPORARY_ERROR 2021-03-07 21:40:40 +01:00
Rhys Arkins 1b673c9573 fix: abort branch if child process receives SIGTERM (#8992) 2021-03-04 21:27:21 +00:00
Rhys Arkins fa9031f5e9 feat(internal): expand disabled error messages
Splits REPOSITORY_DISABLED into multiple
2021-02-11 13:32:29 +01:00
Rhys Arkins 116693be64 fix: Revert "feat: secrets" (#8069)
This reverts commit ec1b3c386b.
2020-12-18 15:33:21 +01:00
Rhys Arkins ec1b3c386b feat: secrets (#6664) 2020-12-18 13:38:28 +01:00
Rhys Arkins e95bd0ba3d feat(host-rules): add support for disabling hosts (#6715)
* feat(host-rules): support disabling hosts

Adds “enabled” to the list of recognized configuration options for hostRules. A host or domain can be disabled by setting `”enabled”: false` within the host rule. Also added presets :disabledHost() and :disableDomain().

* docs

* tests

* Update configuration-options.md

* fixes
2020-07-09 17:34:26 +02:00
Rhys Arkins 926a553a76 fix: sanitize commitMessage, prTitle, branchName
In preparation for secrets PR
2020-07-03 16:52:16 +02:00
Rhys Arkins 031ad87b62 refactor: move ExternalHostError 2020-06-23 11:44:52 +02:00
Rhys Arkins 52a074e041 refactor: ExternalHostError (#6563) 2020-06-22 21:28:02 +02:00
Rhys Arkins efb851ae6a feat: write git private key (#6321)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2020-05-29 12:46:21 +02:00
Rhys Arkins 44c9933e99 fix(bundler): raise PR for unknown errors 2020-04-27 23:29:46 +02:00
Rhys Arkins f97b194515 fix: gracefully catch and handle out of memory 2020-04-16 18:08:53 +02:00
Rhys Arkins da31f5d160 fix(bundler): generate PRs for incompatible packages lockfile errors 2020-01-15 04:53:59 +01:00
Sourav Das ee153e560e feat: use error constants (#5088) (#5100)
Use defined error constants throughout codebase.
2020-01-12 08:50:11 +01:00