Commit Graph

67 Commits

Author SHA1 Message Date
renovate[bot] 2561284dc4 build(deps): update dependency got to v15 (main) (#43120)
* build(deps): update dependency got to v15

| datasource | package | from   | to     |
| ---------- | ------- | ------ | ------ |
| npm        | got     | 14.6.6 | 15.0.5 |

* chore: adapt code to breaking changes

* test: fix test

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: secustor <sebastian@poxhofer.at>
Co-authored-by: Michael Kriese <michael.kriese@mend.io>
2026-09-09 09:01:11 +00:00
Sebastian Poxhofer 3412de84ce refactor(linters): enable oxlint rule prefer-named-capture-group (#44714)
* refactor(lint): enable oxlint prefer-named-capture-group at error

Numbered capture groups (m[1], $1) break silently when a regex is
edited and group order shifts. Named groups (?<name>...) make intent
explicit and accesses (m.groups.name) resilient to reordering.

This enables the built-in eslint rule prefer-named-capture-group,
surfacing 321 pre-existing unnamed-group violations across ~121
files to be burned down incrementally in follow-up commits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(versioning): name capture groups for prefer-named-capture-group

Burns down all prefer-named-capture-group violations in
lib/modules/versioning/. Unused capture groups (only reachable via
.test() or whole-match) become non-capturing (?:...); groups whose
value is read become named (?<name>...), with accesses rewritten to
match.groups!.<name> (or destructured from .groups!) instead of
positional match[n]/$n so a future edit that reorders groups cannot
silently break the reader.

Two cases needed extra care to preserve behavior:
- semver/common.ts and poetry/patterns.ts split() on a regex whose
  capture group is relied upon by String.prototype.split to keep the
  separator in the output array; the group is kept capturing and
  named, not converted to non-capturing.
- hashicorp/convertor.ts's semverRegex is only ever embedded via
  .source into a named `(?<version>...)` group elsewhere and never
  matched directly, so its internal groups are safe to make
  non-capturing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(datasource): name capture groups for prefer-named-capture-group

Burns down all prefer-named-capture-group violations under
lib/modules/datasource/. Same treatment as the versioning module:
unused groups become non-capturing, used groups get names, and
positional match[n] reads move to match.groups!.<name>.

docker/ecr.ts and pypi/common.ts keep their positional destructuring
(`const [, region] = ...`, `!!m &&`) working unchanged since a named
capture group is still addressable by its numeric index in
JavaScript — only pypi/common.ts's access was rewritten to
m.groups!.owner for clarity since it read a single group directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(platform): name capture groups for prefer-named-capture-group

Burns down all prefer-named-capture-group violations under
lib/modules/platform/. Uses the repo's established idiom of
`match.groups?.<name>` after an optional-chained exec()/match() (see
bitbucket/index.ts hostnameWithoutApiPrefix, gerrit/utils.ts
extractSourceBranch) and `$<name>` in String.replace replacement
strings. Unused groups (markdown/HTML massaging regexes matched only
to be stripped) become non-capturing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(manager): name capture groups in ansible-galaxy for prefer-named-capture-group

Burns down prefer-named-capture-group violations in
lib/modules/manager/ansible-galaxy/. newBlockRegEx and blockLineRegEx
dropped their unused outer wrapping group (only the inner key/value
groups were ever read) and named the key/value groups; nameMatchRegex's
remaining unused groups (protocol/user-info/port alternatives) become
non-capturing since only source/hostname/depName/version are read via
.groups. Accesses in collections.ts and roles.ts move from
lineMatch[2]/lineMatch[3] to lineMatch.groups!.key/value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(manager): name capture groups for prefer-named-capture-group (batch 1)

Burns down prefer-named-capture-group violations across the first
alphabetical slice of lib/modules/manager/ (ansible through mix).
Used groups get names with accesses rewritten to match.groups!.<name>
(or $<name> in replacement strings); groups whose value is never read
become non-capturing (?:...). Two String.split() call sites
(git-submodules/extract.ts, meteor/extract.ts) keep the established
"named group still readable positionally from the split() result
array" idiom instead of restructuring the destructuring.

bazel/rules/go.ts and buildpacks/extract.ts dockerRef verified
byte-for-byte equivalent before/after via a quick node script since
several nested groups collapsed to non-capturing at once.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(manager): name capture groups for prefer-named-capture-group (batch 2)

Burns down prefer-named-capture-group violations across the remaining
alphabetical slice of lib/modules/manager/ (npm through terragrunt).
Same treatment as batch 1: used groups get names with accesses moved
to match.groups!.<name> or $<name> replacement strings; unused groups
(wrapping alternations, quantifier repetition groups only consumed via
.test(), or values never read from a match) become non-capturing.

terraform/extractors/others/modules.ts and terragrunt/modules.ts share
near-identical URL-parsing regexes (github/bitbucket/git/azure-devops
ref matchers) — the same set of always-unused `depth=`/`&depth=`
query-string groups is converted to non-capturing in both files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(config): name capture groups for prefer-named-capture-group

Burns down prefer-named-capture-group violations in lib/config/.
Used groups get names with replacement strings switched from $1/$2 to
$<name>; the unused separator group in schedule-migration.ts's
afterBeforeRegex becomes non-capturing. presets/parse.ts keeps
assigning through the already-declared `repo` variable rather than
array-destructuring the exec() result, matching this file's existing
style for the other named-group regexes just above it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(util): name capture groups for prefer-named-capture-group

Burns down prefer-named-capture-group violations across lib/util/ and
lib/logger/. Same treatment as previous batches: named groups for
values that are read (via $<name> replacement strings, .groups!.<name>,
or destructured from .groups), non-capturing groups where nothing reads
the captured value (e.g. semantic.ts's angular-commit .test()-only
regex). www-authenticate.ts's tokenizer entries each get their own
named group but keep accessing the match generically via match[1],
since a positionally-indexed named group is still readable by index.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(workers): name capture groups for prefer-named-capture-group

Burns down prefer-named-capture-group violations in lib/workers/.
Used groups get names with $<name> replacement strings; unused
wrapper/alternation groups (e.g. semantic-commit-message.ts's optional
scope/issue wrappers, release-notes.ts's date-heading and
horizontal-rule matchers that are only probed with .search()/replaced
wholesale) become non-capturing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(test,tools): name capture groups for prefer-named-capture-group

Finishes the prefer-named-capture-group burndown: test/, tools/, and
vitest.config.mts. Groups whose value is read get names ($<name>
replacement strings or .groups.<name> access); groups only used via
.test()/.search() or that feed a .match(/…/g) call (whose return value
is the array of whole matches, not captured groups) become
non-capturing.

This is the last remaining slice of pre-existing violations, so the
rule (already enabled at error repo-wide) now passes with zero
findings across the whole codebase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* fix prettier failure

* refactor(lint): use a named capture group in `v8-ignore-no-count`

New rule from main trips the newly enabled `prefer-named-capture-group` oxlint rule.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-03 09:54:40 +00:00
Sebastian Poxhofer a1971afa78 fix(linters): add linting rule to enforce usage of our regEx utility (#44690)
* ci(linter): add renovate/require-regex-util rule

Adds a custom oxlint rule that flags raw RegExp usage in lib/
production code: any `new RegExp(...)` call and any regex literal
that is not the direct first argument of `regEx(...)`. The regEx()
helper from lib/util/regex.ts uses the RE2 engine for ReDoS-safe
matching and caches compiled patterns. lib/util/regex.ts itself is
exempt.

The rule is disabled for **/*.spec.ts, test/**, and tools/** via
config overrides, because vitest APIs such as expect.stringMatching
need bare RegExp instances (a past commit reverted regEx() there).

Severity is set to "warn" instead of "error": the repo currently has
197 pre-existing violations (above the agreed mechanical-fix
threshold of 80), and a number of them are deliberately
RE2-incompatible patterns (lookahead/lookbehind/named backreferences,
see TODO #12872/#12875 markers in e.g. lib/modules/versioning/rez/
pattern.ts and lib/modules/manager/dockerfile/extract.ts) that need
per-site judgment before they can be wrapped in regEx() or suppressed
with a justified disable comment. No violation fixes are included in
this commit.

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

* ci(linter): enforce renovate/require-regex-util at error

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

* refactor: use regEx() for regex literals and RegExp construction in lib

Burn down all renovate/require-regex-util violations (197):

- wrap RE2-compatible regex literals and RegExp constructions in regEx()
- rewrite lookaround patterns where behavior is provably preserved:
  goproxy separator split, sbt-package link extraction, leiningen
  comment stripping and keyword search, npm GitHub owner validation
  (unit-count bound replaced by an explicit length check)
- keep native RegExp with disable comments where RE2 cannot be used:
  moo / good-enough-parser lexer patterns (moo rejects RE2 instances),
  MigrationsService propertyName (matched via isRegExp, which RE2
  instances fail), rez named backreferences and lookaheads, GitHub
  markdown link negative lookbehind, emoji astral-plane matching
- drop stale TODO #12875 comments for patterns current re2 handles

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

* refactor: reduce require-regex-util disable comments

Rewrite the github massage-markdown-links URL regex to capture an
optional `api.` prefix in a named group (skipped in code) instead of
relying on a negative lookbehind, so both the base and global variants
can use regEx()/RE2 and their two disable comments are removed. Add
spec cases for api-prefixed URLs that match the URL shape.

Consolidate the four related line disables in rez/pattern.ts (bound and
range patterns emulating Python conditional patterns via named
backreferences and lookaheads, which RE2 cannot express) into a single
block disable/enable pair, matching the treatment of the lexer files.

Disable comment count drops from 13 to 8.

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

* refactor(datasource/sbt-package): use named capture group in link regex

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

* refactor(manager/cake): restore original multiLineComment regex spelling

The [^] -> [\\s\\S] rewrite was only needed for an RE2 wrap that was
later reverted; keep the diff minimal.

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

* fix(datasource/go): skip empty GOPROXY segments

The switch from a lookahead split to a capture-group split (needed because
RE2 has no lookahead support) changed how empty GOPROXY segments parse:
`a|,b` yielded `{ url: ',', fallback: '|' }` before and
`{ url: '', fallback: ',' }` after. The comma fallback only continues on
404/410, so a failing proxy ahead of an empty segment silently stopped the
lookup instead of falling through to the remaining proxies.

Empty segments carry no url to query, so drop them.

* refactor(datasource/go): use isTruthy for empty segment filter

* fix(datasource/go): filter empty segments before mapping

Filtering after the map broke the contextual typing from the
GoproxyItem[] annotation, widening fallback to string.

* refactor(platform/github): use regEx() for merge queue query stripping

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 14:30:46 +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
Jamie Tanna 30ddfe3d3e chore(logger): sanitize boxed String objects (#42159)
Noticed when attempting to run Renovate against an empty repository (on
`platform=bitbucket`) we previously saw:

    WARN: Host error (repository=jamie-tanna-mend-1/test-any-updates)
           "hostType": "git",
           "packageName": undefined,
           "err": {
             "task": {
               "commands": [
                 "clone",
                 "-b",
                 "main",
                 "--filter=blob:none",
                 {
                   "0": "h",
                   "1": "t",
                   "2": "t",
                   "3": "p",
                   ...

                   "281": "i",
                   "282": "t"
                 },
                 {"0": "."}
               ],
               "format": "utf-8",
               "parser": "[function]"
             },
             "message": "Cloning into '.'...\nfatal: Remote branch main not found in upstream origin\n",
               "stack": "..."

We can instead match against the case where it's a `String` object, and
forcibly return the `sanitized`'d value.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
2026-03-26 17:31:32 +00:00
Michael Kriese d6c85ecc6e fix: lint errors (#41808)
* fix: lint errors

* test: fix lint
2026-03-14 10:39:23 +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 f963528d48 chore(logger): serialize DateTime to ISO strings (#41363)
* chore(logger): serialize `DateTime` to ISO strings

As an alternative to 2228a79015, we can
instead serialize any `DateTime` objects that are present in our logging
fields.

Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io>

* Revert "fix(util/git): log date as string (#41360)"

This reverts commit 2228a79015.

* test(logger): clarify Luxon dates

As we'll follow-up with native dates in the future.

---------

Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io>
2026-02-27 15:05:30 +00:00
Michael Kriese 331cb509b8 refactor(logger): use safe-stable-stringify instead of bunyan.safeCycles (#41526)
* refactor(logger): use `safe-stable-stringify` instead of `bunyan.safeCycles`

* test: fix test
2026-02-26 14:29:24 +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 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 0785d0b8bc test: add coverage (part2) (#40643) 2026-01-23 20:57:46 +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
Sergei Zharinov aee0975aa2 fix: Sanitize secrets in object keys during logging (#37646) 2025-08-21 13:53:41 +00:00
Gabriel-Ladzaretti 251514f143 fix(log): sanitize rawExec errors (#37077) 2025-07-22 15:33:00 +00:00
RahulGautamSingh 587b9a9cda refactor: use re2 (#36957) 2025-07-12 16:27:13 +00:00
Jonas Scheffner 9e2c702389 fix(logger): handle AggregateErrors (#36435) 2025-06-11 09:13:23 +00:00
renovate[bot] 86408be681 build(deps): update dependency @sindresorhus/is to v7 (main) (#35682)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-05-02 09:43:35 +00:00
Michael Kriese b5ff90f2bd fix: improve coverage (#34667) 2025-03-06 17:05:19 +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
RahulGautamSingh f2acf6a9a2 refactor(logger): remove templating from FATAL logs (#33490) 2025-01-10 11:15:01 +00:00
Gabriel-Ladzaretti 3b9464c8fa refactor(logger): improve readability and modularity (#33058)
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-17 09:24:57 +00:00
Michael Kriese 42b448b0e5 feat(logger): prefix log env settings with RENOVATE_ (#32499)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2024-11-13 17:58:19 +00:00
sahil-seth dbd69e9a40 feat: adding support for data uri sanitisation (#31721)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-10-08 05:02:54 +00:00
RahulGautamSingh 50f1e29113 feat: do not mask secrets templates (#31240) 2024-09-06 04:14:13 +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
RahulGautamSingh c6c4572ecb feat(logging)!: initialize file logging via env (#28104)
Closes #14705

BREAKING CHANGE: File logging must now be set via env and not in config.js
2024-07-25 15:28:16 +02:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Sergei Zharinov 53263bbfda feat: Clone objects via wrapper (#22970) 2023-06-27 13:09:59 +00:00
Sergei Zharinov 115ed870ab fix(logger): Represent Zod errors in friendlier format (#22238) 2023-05-16 14:18:46 +00:00
Jamie Magee a6dfa70c1d chore: migrate to structuredClone (#20885)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-04-27 05:06:22 +00:00
Dominik Steinbinder 18d0fbc3af fix: sanitize special characters in URLs (#21575) 2023-04-19 14:47:12 +00:00
Jamie Magee 176282e65f chore: use node: protocol imports (#21181) 2023-03-28 21:05:36 +00:00
Rhys Arkins be10c29d17 fix(http): improve error handling (#17587)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-10-19 04:27:07 +00:00
Gabriel-Ladzaretti 7ac91e452c docs(config): Don't show [template] for long strings (#16224) 2022-06-28 13:49:42 +00:00
Michael Kriese 6ef2b8cb44 fix(logger): sanitize urls in strings (#15102) 2022-04-14 11:24:28 +02:00
MaronHatoum b121deb969 refactor(util/http): move interfaces from index.ts to types.ts (#14335)
* refactor:util/http move interfaces and types from index.ts to types.ts

* refactor:reorder imports

* refactor:move HttpError from type.ts to index.ts

* refactor:change imports after moving HttpError from type.ts to index.ts

* refactor:revert white spaces

* refactor:revert moving httpError from types.ts to index.ts

* refactor: moving httpError from types.ts to index.ts

* refactor: change import

* refactor: change import

* refactor: change import

* refactor: fix circular dependencies (lint build)

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2022-02-24 08:50:17 +00:00
Hasan Awad 85cf82e79d fix(logging): Added check for log level value (#13941) 2022-02-07 08:44:44 +00:00
RahulGautamSingh ee2e155f1f fix: modify regex to be re2 compatbile (#12778)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2021-11-29 19:16:05 +00:00
Sergei Zharinov e7a969016d refactor(logger): Update logger internals (#12842)
* refactor(logger): Update logger internals

* Check the entire logger directory

* Refactor sanitizeValue function

* Backport changes

* Backport test too
2021-11-27 10:22:58 +01:00
Sergei Zharinov fb8715c921 refactor(logger): Simplify sanitizeValue function (#12859)
* refactor(logger): Simplify sanitizeValue function

* Return older test

* One more test for functions
2021-11-27 09:40:44 +01:00
Rhys Arkins e95fcb17d8 fix(logger): skip response body for timeouts (#12704) 2021-11-17 09:55:57 +01:00
Rhys Arkins bf09337076 fix: enable eslint eqeqeq (#12574)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2021-11-09 07:02:59 +00:00
Rhys Arkins c3ad246a99 fix: no-param-reassign (#12571) 2021-11-09 07:04:34 +01:00
HonkingGoose ab018191fa chore: report and fix unused ESLint disable directives (#12548) 2021-11-08 20:20:03 +01:00
RahulGautamSingh 4b16903ff1 fix: modified regex to use RE2 (#12025)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2021-10-19 14:53:34 +02:00
Michael Kriese 0eb5c6d2cd fix(core/changelogs): pass though known project info (#11515) 2021-09-01 13:07:55 +02:00
Michael Kriese 7daa93a78d refactor: extract types to new files (#9951) 2021-05-11 12:51:21 +02:00
Rhys Arkins af1e4ee1a7 feat: secrets (#8070) 2021-03-22 15:51:38 +01:00