renovate 44.171.0 → 44.171.2
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.
- package/dist/instrumentation/reporting.js +5 -1
- package/dist/instrumentation/reporting.js.map +1 -1
- package/dist/modules/datasource/common.d.ts +4 -0
- package/dist/modules/datasource/common.js +16 -1
- package/dist/modules/datasource/common.js.map +1 -1
- package/dist/modules/datasource/crate/index.js +4 -1
- package/dist/modules/datasource/crate/index.js.map +1 -1
- package/dist/modules/datasource/custom/index.js +5 -1
- package/dist/modules/datasource/custom/index.js.map +1 -1
- package/dist/modules/datasource/custom/utils.js +2 -1
- package/dist/modules/datasource/custom/utils.js.map +1 -1
- package/dist/modules/datasource/docker/common.js +1 -1
- package/dist/modules/datasource/git-refs/base.js +2 -1
- package/dist/modules/datasource/git-refs/base.js.map +1 -1
- package/dist/modules/datasource/index.js +20 -10
- package/dist/modules/datasource/index.js.map +1 -1
- package/dist/modules/datasource/metadata.js +36 -9
- package/dist/modules/datasource/metadata.js.map +1 -1
- package/dist/modules/manager/bun/extract.js +7 -2
- package/dist/modules/manager/bun/extract.js.map +1 -1
- package/dist/modules/manager/fingerprint.generated.js +4 -4
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/npm/extract/index.js +3 -2
- package/dist/modules/manager/npm/extract/index.js.map +1 -1
- package/dist/modules/manager/npm/extract/post/monorepo.js +6 -3
- package/dist/modules/manager/npm/extract/post/monorepo.js.map +1 -1
- package/dist/modules/manager/npm/npmrc.js +162 -11
- package/dist/modules/manager/npm/npmrc.js.map +1 -1
- package/dist/modules/manager/npmrc.js +35 -0
- package/dist/modules/manager/npmrc.js.map +1 -0
- package/dist/modules/manager/pep621/processors/uv.js +9 -3
- package/dist/modules/manager/pep621/processors/uv.js.map +1 -1
- package/dist/modules/manager/pipenv/artifacts.js +16 -5
- package/dist/modules/manager/pipenv/artifacts.js.map +1 -1
- package/dist/util/cache/package/index.js +7 -4
- package/dist/util/cache/package/index.js.map +1 -1
- package/dist/util/cache/repository/http-cache.js +10 -0
- package/dist/util/cache/repository/http-cache.js.map +1 -1
- package/dist/util/cache/sanitize-key.js +63 -0
- package/dist/util/cache/sanitize-key.js.map +1 -0
- package/dist/util/git/auth.js +22 -2
- package/dist/util/git/auth.js.map +1 -1
- package/dist/util/git/index.d.ts +2 -0
- package/dist/util/git/index.js +1 -1
- package/dist/util/git/index.js.map +1 -1
- package/dist/util/host-rules.d.ts +33 -2
- package/dist/util/host-rules.js +237 -12
- package/dist/util/host-rules.js.map +1 -1
- package/dist/util/http/cache/abstract-http-cache-provider.js +17 -0
- package/dist/util/http/cache/abstract-http-cache-provider.js.map +1 -1
- package/dist/util/http/cache/memory-http-cache-provider.js +1 -0
- package/dist/util/http/cache/memory-http-cache-provider.js.map +1 -1
- package/dist/util/http/cache/persisted-headers.js +27 -0
- package/dist/util/http/cache/persisted-headers.js.map +1 -0
- package/dist/util/http/cache/repository-http-cache-provider.js +7 -4
- package/dist/util/http/cache/repository-http-cache-provider.js.map +1 -1
- package/dist/util/http/host-rules.js +2 -15
- package/dist/util/http/host-rules.js.map +1 -1
- package/dist/util/http/http.js +1 -1
- package/dist/util/jsonata.js +1 -1
- package/dist/util/merge-confidence/index.js +1 -1
- package/dist/util/url.d.ts +38 -0
- package/dist/util/url.js +100 -2
- package/dist/util/url.js.map +1 -1
- package/dist/workers/repository/cache.js +9 -1
- package/dist/workers/repository/cache.js.map +1 -1
- package/dist/workers/repository/init/merge.js +1 -1
- package/dist/workers/repository/init/merge.js.map +1 -1
- package/dist/workers/repository/onboarding/branch/rebase.js +1 -1
- package/dist/workers/repository/onboarding/pr/index.js +1 -1
- package/dist/workers/repository/process/extract-update.js +53 -5
- package/dist/workers/repository/process/extract-update.js.map +1 -1
- package/dist/workers/repository/process/fetch.js +2 -1
- package/dist/workers/repository/process/fetch.js.map +1 -1
- package/dist/workers/repository/process/lookup/digest.js +8 -4
- package/dist/workers/repository/process/lookup/digest.js.map +1 -1
- package/dist/workers/repository/process/lookup/index.js +13 -8
- package/dist/workers/repository/process/lookup/index.js.map +1 -1
- package/dist/workers/repository/update/branch/index.js +5 -3
- package/dist/workers/repository/update/branch/index.js.map +1 -1
- package/dist/workers/repository/updates/branch-name.js +5 -4
- package/dist/workers/repository/updates/branch-name.js.map +1 -1
- package/dist/workers/repository/updates/flatten.js +2 -2
- package/dist/workers/repository/updates/flatten.js.map +1 -1
- package/dist/workers/repository/updates/generate.js +5 -4
- package/dist/workers/repository/updates/generate.js.map +1 -1
- package/package.json +2 -2
- package/renovate-schema.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-cache.js","names":[],"sources":["../../../../lib/util/cache/repository/http-cache.ts"],"sourcesContent":["import { isTruthy } from '@sindresorhus/is';\nimport { DateTime } from 'luxon';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { HttpCache } from '../../http/cache/schema.ts';\nimport type { RepoCacheData } from './types.ts';\n\nexport function cleanupHttpCache(cacheData: RepoCacheData): void {\n if (!cacheData.httpCache && !cacheData.httpCacheHead) {\n logger.trace('cleanupHttpCache: no http cache to clean up');\n return;\n }\n\n const ttlDays = GlobalConfig.get('httpCacheTtlDays');\n if (ttlDays === 0) {\n logger.trace('cleanupHttpCache: zero value received, removing the cache');\n delete cacheData.httpCache;\n delete cacheData.httpCacheHead;\n return;\n }\n\n const now = DateTime.now();\n const entries = [cacheData.httpCache, cacheData.httpCacheHead]\n .filter(isTruthy)\n .flatMap((httpCache) =>\n Object.entries(httpCache).map(([url, item]) => ({\n httpCache,\n url,\n item,\n })),\n );\n for (const { httpCache, url, item } of entries) {\n const parsed = HttpCache.safeParse(item);\n if (!parsed.success || !parsed.data) {\n logger.debug(`http cache: removing invalid cache for ${url}`);\n delete httpCache[url];\n continue;\n }\n const expiry = DateTime.fromISO(parsed.data.timestamp).plus({\n days: ttlDays,\n });\n if (expiry < now) {\n logger.debug(`http cache: removing expired cache for ${url}`);\n delete httpCache[url];\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-cache.js","names":[],"sources":["../../../../lib/util/cache/repository/http-cache.ts"],"sourcesContent":["import { isTruthy } from '@sindresorhus/is';\nimport { DateTime } from 'luxon';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { logger } from '../../../logger/index.ts';\nimport {\n persistedResponseHeaders,\n pickHeaders,\n} from '../../http/cache/persisted-headers.ts';\nimport { HttpCache } from '../../http/cache/schema.ts';\nimport { hashUserinfoAndQuery } from '../sanitize-key.ts';\nimport type { RepoCacheData } from './types.ts';\n\nexport function cleanupHttpCache(cacheData: RepoCacheData): void {\n if (!cacheData.httpCache && !cacheData.httpCacheHead) {\n logger.trace('cleanupHttpCache: no http cache to clean up');\n return;\n }\n\n const ttlDays = GlobalConfig.get('httpCacheTtlDays');\n if (ttlDays === 0) {\n logger.trace('cleanupHttpCache: zero value received, removing the cache');\n delete cacheData.httpCache;\n delete cacheData.httpCacheHead;\n return;\n }\n\n const now = DateTime.now();\n const entries = [cacheData.httpCache, cacheData.httpCacheHead]\n .filter(isTruthy)\n .flatMap((httpCache) =>\n Object.entries(httpCache).map(([url, item]) => ({\n httpCache,\n url,\n item,\n })),\n );\n for (const { httpCache, url, item } of entries) {\n // an entry under a key with credentials or a query string is never read again, as the key is sanitized first\n if (hashUserinfoAndQuery(url) !== url) {\n logger.debug('http cache: removing an entry with an unsanitized key');\n delete httpCache[url];\n continue;\n }\n const parsed = HttpCache.safeParse(item);\n if (!parsed.success || !parsed.data) {\n logger.debug(`http cache: removing invalid cache for ${url}`);\n delete httpCache[url];\n continue;\n }\n const expiry = DateTime.fromISO(parsed.data.timestamp).plus({\n days: ttlDays,\n });\n if (expiry < now) {\n logger.debug(`http cache: removing expired cache for ${url}`);\n delete httpCache[url];\n continue;\n }\n // validated above, so the item has the shape of the parsed data\n const entry = item as NonNullable<HttpCache>;\n entry.httpResponse.headers = pickHeaders(\n entry.httpResponse.headers,\n persistedResponseHeaders,\n );\n }\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,iBAAiB,WAAgC;CAC/D,IAAI,CAAC,UAAU,aAAa,CAAC,UAAU,eAAe;EACpD,OAAO,MAAM,6CAA6C;EAC1D;CACF;CAEA,MAAM,UAAU,aAAa,IAAI,kBAAkB;CACnD,IAAI,YAAY,GAAG;EACjB,OAAO,MAAM,2DAA2D;EACxE,OAAO,UAAU;EACjB,OAAO,UAAU;EACjB;CACF;CAEA,MAAM,MAAM,SAAS,IAAI;CACzB,MAAM,UAAU,CAAC,UAAU,WAAW,UAAU,aAAa,CAAC,CAC3D,OAAO,QAAQ,CAAC,CAChB,SAAS,cACR,OAAO,QAAQ,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW;EAC9C;EACA;EACA;CACF,EAAE,CACJ;CACF,KAAK,MAAM,EAAE,WAAW,KAAK,UAAU,SAAS;EAE9C,IAAI,qBAAqB,GAAG,MAAM,KAAK;GACrC,OAAO,MAAM,uDAAuD;GACpE,OAAO,UAAU;GACjB;EACF;EACA,MAAM,SAAS,UAAU,UAAU,IAAI;EACvC,IAAI,CAAC,OAAO,WAAW,CAAC,OAAO,MAAM;GACnC,OAAO,MAAM,0CAA0C,KAAK;GAC5D,OAAO,UAAU;GACjB;EACF;EAIA,IAHe,SAAS,QAAQ,OAAO,KAAK,SAAS,CAAC,CAAC,KAAK,EAC1D,MAAM,QACR,CACS,IAAI,KAAK;GAChB,OAAO,MAAM,0CAA0C,KAAK;GAC5D,OAAO,UAAU;GACjB;EACF;EAEA,MAAM,QAAQ;EACd,MAAM,aAAa,UAAU,YAC3B,MAAM,aAAa,SACnB,wBACF;CACF;AACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { regEx } from "../regex.js";
|
|
2
|
+
import { urlUserinfoRegex } from "../url.js";
|
|
3
|
+
import { toSha256 } from "../hash.js";
|
|
4
|
+
import { getDetachedCredentialsHash, hasDetachedCredentials } from "../host-rules.js";
|
|
5
|
+
//#region lib/util/cache/sanitize-key.ts
|
|
6
|
+
const urlQueryRegex = regEx(/(?<prefix>[a-z][a-z\d+.-]*:\/\/[^\s?#]*)\?(?<query>[^\s#]+)/gi);
|
|
7
|
+
const urlSchemeRegex = regEx(/[a-z][a-z\d+.-]*:\/\//gi);
|
|
8
|
+
const hashPrefix = "sha256-";
|
|
9
|
+
const hashRegex = regEx(/^sha256-[\da-f]{16}$/);
|
|
10
|
+
const hashedUserinfoRegex = regEx(/^sha256-[\da-f]{16}@/);
|
|
11
|
+
/**
|
|
12
|
+
* Returns the named groups, which a `replace()` callback receives as its last argument.
|
|
13
|
+
*/
|
|
14
|
+
function groupsOf(args) {
|
|
15
|
+
return args.at(-1);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns `sha256-` and the first 16 hex characters of the SHA-256 of `value`, or `value` itself when it already is such a hash.
|
|
19
|
+
*/
|
|
20
|
+
function hashOnce(value) {
|
|
21
|
+
return hashRegex.test(value) ? value : `${hashPrefix}${toSha256(value).slice(0, 16)}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Inserts a hash of the credentials which `detachUrlCredentials()` registered for a URL inside `key` as the userinfo of that URL.
|
|
25
|
+
*/
|
|
26
|
+
function addDetachedCredentialsHashes(key) {
|
|
27
|
+
if (!hasDetachedCredentials()) return key;
|
|
28
|
+
return key.replace(urlSchemeRegex, (scheme, offset) => {
|
|
29
|
+
const url = key.slice(offset);
|
|
30
|
+
if (hashedUserinfoRegex.test(url.slice(scheme.length))) return scheme;
|
|
31
|
+
const credentialsHash = getDetachedCredentialsHash(url);
|
|
32
|
+
if (!credentialsHash) return scheme;
|
|
33
|
+
return `${scheme}${hashOnce(credentialsHash)}@`;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the `user:password@` userinfo and the `?query` of any URL inside a cache key with a hash of each.
|
|
38
|
+
* A key which is already sanitized is returned unchanged.
|
|
39
|
+
*
|
|
40
|
+
* @returns the key with every userinfo and every query string replaced by `sha256-` and the first 16 hex characters of its SHA-256
|
|
41
|
+
*/
|
|
42
|
+
function hashUserinfoAndQuery(key) {
|
|
43
|
+
return key.replace(urlUserinfoRegex, (...args) => {
|
|
44
|
+
const { scheme, userinfo } = groupsOf(args);
|
|
45
|
+
return `${scheme}://${hashOnce(userinfo)}@`;
|
|
46
|
+
}).replace(urlQueryRegex, (...args) => {
|
|
47
|
+
const { prefix, query } = groupsOf(args);
|
|
48
|
+
return `${prefix}?${hashOnce(query)}`;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Replaces the `user:password@` userinfo and the `?query` of any URL inside a cache key with a hash of each, and gives a URL with credentials registered by `detachUrlCredentials()` a hash of those as its userinfo.
|
|
53
|
+
* A key which is already sanitized is returned unchanged.
|
|
54
|
+
*
|
|
55
|
+
* @returns the key with every userinfo and every query string replaced by `sha256-` and the first 16 hex characters of its SHA-256
|
|
56
|
+
*/
|
|
57
|
+
function sanitizeKey(key) {
|
|
58
|
+
return hashUserinfoAndQuery(addDetachedCredentialsHashes(key));
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { hashOnce, hashUserinfoAndQuery, sanitizeKey };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=sanitize-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-key.js","names":[],"sources":["../../../lib/util/cache/sanitize-key.ts"],"sourcesContent":["// A cache key is not a URL, but it can contain URLs, e.g. `getReleases:https://user:pass@example.com/maven:pkg` or a\n// comma-joined list of registry URLs. So the regexes below find each `scheme://` inside the key and replace only the\n// matched userinfo or query, also in keys which a URL parser rejects.\n\nimport { toSha256 } from '../hash.ts';\nimport {\n getDetachedCredentialsHash,\n hasDetachedCredentials,\n} from '../host-rules.ts';\nimport { regEx } from '../regex.ts';\nimport { urlUserinfoRegex } from '../url.ts';\n\n// a URL up to its first `?`, followed by the query string\nconst urlQueryRegex = regEx(\n /(?<prefix>[a-z][a-z\\d+.-]*:\\/\\/[^\\s?#]*)\\?(?<query>[^\\s#]+)/gi,\n);\n\n// the `scheme://` of a URL\nconst urlSchemeRegex = regEx(/[a-z][a-z\\d+.-]*:\\/\\//gi);\n\nconst hashPrefix = 'sha256-';\nconst hashRegex = regEx(/^sha256-[\\da-f]{16}$/);\n\n// the hashed userinfo of a URL in a key which is already sanitized\nconst hashedUserinfoRegex = regEx(/^sha256-[\\da-f]{16}@/);\n\ntype Groups = Record<string, string>;\n\n/**\n * Returns the named groups, which a `replace()` callback receives as its last argument.\n */\nfunction groupsOf(args: unknown[]): Groups {\n return args.at(-1) as Groups;\n}\n\n/**\n * Returns `sha256-` and the first 16 hex characters of the SHA-256 of `value`, or `value` itself when it already is such a hash.\n */\nexport function hashOnce(value: string): string {\n return hashRegex.test(value)\n ? value\n : `${hashPrefix}${toSha256(value).slice(0, 16)}`;\n}\n\n/**\n * Inserts a hash of the credentials which `detachUrlCredentials()` registered for a URL inside `key` as the userinfo of that URL.\n */\nfunction addDetachedCredentialsHashes(key: string): string {\n if (!hasDetachedCredentials()) {\n return key;\n }\n return key.replace(urlSchemeRegex, (scheme: string, offset: number) => {\n const url = key.slice(offset);\n // a hashed userinfo already holds the hash of the detached credentials\n if (hashedUserinfoRegex.test(url.slice(scheme.length))) {\n return scheme;\n }\n const credentialsHash = getDetachedCredentialsHash(url);\n if (!credentialsHash) {\n return scheme;\n }\n return `${scheme}${hashOnce(credentialsHash)}@`;\n });\n}\n\n/**\n * Replaces the `user:password@` userinfo and the `?query` of any URL inside a cache key with a hash of each.\n * A key which is already sanitized is returned unchanged.\n *\n * @returns the key with every userinfo and every query string replaced by `sha256-` and the first 16 hex characters of its SHA-256\n */\nexport function hashUserinfoAndQuery(key: string): string {\n return key\n .replace(urlUserinfoRegex, (...args: unknown[]) => {\n const { scheme, userinfo } = groupsOf(args);\n return `${scheme}://${hashOnce(userinfo)}@`;\n })\n .replace(urlQueryRegex, (...args: unknown[]) => {\n const { prefix, query } = groupsOf(args);\n return `${prefix}?${hashOnce(query)}`;\n });\n}\n\n/**\n * Replaces the `user:password@` userinfo and the `?query` of any URL inside a cache key with a hash of each, and gives a URL with credentials registered by `detachUrlCredentials()` a hash of those as its userinfo.\n * A key which is already sanitized is returned unchanged.\n *\n * @returns the key with every userinfo and every query string replaced by `sha256-` and the first 16 hex characters of its SHA-256\n */\nexport function sanitizeKey(key: string): string {\n return hashUserinfoAndQuery(addDetachedCredentialsHashes(key));\n}\n"],"mappings":";;;;;AAaA,MAAM,gBAAgB,MACpB,+DACF;AAGA,MAAM,iBAAiB,MAAM,yBAAyB;AAEtD,MAAM,aAAa;AACnB,MAAM,YAAY,MAAM,sBAAsB;AAG9C,MAAM,sBAAsB,MAAM,sBAAsB;;;;AAOxD,SAAS,SAAS,MAAyB;CACzC,OAAO,KAAK,GAAG,EAAE;AACnB;;;;AAKA,SAAgB,SAAS,OAAuB;CAC9C,OAAO,UAAU,KAAK,KAAK,IACvB,QACA,GAAG,aAAa,SAAS,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;AACjD;;;;AAKA,SAAS,6BAA6B,KAAqB;CACzD,IAAI,CAAC,uBAAuB,GAC1B,OAAO;CAET,OAAO,IAAI,QAAQ,iBAAiB,QAAgB,WAAmB;EACrE,MAAM,MAAM,IAAI,MAAM,MAAM;EAE5B,IAAI,oBAAoB,KAAK,IAAI,MAAM,OAAO,MAAM,CAAC,GACnD,OAAO;EAET,MAAM,kBAAkB,2BAA2B,GAAG;EACtD,IAAI,CAAC,iBACH,OAAO;EAET,OAAO,GAAG,SAAS,SAAS,eAAe,EAAE;CAC/C,CAAC;AACH;;;;;;;AAQA,SAAgB,qBAAqB,KAAqB;CACxD,OAAO,IACJ,QAAQ,mBAAmB,GAAG,SAAoB;EACjD,MAAM,EAAE,QAAQ,aAAa,SAAS,IAAI;EAC1C,OAAO,GAAG,OAAO,KAAK,SAAS,QAAQ,EAAE;CAC3C,CAAC,CAAC,CACD,QAAQ,gBAAgB,GAAG,SAAoB;EAC9C,MAAM,EAAE,QAAQ,UAAU,SAAS,IAAI;EACvC,OAAO,GAAG,OAAO,GAAG,SAAS,KAAK;CACpC,CAAC;AACL;;;;;;;AAQA,SAAgB,YAAY,KAAqB;CAC/C,OAAO,qBAAqB,6BAA6B,GAAG,CAAC;AAC/D"}
|
package/dist/util/git/auth.js
CHANGED
|
@@ -2,7 +2,7 @@ import { regEx } from "../regex.js";
|
|
|
2
2
|
import { logger } from "../../logger/index.js";
|
|
3
3
|
import { PLATFORM_HOST_TYPES } from "../../constants/platforms.js";
|
|
4
4
|
import { createURLFromHostOrURL, isHttpUrl } from "../url.js";
|
|
5
|
-
import { find, getAll } from "../host-rules.js";
|
|
5
|
+
import { find, findDetachedCredentials, getAll } from "../host-rules.js";
|
|
6
6
|
import { detectPlatform } from "../common.js";
|
|
7
7
|
import { getTokenCredentials, parseGitUrl } from "./url.js";
|
|
8
8
|
import { addGitConfigEnvironmentVariables } from "./config.js";
|
|
@@ -77,7 +77,26 @@ function getAuthenticationRules(gitUrl, hostType, token) {
|
|
|
77
77
|
});
|
|
78
78
|
return authenticationRules;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Appends Git authentication for the repository `url` from the credentials registered from URL credentials for it with `hostType`, a username without a password as a percent-encoded token; configured host rules come through `getAll()` instead.
|
|
82
|
+
* @returns a new environment without modifying the input
|
|
83
|
+
*/
|
|
84
|
+
function getGitUrlEnvironmentVariables(environmentVariables, url, hostType) {
|
|
85
|
+
const credentials = findDetachedCredentials({
|
|
86
|
+
hostType,
|
|
87
|
+
url
|
|
88
|
+
});
|
|
89
|
+
if (!credentials?.username) return { ...environmentVariables };
|
|
90
|
+
return getGitAuthenticatedEnvironmentVariables(environmentVariables, url, {
|
|
91
|
+
...credentials.password ? credentials : { token: encodeURIComponent(credentials.username) },
|
|
92
|
+
hostType
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Appends Git authentication from the host rules with a `matchHost` for the platform host types and `hostTypes`, and, when `url` is given, for that single repository from the credentials registered from URL credentials for it with each of `hostTypes`.
|
|
97
|
+
* @returns a new environment without modifying the input
|
|
98
|
+
*/
|
|
99
|
+
function getGitEnvironmentVariables(environmentVariables, hostTypes = [], url) {
|
|
81
100
|
let gitEnvironmentVariables = { ...environmentVariables };
|
|
82
101
|
const gitHubHostRule = find({
|
|
83
102
|
hostType: "github",
|
|
@@ -87,6 +106,7 @@ function getGitEnvironmentVariables(environmentVariables, hostTypes = []) {
|
|
|
87
106
|
const gitAllowedHostTypes = /* @__PURE__ */ new Set([...PLATFORM_HOST_TYPES, ...hostTypes]);
|
|
88
107
|
const hostRules = getAll().filter((r) => r.matchHost && (r.token ?? (r.username && r.password))).filter((r) => !gitHubHostRule || !githubApiUrls.has(r.matchHost));
|
|
89
108
|
for (const hostRule of hostRules) if (!hostRule.hostType || gitAllowedHostTypes.has(hostRule.hostType)) gitEnvironmentVariables = addAuthFromHostRule(hostRule, gitEnvironmentVariables);
|
|
109
|
+
if (url) for (const hostType of hostTypes) gitEnvironmentVariables = getGitUrlEnvironmentVariables(gitEnvironmentVariables, url, hostType);
|
|
90
110
|
return gitEnvironmentVariables;
|
|
91
111
|
}
|
|
92
112
|
function addAuthFromHostRule(hostRule, environmentVariables) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","names":[],"sources":["../../../lib/util/git/auth.ts"],"sourcesContent":["import { isEmptyString } from '@sindresorhus/is';\nimport { PLATFORM_HOST_TYPES } from '../../constants/platforms.ts';\nimport { logger } from '../../logger/index.ts';\nimport type { HostRule } from '../../types/index.ts';\nimport { detectPlatform } from '../common.ts';\nimport type { ResolvedChildEnv } from '../exec/utils.ts';\nimport { find, getAll } from '../host-rules.ts';\nimport { regEx } from '../regex.ts';\nimport { createURLFromHostOrURL, isHttpUrl } from '../url.ts';\nimport { addGitConfigEnvironmentVariables } from './config.ts';\nimport type { AuthenticationRule } from './types.ts';\nimport { getTokenCredentials, parseGitUrl } from './url.ts';\n\nconst platformHostTypes = new Set<string>(PLATFORM_HOST_TYPES);\n\nconst githubApiUrls = new Set([\n 'github.com',\n 'api.github.com',\n 'https://api.github.com',\n 'https://api.github.com/',\n]);\n\n/**\n * Append Git authentication configuration to a resolved child environment.\n * @returns a new environment without modifying the input\n */\nexport function getGitAuthenticatedEnvironmentVariables(\n environmentVariables: Readonly<ResolvedChildEnv>,\n originalGitUrl: string,\n { token, username, password, hostType, matchHost }: HostRule,\n): ResolvedChildEnv {\n if (!token && !(username && password)) {\n logger.warn(\n { host: matchHost },\n `Could not create environment variable for host as neither token or username and password was set`,\n );\n return { ...environmentVariables };\n }\n\n let authenticationRules: AuthenticationRule[];\n if (token) {\n authenticationRules = getAuthenticationRulesWithToken(\n originalGitUrl,\n hostType,\n token,\n );\n } else {\n const encodedUsername = encodeURIComponent(username!);\n const encodedPassword = encodeURIComponent(password!);\n\n authenticationRules = getAuthenticationRules(\n originalGitUrl,\n hostType,\n `${encodedUsername}:${encodedPassword}`,\n );\n }\n\n return addGitConfigEnvironmentVariables(\n environmentVariables,\n authenticationRules.map((rule) => ({\n key: `url.${rule.url}.insteadOf`,\n value: rule.insteadOf,\n })),\n );\n}\n\nfunction getAuthenticationRulesWithToken(\n url: string,\n hostType: string | undefined | null,\n authToken: string,\n): AuthenticationRule[] {\n const type = hostType ?? detectPlatform(url);\n const platform =\n hostType && platformHostTypes.has(hostType)\n ? hostType\n : detectPlatform(url);\n return getAuthenticationRules(\n url,\n type,\n getTokenCredentials(platform, authToken),\n );\n}\n\n/**\n * Generates the authentication rules for later git usage for the given host\n * @link https://coolaj86.com/articles/vanilla-devops-git-credentials-cheatsheet/\n * @param gitUrl Git repository URL\n * @param hostType Git host type\n * @param token Authentication token or `username:password` string\n */\nexport function getAuthenticationRules(\n gitUrl: string,\n hostType: string | undefined | null,\n token: string,\n): AuthenticationRule[] {\n const authenticationRules = [];\n const hasUser = token.split(':').length > 1;\n const insteadUrl = parseGitUrl(gitUrl);\n let sshPort = insteadUrl.port;\n\n if (hostType === 'bitbucket-server') {\n // For Bitbucket Server/Data Center, `source` must be `bitbucket-server`\n // to generate HTTP(s) URLs correctly.\n // https://github.com/IonicaBizau/git-url-parse/blob/28828546c148d58bbcff61409915a4e1e8f7eb11/lib/index.js#L304\n insteadUrl.source = 'bitbucket-server';\n\n // sshPort is string, wrong type!\n // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/72361\n // https://github.com/IonicaBizau/parse-path/blob/87f71f273da90f85f6845937a70b7c032eeae4e3/lib/index.js#L45\n // v8 ignore next -- TODO: add test #40625\n if (!sshPort || isEmptyString(sshPort)) {\n // By default, bitbucket-server SSH port is 7999.\n // For non-default port, the generated auth config will likely be incorrect.\n sshPort = '7999';\n }\n }\n\n const url = { ...insteadUrl };\n // git-url-parse would prefix `x-token-auth:` again on bitbucket.org\n if (hasUser && url.source === 'bitbucket.org') {\n url.source = 'bitbucket';\n }\n const protocol = regEx(/^https?$/).test(url.protocol)\n ? url.protocol\n : 'https';\n\n // ssh protocol with user if empty\n url.token = hasUser ? token : `ssh:${token}`;\n authenticationRules.push({\n url: url.toString(protocol),\n // only edge case, need to stringify ourself because the exact syntax is not supported by the library\n // https://github.com/IonicaBizau/git-url-parse/blob/246c9119fb42c2ea1c280028fe77c53eb34c190c/lib/index.js#L246\n insteadOf: `ssh://git@${insteadUrl.resource}${\n sshPort ? `:${sshPort}` : ''\n }/${insteadUrl.full_name}${insteadUrl.git_suffix ? '.git' : ''}`,\n });\n\n // alternative ssh protocol with user if empty\n url.token = hasUser ? token : `git:${token}`;\n authenticationRules.push({\n url: url.toString(protocol),\n insteadOf: { ...insteadUrl, port: sshPort }.toString('ssh'),\n });\n\n // https protocol with no user as default fallback\n url.token = token;\n authenticationRules.push({\n url: url.toString(protocol),\n insteadOf: insteadUrl.toString(protocol),\n });\n\n return authenticationRules;\n}\n\nexport function getGitEnvironmentVariables(\n environmentVariables: Readonly<ResolvedChildEnv>,\n hostTypes: readonly string[] = [],\n): ResolvedChildEnv {\n let gitEnvironmentVariables: ResolvedChildEnv = { ...environmentVariables };\n\n // hard-coded logic to use authentication for github.com based on the githubToken for api.github.com\n const gitHubHostRule = find({\n hostType: 'github',\n url: 'https://api.github.com/',\n });\n\n if (gitHubHostRule?.token) {\n gitEnvironmentVariables = getGitAuthenticatedEnvironmentVariables(\n gitEnvironmentVariables,\n 'https://github.com/',\n gitHubHostRule,\n );\n }\n\n // Manager-scoped rules are opt-in so unrelated credentials are not exposed to Git.\n const gitAllowedHostTypes = new Set<string>([\n ...PLATFORM_HOST_TYPES,\n ...hostTypes,\n ]);\n\n // filter rules without `matchHost` and `token` or username and password and github api github rules\n const hostRules = getAll()\n .filter((r) => r.matchHost && (r.token ?? (r.username && r.password)))\n .filter((r) => !gitHubHostRule || !githubApiUrls.has(r.matchHost!));\n\n // for each hostRule without hostType we add additional authentication variables to the environmentVariables\n // for each hostRule with hostType we add additional authentication variables to the environmentVariables\n for (const hostRule of hostRules) {\n if (!hostRule.hostType || gitAllowedHostTypes.has(hostRule.hostType)) {\n gitEnvironmentVariables = addAuthFromHostRule(\n hostRule,\n gitEnvironmentVariables,\n );\n }\n }\n return gitEnvironmentVariables;\n}\n\nfunction addAuthFromHostRule(\n hostRule: HostRule,\n environmentVariables: Readonly<ResolvedChildEnv>,\n): ResolvedChildEnv {\n const httpUrl = createURLFromHostOrURL(hostRule.matchHost!)?.toString();\n if (isHttpUrl(httpUrl)) {\n logger.trace(`Adding Git authentication for ${httpUrl} using token auth.`);\n return getGitAuthenticatedEnvironmentVariables(\n environmentVariables,\n httpUrl!,\n hostRule,\n );\n }\n\n logger.debug(\n `Could not parse registryUrl ${hostRule.matchHost!} or not using http(s). Ignoring`,\n );\n return { ...environmentVariables };\n}\n"],"mappings":";;;;;;;;;;AAaA,MAAM,oBAAoB,IAAI,IAAY,mBAAmB;AAE7D,MAAM,gCAA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gCACrD;CACA,OAAO,EAAE,GAAG,qBAAqB;AACnC"}
|
|
1
|
+
{"version":3,"file":"auth.js","names":[],"sources":["../../../lib/util/git/auth.ts"],"sourcesContent":["import { isEmptyString } from '@sindresorhus/is';\nimport { PLATFORM_HOST_TYPES } from '../../constants/platforms.ts';\nimport { logger } from '../../logger/index.ts';\nimport type { HostRule } from '../../types/index.ts';\nimport { detectPlatform } from '../common.ts';\nimport type { ResolvedChildEnv } from '../exec/utils.ts';\nimport { find, findDetachedCredentials, getAll } from '../host-rules.ts';\nimport { regEx } from '../regex.ts';\nimport { createURLFromHostOrURL, isHttpUrl } from '../url.ts';\nimport { addGitConfigEnvironmentVariables } from './config.ts';\nimport type { AuthenticationRule } from './types.ts';\nimport { getTokenCredentials, parseGitUrl } from './url.ts';\n\nconst platformHostTypes = new Set<string>(PLATFORM_HOST_TYPES);\n\nconst githubApiUrls = new Set([\n 'github.com',\n 'api.github.com',\n 'https://api.github.com',\n 'https://api.github.com/',\n]);\n\n/**\n * Append Git authentication configuration to a resolved child environment.\n * @returns a new environment without modifying the input\n */\nexport function getGitAuthenticatedEnvironmentVariables(\n environmentVariables: Readonly<ResolvedChildEnv>,\n originalGitUrl: string,\n { token, username, password, hostType, matchHost }: HostRule,\n): ResolvedChildEnv {\n if (!token && !(username && password)) {\n logger.warn(\n { host: matchHost },\n `Could not create environment variable for host as neither token or username and password was set`,\n );\n return { ...environmentVariables };\n }\n\n let authenticationRules: AuthenticationRule[];\n if (token) {\n authenticationRules = getAuthenticationRulesWithToken(\n originalGitUrl,\n hostType,\n token,\n );\n } else {\n const encodedUsername = encodeURIComponent(username!);\n const encodedPassword = encodeURIComponent(password!);\n\n authenticationRules = getAuthenticationRules(\n originalGitUrl,\n hostType,\n `${encodedUsername}:${encodedPassword}`,\n );\n }\n\n return addGitConfigEnvironmentVariables(\n environmentVariables,\n authenticationRules.map((rule) => ({\n key: `url.${rule.url}.insteadOf`,\n value: rule.insteadOf,\n })),\n );\n}\n\nfunction getAuthenticationRulesWithToken(\n url: string,\n hostType: string | undefined | null,\n authToken: string,\n): AuthenticationRule[] {\n const type = hostType ?? detectPlatform(url);\n const platform =\n hostType && platformHostTypes.has(hostType)\n ? hostType\n : detectPlatform(url);\n return getAuthenticationRules(\n url,\n type,\n getTokenCredentials(platform, authToken),\n );\n}\n\n/**\n * Generates the authentication rules for later git usage for the given host\n * @link https://coolaj86.com/articles/vanilla-devops-git-credentials-cheatsheet/\n * @param gitUrl Git repository URL\n * @param hostType Git host type\n * @param token Authentication token or `username:password` string\n */\nexport function getAuthenticationRules(\n gitUrl: string,\n hostType: string | undefined | null,\n token: string,\n): AuthenticationRule[] {\n const authenticationRules = [];\n const hasUser = token.split(':').length > 1;\n const insteadUrl = parseGitUrl(gitUrl);\n let sshPort = insteadUrl.port;\n\n if (hostType === 'bitbucket-server') {\n // For Bitbucket Server/Data Center, `source` must be `bitbucket-server`\n // to generate HTTP(s) URLs correctly.\n // https://github.com/IonicaBizau/git-url-parse/blob/28828546c148d58bbcff61409915a4e1e8f7eb11/lib/index.js#L304\n insteadUrl.source = 'bitbucket-server';\n\n // sshPort is string, wrong type!\n // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/72361\n // https://github.com/IonicaBizau/parse-path/blob/87f71f273da90f85f6845937a70b7c032eeae4e3/lib/index.js#L45\n // v8 ignore next -- TODO: add test #40625\n if (!sshPort || isEmptyString(sshPort)) {\n // By default, bitbucket-server SSH port is 7999.\n // For non-default port, the generated auth config will likely be incorrect.\n sshPort = '7999';\n }\n }\n\n const url = { ...insteadUrl };\n // git-url-parse would prefix `x-token-auth:` again on bitbucket.org\n if (hasUser && url.source === 'bitbucket.org') {\n url.source = 'bitbucket';\n }\n const protocol = regEx(/^https?$/).test(url.protocol)\n ? url.protocol\n : 'https';\n\n // ssh protocol with user if empty\n url.token = hasUser ? token : `ssh:${token}`;\n authenticationRules.push({\n url: url.toString(protocol),\n // only edge case, need to stringify ourself because the exact syntax is not supported by the library\n // https://github.com/IonicaBizau/git-url-parse/blob/246c9119fb42c2ea1c280028fe77c53eb34c190c/lib/index.js#L246\n insteadOf: `ssh://git@${insteadUrl.resource}${\n sshPort ? `:${sshPort}` : ''\n }/${insteadUrl.full_name}${insteadUrl.git_suffix ? '.git' : ''}`,\n });\n\n // alternative ssh protocol with user if empty\n url.token = hasUser ? token : `git:${token}`;\n authenticationRules.push({\n url: url.toString(protocol),\n insteadOf: { ...insteadUrl, port: sshPort }.toString('ssh'),\n });\n\n // https protocol with no user as default fallback\n url.token = token;\n authenticationRules.push({\n url: url.toString(protocol),\n insteadOf: insteadUrl.toString(protocol),\n });\n\n return authenticationRules;\n}\n\n/**\n * Appends Git authentication for the repository `url` from the credentials registered from URL credentials for it with `hostType`, a username without a password as a percent-encoded token; configured host rules come through `getAll()` instead.\n * @returns a new environment without modifying the input\n */\nfunction getGitUrlEnvironmentVariables(\n environmentVariables: Readonly<ResolvedChildEnv>,\n url: string,\n hostType: string,\n): ResolvedChildEnv {\n const credentials = findDetachedCredentials({ hostType, url });\n if (!credentials?.username) {\n return { ...environmentVariables };\n }\n const auth: HostRule = credentials.password\n ? credentials\n : { token: encodeURIComponent(credentials.username) };\n return getGitAuthenticatedEnvironmentVariables(environmentVariables, url, {\n ...auth,\n hostType,\n });\n}\n\n/**\n * Appends Git authentication from the host rules with a `matchHost` for the platform host types and `hostTypes`, and, when `url` is given, for that single repository from the credentials registered from URL credentials for it with each of `hostTypes`.\n * @returns a new environment without modifying the input\n */\nexport function getGitEnvironmentVariables(\n environmentVariables: Readonly<ResolvedChildEnv>,\n hostTypes: readonly string[] = [],\n url?: string,\n): ResolvedChildEnv {\n let gitEnvironmentVariables: ResolvedChildEnv = { ...environmentVariables };\n\n // hard-coded logic to use authentication for github.com based on the githubToken for api.github.com\n const gitHubHostRule = find({\n hostType: 'github',\n url: 'https://api.github.com/',\n });\n\n if (gitHubHostRule?.token) {\n gitEnvironmentVariables = getGitAuthenticatedEnvironmentVariables(\n gitEnvironmentVariables,\n 'https://github.com/',\n gitHubHostRule,\n );\n }\n\n // Manager-scoped rules are opt-in so unrelated credentials are not exposed to Git.\n const gitAllowedHostTypes = new Set<string>([\n ...PLATFORM_HOST_TYPES,\n ...hostTypes,\n ]);\n\n // filter rules without `matchHost` and `token` or username and password and github api github rules\n const hostRules = getAll()\n .filter((r) => r.matchHost && (r.token ?? (r.username && r.password)))\n .filter((r) => !gitHubHostRule || !githubApiUrls.has(r.matchHost!));\n\n // for each hostRule without hostType we add additional authentication variables to the environmentVariables\n // for each hostRule with hostType we add additional authentication variables to the environmentVariables\n for (const hostRule of hostRules) {\n if (!hostRule.hostType || gitAllowedHostTypes.has(hostRule.hostType)) {\n gitEnvironmentVariables = addAuthFromHostRule(\n hostRule,\n gitEnvironmentVariables,\n );\n }\n }\n\n // `getAll()` leaves out the rules registered from URL credentials, which only apply to the repository they came from\n if (url) {\n for (const hostType of hostTypes) {\n gitEnvironmentVariables = getGitUrlEnvironmentVariables(\n gitEnvironmentVariables,\n url,\n hostType,\n );\n }\n }\n return gitEnvironmentVariables;\n}\n\nfunction addAuthFromHostRule(\n hostRule: HostRule,\n environmentVariables: Readonly<ResolvedChildEnv>,\n): ResolvedChildEnv {\n const httpUrl = createURLFromHostOrURL(hostRule.matchHost!)?.toString();\n if (isHttpUrl(httpUrl)) {\n logger.trace(`Adding Git authentication for ${httpUrl} using token auth.`);\n return getGitAuthenticatedEnvironmentVariables(\n environmentVariables,\n httpUrl!,\n hostRule,\n );\n }\n\n logger.debug(\n `Could not parse registryUrl ${hostRule.matchHost!} or not using http(s). Ignoring`,\n );\n return { ...environmentVariables };\n}\n"],"mappings":";;;;;;;;;;AAaA,MAAM,oBAAoB,IAAI,IAAY,mBAAmB;AAE7D,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,SAAgB,wCACd,sBACA,gBACA,EAAE,OAAO,UAAU,UAAU,UAAU,aACrB;CAClB,IAAI,CAAC,SAAS,EAAE,YAAY,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B;CAClB,MAAM,UAAU,uBAAuB,SAAS,SAAU,CAAC,EAAE,SAAS;CACtE,IAAI,UAAU,OAAO,GAAG;EACtB,OAAO,MAAM,iCAAiC,QAAQ,mBAAmB;EACzE,OAAO,wCACL,sBACA,SACA,QACF;CACF;CAEA,OAAO,MACL,+BAA+B,SAAS,UAAW,gCACrD;CACA,OAAO,EAAE,GAAG,qBAAqB;AACnC"}
|
package/dist/util/git/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ interface CreateSimpleGitOptions {
|
|
|
14
14
|
env?: ExtraEnv;
|
|
15
15
|
authentication?: {
|
|
16
16
|
hostTypes?: readonly string[];
|
|
17
|
+
/** the URL of the cloned repository: adds the credentials which `detachUrlCredentials()` registered for it with one of `hostTypes` */
|
|
18
|
+
url?: string;
|
|
17
19
|
};
|
|
18
20
|
}
|
|
19
21
|
export declare function createSimpleGit({ config, env, authentication }?: CreateSimpleGitOptions): SimpleGit;
|
package/dist/util/git/index.js
CHANGED
|
@@ -49,7 +49,7 @@ function createSimpleGit({ config, env, authentication } = {}) {
|
|
|
49
49
|
LC_ALL: "C.UTF-8"
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
const gitEnv = authentication ? getGitEnvironmentVariables(childEnv, authentication.hostTypes) : childEnv;
|
|
52
|
+
const gitEnv = authentication ? getGitEnvironmentVariables(childEnv, authentication.hostTypes, authentication.url) : childEnv;
|
|
53
53
|
return simpleGit({
|
|
54
54
|
...simpleGitConfig(),
|
|
55
55
|
allowEnvironment: Object.keys(gitEnv),
|