Commit Graph

37 Commits

Author SHA1 Message Date
Jamie Tanna 4732da7d2b fix(util/host-rules): apply the admin's headers over a repository's
As part of changes we've recently made to the merging of
`hostRules[].headers`, it highlighted that a repository - or a preset
it extends - could lead to a header an admin has configured for one host
to be sent to another.

This happened due to the way we additively merged i.e.
`Object.assign({}, ...matchedHeaders)`.

This doesn't require the repository to know a credential is being
set (for a specific host), or to act maliciously - any header of their
own for that host is enough to bring the administrator's masked one
back, with nothing logged or failing to show it happened.

To fix this, we can:

- apply admin headers last, as they are "trusted"
- stop repositories from being able to unset an admin-set header
- retain the existing logic for the "most specific rule" being used
- make sure that `trusted` isn't a field that could be injected by a
  repository, and make sure we explicitly only set it where we know
  we're using self-hosted administrator config
- make `filterAllowedHeaders` drop `headers` if every header name was
  denied, so `{}` isn't returned and used to suppress headers when
  merged

Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
2026-09-03 08:01:41 +01:00
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
Sebastian Poxhofer 73b90e958b refactor: remove string concetation for production code (#43442)
refactor: prefer templates rather than `+`
2026-05-19 13:31:27 +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 c641239c19 fix: use stricter types for renovate config (#39594)
* fix: use stricter types for renovate config

* fix: revert changes

* Apply suggestions from code review
2025-11-28 13:16:27 +00:00
RahulGautamSingh 5adb95593f feat(config): variables (#35350) 2025-07-06 07:24:33 +00:00
Sergei Zharinov 8d183d6b25 feat(http): Force default rate limits for some known hosts (#30207)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-07-22 16:59:29 +00:00
Gabriel-Ladzaretti 3bcd779e46 fix(merge-confidence): fix initialization (#29300) 2024-05-28 12:50:29 +00:00
Rhys Arkins 4bfd0f304e fix: Revert "feat: Limit HTTP concurrency and frequency by default" (#27765) 2024-03-07 08:01:34 +00:00
Sergei Zharinov 147d38a2a4 feat: Limit HTTP concurrency and frequency by default (#27621) 2024-03-05 14:50:09 +00:00
Sergei Zharinov c30a4b0b54 feat(logger): Log level remapping (#26951)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-02-16 20:06:11 +00:00
Florian Greinacher 83b545fc23 feat: add option to disable access to cloud metadata services (#26411) 2024-01-12 16:30:43 +00:00
Yun Lai 94fddc0508 fix(host-rules): call set global host rules before init platform (#25521) 2023-11-10 09:38:33 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Jamie Magee 176282e65f chore: use node: protocol imports (#21181) 2023-03-28 21:05:36 +00:00
Rhys Arkins 623f2cadd9 feat: customize merge confidence host (#21061)
Co-authored-by: Gabriel-Ladzaretti <97394622+Gabriel-Ladzaretti@users.noreply.github.com>
2023-03-21 11:16:36 +00:00
RahulGautamSingh af3b2038f8 refactor: replace enums with union/object (#18903) 2022-11-14 20:55:38 +02:00
Rhys Arkins f764f8879c feat(config): containerbaseDir (#17414) 2022-08-25 15:43:06 +00:00
Rhys Arkins ee6287971d refactor: use containerbase not buildpack terminology (#17398) 2022-08-25 06:59:55 +00:00
Michael Kriese 4f82df4c3d feat(buildpack): enable cache (#16591) 2022-07-21 07:00:02 +00:00
Rhys Arkins 54c35dbbd4 fix(config): apply secrets to global hostRules (#16217)
* fix(config): apply secrets to global hostRules

Closes #16215

* fix import ordering

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-06-24 08:21:08 +00:00
Sergei Zharinov 0cf4f48842 refactor: Strict null checks for all files except tests (#16071)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-06-20 11:47:07 +02:00
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00
Rhys Arkins b0d4012c45 fix(presets): set global host rules before validating presets (#14213) 2022-02-14 17:30:49 +00:00
renovate[bot] 995dd0e670 build(deps): update dependency redis to v4 (#13260)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2022-01-19 06:05:23 +00:00
Oleg Krivtsov 3fa21fbf83 feat(workers/global): check git at startup (#12935) 2021-12-08 13:11:43 +01:00
Rhys Arkins d0434d5df1 chore: GlobalConfig -> AllConfig 2021-06-02 11:25:10 +02:00
Rhys Arkins 15fde37535 fix: Revert "feat: validate git version" (#10106)
This reverts commit 1304bc930e.
2021-05-22 09:34:51 +02:00
Rhys Arkins 1304bc930e feat: validate git version (#9979) 2021-05-21 19:51:03 +00:00
Michael Kriese 74d7691bef refactor: optimize type usage (#8947) 2021-03-02 21:44:55 +01:00
Rhys Arkins d203def3d0 refactor: baseDir to global config 2021-02-05 22:35:03 +01:00
Sergei Zharinov c98a537f8b refactor(limits): Refactor global limits counter (#7931) 2020-12-11 09:26:47 +01:00
Rhys Arkins 5d99ff9862 refactor: convert all path to upath (#7712) 2020-11-12 21:46:08 +01:00
Sergio Zharinov 831c45397f refactor(limits): Concise implementation for workers/global/limits.ts (#7140)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2020-09-01 14:47:12 +02:00
Rhys Arkins be37109cf6 refactor: rename globalCache to packageCache (#6580) 2020-06-25 08:32:55 +02:00
Rhys Arkins f77b7e8781 refactor: simplify global init (#6452)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2020-06-22 17:00:46 +02:00