renovate 44.156.2 → 44.156.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { trimTrailingSlash } from "../../../util/url.js";
2
+ import { findAll, matchesHost } from "../../../util/host-rules.js";
2
3
  import { BitbucketTagsDatasource } from "../bitbucket-tags/index.js";
3
4
  import { getSourceUrl as getSourceUrl$1 } from "../../../util/github/url.js";
4
5
  import { GiteaTagsDatasource } from "../gitea-tags/index.js";
@@ -7,6 +8,7 @@ import { GithubTagsDatasource } from "../github-tags/index.js";
7
8
  import { getSourceUrl as getSourceUrl$2 } from "../../../util/gitlab/url.js";
8
9
  import { GitlabTagsDatasource } from "../gitlab-tags/index.js";
9
10
  import { parseGoproxy, parseNoproxy } from "./goproxy-parser.js";
11
+ import { isNonEmptyString } from "@sindresorhus/is";
10
12
  //#region lib/modules/datasource/go/common.ts
11
13
  /**
12
14
  * The Go module proxy which serves public modules only, and which the Go toolchain uses by default.
@@ -23,13 +25,24 @@ const publicGoproxyUrl = "https://proxy.golang.org";
23
25
  *
24
26
  * An unset `GOPROXY` is the default, so it is public too.
25
27
  *
28
+ * A `hostType: go` host rule with credentials for the module's host is also a declaration that the module is private, as it can't be read without them.
29
+ *
26
30
  * @see https://go.dev/ref/mod#private-modules
27
31
  */
28
32
  function isPublicProxy({ url }) {
29
33
  return trimTrailingSlash(url) === publicGoproxyUrl;
30
34
  }
35
+ function hasGoHostRuleCredentials(packageName) {
36
+ const url = `https://${packageName}`;
37
+ return findAll({ hostType: "go" }).some((rule) => (!rule.matchHost || matchesHost(url, rule.matchHost)) && [
38
+ rule.token,
39
+ rule.password,
40
+ rule.httpsPrivateKey
41
+ ].some(isNonEmptyString));
42
+ }
31
43
  function isPublicGoPackage(packageName) {
32
44
  if (parseNoproxy()?.test(packageName)) return false;
45
+ if (hasGoHostRuleCredentials(packageName)) return false;
33
46
  const proxies = parseGoproxy();
34
47
  return proxies.every((proxy) => proxy.url === "off" || isPublicProxy(proxy) || proxy.url === "direct" && proxies.some(isPublicProxy));
35
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","names":["githubSourceUrl","gitlabSourceUrl"],"sources":["../../../../lib/modules/datasource/go/common.ts"],"sourcesContent":["import { getSourceUrl as githubSourceUrl } from '../../../util/github/url.ts';\nimport { getSourceUrl as gitlabSourceUrl } from '../../../util/gitlab/url.ts';\nimport { trimTrailingSlash } from '../../../util/url.ts';\nimport { BitbucketTagsDatasource } from '../bitbucket-tags/index.ts';\nimport { ForgejoTagsDatasource } from '../forgejo-tags/index.ts';\nimport { GiteaTagsDatasource } from '../gitea-tags/index.ts';\nimport { GithubTagsDatasource } from '../github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../gitlab-tags/index.ts';\n\nimport { parseGoproxy, parseNoproxy } from './goproxy-parser.ts';\nimport type { DataSource, GoproxyItem } from './types.ts';\n\n/**\n * The Go module proxy which serves public modules only, and which the Go toolchain uses by default.\n *\n * @see https://go.dev/ref/mod#module-proxy\n */\nexport const publicGoproxyUrl = 'https://proxy.golang.org';\n\n/**\n * Whether a module's data may be written to a package cache which is shared with others.\n *\n * `GOPRIVATE`/`GONOPROXY` is how the user declares which modules are private, and `GOPROXY` decides who serves the rest: whatever the public proxy serves is public by definition, whereas a self-hosted proxy may serve modules which are not.\n *\n * `direct` only counts as public alongside the public proxy, which is how Go's own default `GOPROXY` is written: there, it is the fallback for what the public proxy doesn't have. On its own it means every module comes from its source, which tells us nothing about who may read it.\n *\n * An unset `GOPROXY` is the default, so it is public too.\n *\n * @see https://go.dev/ref/mod#private-modules\n */\nfunction isPublicProxy({ url }: GoproxyItem): boolean {\n return trimTrailingSlash(url) === publicGoproxyUrl;\n}\n\nexport function isPublicGoPackage(packageName: string): boolean {\n if (parseNoproxy()?.test(packageName)) {\n return false;\n }\n\n const proxies = parseGoproxy();\n\n return proxies.every(\n (proxy) =>\n proxy.url === 'off' ||\n isPublicProxy(proxy) ||\n (proxy.url === 'direct' && proxies.some(isPublicProxy)),\n );\n}\n\nexport function getSourceUrl(\n dataSource?: DataSource | null,\n): string | undefined {\n if (dataSource) {\n const { datasource, registryUrl, packageName } = dataSource;\n\n switch (datasource) {\n case ForgejoTagsDatasource.id:\n return ForgejoTagsDatasource.getSourceUrl(packageName, registryUrl);\n case GiteaTagsDatasource.id:\n return GiteaTagsDatasource.getSourceUrl(packageName, registryUrl);\n case GithubTagsDatasource.id:\n return githubSourceUrl(packageName, registryUrl);\n case GitlabTagsDatasource.id:\n return gitlabSourceUrl(packageName, registryUrl);\n case BitbucketTagsDatasource.id:\n return BitbucketTagsDatasource.getSourceUrl(packageName, registryUrl);\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,mBAAmB;;;;;;;;;;;;AAahC,SAAS,cAAc,EAAE,OAA6B;CACpD,OAAO,kBAAkB,GAAG,MAAM;AACpC;AAEA,SAAgB,kBAAkB,aAA8B;CAC9D,IAAI,aAAa,CAAC,EAAE,KAAK,WAAW,GAClC,OAAO;CAGT,MAAM,UAAU,aAAa;CAE7B,OAAO,QAAQ,OACZ,UACC,MAAM,QAAQ,SACd,cAAc,KAAK,KAClB,MAAM,QAAQ,YAAY,QAAQ,KAAK,aAAa,CACzD;AACF;AAEA,SAAgB,aACd,YACoB;CACpB,IAAI,YAAY;EACd,MAAM,EAAE,YAAY,aAAa,gBAAgB;EAEjD,QAAQ,YAAR;GACE,KAAK,sBAAsB,IACzB,OAAO,sBAAsB,aAAa,aAAa,WAAW;GACpE,KAAK,oBAAoB,IACvB,OAAO,oBAAoB,aAAa,aAAa,WAAW;GAClE,KAAK,qBAAqB,IACxB,OAAOA,eAAgB,aAAa,WAAW;GACjD,KAAK,qBAAqB,IACxB,OAAOC,eAAgB,aAAa,WAAW;GACjD,KAAK,wBAAwB,IAC3B,OAAO,wBAAwB,aAAa,aAAa,WAAW;EACxE;CACF;AAGF"}
1
+ {"version":3,"file":"common.js","names":["hostRules\n .findAll","hostRules.matchesHost","githubSourceUrl","gitlabSourceUrl"],"sources":["../../../../lib/modules/datasource/go/common.ts"],"sourcesContent":["import { isNonEmptyString } from '@sindresorhus/is';\nimport { getSourceUrl as githubSourceUrl } from '../../../util/github/url.ts';\nimport { getSourceUrl as gitlabSourceUrl } from '../../../util/gitlab/url.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { trimTrailingSlash } from '../../../util/url.ts';\nimport { BitbucketTagsDatasource } from '../bitbucket-tags/index.ts';\nimport { ForgejoTagsDatasource } from '../forgejo-tags/index.ts';\nimport { GiteaTagsDatasource } from '../gitea-tags/index.ts';\nimport { GithubTagsDatasource } from '../github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../gitlab-tags/index.ts';\n\nimport { parseGoproxy, parseNoproxy } from './goproxy-parser.ts';\nimport type { DataSource, GoproxyItem } from './types.ts';\n\n/**\n * The Go module proxy which serves public modules only, and which the Go toolchain uses by default.\n *\n * @see https://go.dev/ref/mod#module-proxy\n */\nexport const publicGoproxyUrl = 'https://proxy.golang.org';\n\n/**\n * Whether a module's data may be written to a package cache which is shared with others.\n *\n * `GOPRIVATE`/`GONOPROXY` is how the user declares which modules are private, and `GOPROXY` decides who serves the rest: whatever the public proxy serves is public by definition, whereas a self-hosted proxy may serve modules which are not.\n *\n * `direct` only counts as public alongside the public proxy, which is how Go's own default `GOPROXY` is written: there, it is the fallback for what the public proxy doesn't have. On its own it means every module comes from its source, which tells us nothing about who may read it.\n *\n * An unset `GOPROXY` is the default, so it is public too.\n *\n * A `hostType: go` host rule with credentials for the module's host is also a declaration that the module is private, as it can't be read without them.\n *\n * @see https://go.dev/ref/mod#private-modules\n */\nfunction isPublicProxy({ url }: GoproxyItem): boolean {\n return trimTrailingSlash(url) === publicGoproxyUrl;\n}\n\nfunction hasGoHostRuleCredentials(packageName: string): boolean {\n const url = `https://${packageName}`;\n return hostRules\n .findAll({ hostType: 'go' })\n .some(\n (rule) =>\n (!rule.matchHost || hostRules.matchesHost(url, rule.matchHost)) &&\n [rule.token, rule.password, rule.httpsPrivateKey].some(\n isNonEmptyString,\n ),\n );\n}\n\nexport function isPublicGoPackage(packageName: string): boolean {\n if (parseNoproxy()?.test(packageName)) {\n return false;\n }\n\n if (hasGoHostRuleCredentials(packageName)) {\n return false;\n }\n\n const proxies = parseGoproxy();\n\n return proxies.every(\n (proxy) =>\n proxy.url === 'off' ||\n isPublicProxy(proxy) ||\n (proxy.url === 'direct' && proxies.some(isPublicProxy)),\n );\n}\n\nexport function getSourceUrl(\n dataSource?: DataSource | null,\n): string | undefined {\n if (dataSource) {\n const { datasource, registryUrl, packageName } = dataSource;\n\n switch (datasource) {\n case ForgejoTagsDatasource.id:\n return ForgejoTagsDatasource.getSourceUrl(packageName, registryUrl);\n case GiteaTagsDatasource.id:\n return GiteaTagsDatasource.getSourceUrl(packageName, registryUrl);\n case GithubTagsDatasource.id:\n return githubSourceUrl(packageName, registryUrl);\n case GitlabTagsDatasource.id:\n return gitlabSourceUrl(packageName, registryUrl);\n case BitbucketTagsDatasource.id:\n return BitbucketTagsDatasource.getSourceUrl(packageName, registryUrl);\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAa,mBAAmB;;;;;;;;;;;;;;AAehC,SAAS,cAAc,EAAE,OAA6B;CACpD,OAAO,kBAAkB,GAAG,MAAM;AACpC;AAEA,SAAS,yBAAyB,aAA8B;CAC9D,MAAM,MAAM,WAAW;CACvB,OAAOA,QACI,EAAE,UAAU,KAAK,CAAC,CAAC,CAC3B,MACE,UACE,CAAC,KAAK,aAAaC,YAAsB,KAAK,KAAK,SAAS,MAC7D;EAAC,KAAK;EAAO,KAAK;EAAU,KAAK;CAAe,CAAC,CAAC,KAChD,gBACF,CACJ;AACJ;AAEA,SAAgB,kBAAkB,aAA8B;CAC9D,IAAI,aAAa,CAAC,EAAE,KAAK,WAAW,GAClC,OAAO;CAGT,IAAI,yBAAyB,WAAW,GACtC,OAAO;CAGT,MAAM,UAAU,aAAa;CAE7B,OAAO,QAAQ,OACZ,UACC,MAAM,QAAQ,SACd,cAAc,KAAK,KAClB,MAAM,QAAQ,YAAY,QAAQ,KAAK,aAAa,CACzD;AACF;AAEA,SAAgB,aACd,YACoB;CACpB,IAAI,YAAY;EACd,MAAM,EAAE,YAAY,aAAa,gBAAgB;EAEjD,QAAQ,YAAR;GACE,KAAK,sBAAsB,IACzB,OAAO,sBAAsB,aAAa,aAAa,WAAW;GACpE,KAAK,oBAAoB,IACvB,OAAO,oBAAoB,aAAa,aAAa,WAAW;GAClE,KAAK,qBAAqB,IACxB,OAAOC,eAAgB,aAAa,WAAW;GACjD,KAAK,qBAAqB,IACxB,OAAOC,eAAgB,aAAa,WAAW;GACjD,KAAK,wBAAwB,IAC3B,OAAO,wBAAwB,aAAa,aAAa,WAAW;EACxE;CACF;AAGF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "renovate",
3
3
  "description": "Automated dependency updates. Flexible so you don't need to be.",
4
- "version": "44.156.2",
4
+ "version": "44.156.3",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "renovate": "dist/renovate.js",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$id": "https://docs.renovatebot.com/renovate-schema.json",
3
- "title": "JSON schema for Renovate 44.156.2 config files (https://renovatebot.com/)",
3
+ "title": "JSON schema for Renovate 44.156.3 config files (https://renovatebot.com/)",
4
4
  "$schema": "http://json-schema.org/draft-07/schema#",
5
- "x-renovate-version": "44.156.2",
5
+ "x-renovate-version": "44.156.3",
6
6
  "allowComments": true,
7
7
  "type": "object",
8
8
  "definitions": {