Merge pull request #1329 from mikepenz/feature/dependency_upgrades_20240410

Upgrade dependencies to their latest version
This commit is contained in:
Mike Penz
2024-04-10 14:02:54 +02:00
committed by GitHub
5 changed files with 1101 additions and 715 deletions
Generated Vendored
+431 -68
View File
@@ -480,8 +480,8 @@ class GitCommandManager {
return result; return result;
}); });
} }
execGit(args, allowAllExitCodes = false, silent = false) { execGit(args_1) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, arguments, void 0, function* (args, allowAllExitCodes = false, silent = false) {
(0, utils_1.directoryExistsSync)(this.workingDirectory, true); (0, utils_1.directoryExistsSync)(this.workingDirectory, true);
const result = new GitOutput(); const result = new GitOutput();
const stdout = []; const stdout = [];
@@ -1204,8 +1204,8 @@ class Tags {
}); });
} }
retrieveRange(repositoryPath, owner, repo, fromTag, toTag, ignorePreReleases, maxTagsToFetch, tagResolver) { retrieveRange(repositoryPath, owner, repo, fromTag, toTag, ignorePreReleases, maxTagsToFetch, tagResolver) {
var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
let tags = []; let tags = [];
if (!toTag || !fromTag) { if (!toTag || !fromTag) {
const filterRegex = (0, regexUtils_1.validateRegex)(tagResolver.filter); const filterRegex = (0, regexUtils_1.validateRegex)(tagResolver.filter);
@@ -2080,8 +2080,8 @@ class GiteaRepository extends BaseRepository_1.BaseRepository {
}); });
} }
getTags(owner, repo, maxTagsToFetch) { getTags(owner, repo, maxTagsToFetch) {
var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
core.debug(`Start to get tag from gitea`); core.debug(`Start to get tag from gitea`);
const response = yield this.api.repos.repoListTags(owner, repo, { const response = yield this.api.repos.repoListTags(owner, repo, {
limit: maxTagsToFetch limit: maxTagsToFetch
@@ -2168,8 +2168,8 @@ const core = __importStar(__nccwpck_require__(2186));
const moment_1 = __importDefault(__nccwpck_require__(9623)); const moment_1 = __importDefault(__nccwpck_require__(9623));
class GithubRepository extends BaseRepository_1.BaseRepository { class GithubRepository extends BaseRepository_1.BaseRepository {
getDiffRemote(owner, repo, base, head) { getDiffRemote(owner, repo, base, head) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a, _b;
let changedFilesCount = 0; let changedFilesCount = 0;
let additionCount = 0; let additionCount = 0;
let deletionCount = 0; let deletionCount = 0;
@@ -2229,8 +2229,8 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
}); });
} }
getForCommitHash(owner, repo, commit_sha, maxPullRequests) { getForCommitHash(owner, repo, commit_sha, maxPullRequests) {
var _a, e_1, _b, _c;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a, e_1, _b, _c;
const mergedPRs = []; const mergedPRs = [];
const options = this.octokit.repos.listPullRequestsAssociatedWithCommit.endpoint.merge({ const options = this.octokit.repos.listPullRequestsAssociatedWithCommit.endpoint.merge({
owner, owner,
@@ -2261,8 +2261,8 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
}); });
} }
getBetweenDates(owner, repo, fromDate, toDate, maxPullRequests) { getBetweenDates(owner, repo, fromDate, toDate, maxPullRequests) {
var _a, e_2, _b, _c;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a, e_2, _b, _c;
const mergedPRs = []; const mergedPRs = [];
const options = this.octokit.pulls.list.endpoint.merge({ const options = this.octokit.pulls.list.endpoint.merge({
owner, owner,
@@ -2307,8 +2307,8 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
}); });
} }
getOpen(owner, repo, maxPullRequests) { getOpen(owner, repo, maxPullRequests) {
var _a, e_3, _b, _c;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a, e_3, _b, _c;
const openPrs = []; const openPrs = [];
const options = this.octokit.pulls.list.endpoint.merge({ const options = this.octokit.pulls.list.endpoint.merge({
owner, owner,
@@ -2347,8 +2347,8 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
}); });
} }
getReviews(owner, repo, pr) { getReviews(owner, repo, pr) {
var _a, e_4, _b, _c;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a, e_4, _b, _c;
const options = this.octokit.pulls.listReviews.endpoint.merge({ const options = this.octokit.pulls.listReviews.endpoint.merge({
owner, owner,
repo, repo,
@@ -2438,8 +2438,8 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
} }
} }
getTags(owner, repo, maxTagsToFetch) { getTags(owner, repo, maxTagsToFetch) {
var _a, e_5, _b, _c;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a, e_5, _b, _c;
const tagsInfo = []; const tagsInfo = [];
const options = this.octokit.repos.listTags.endpoint.merge({ const options = this.octokit.repos.listTags.endpoint.merge({
owner, owner,
@@ -6011,7 +6011,7 @@ class HttpClient {
if (this._keepAlive && useProxy) { if (this._keepAlive && useProxy) {
agent = this._proxyAgent; agent = this._proxyAgent;
} }
if (this._keepAlive && !useProxy) { if (!useProxy) {
agent = this._agent; agent = this._agent;
} }
// if agent is already assigned use that agent. // if agent is already assigned use that agent.
@@ -6043,16 +6043,12 @@ class HttpClient {
agent = tunnelAgent(agentOptions); agent = tunnelAgent(agentOptions);
this._proxyAgent = agent; this._proxyAgent = agent;
} }
// if reusing agent across request and tunneling agent isn't assigned create a new agent // if tunneling agent isn't assigned create a new agent
if (this._keepAlive && !agent) { if (!agent) {
const options = { keepAlive: this._keepAlive, maxSockets }; const options = { keepAlive: this._keepAlive, maxSockets };
agent = usingSsl ? new https.Agent(options) : new http.Agent(options); agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
this._agent = agent; this._agent = agent;
} }
// if not using private agent and tunnel agent isn't setup then use global agent
if (!agent) {
agent = usingSsl ? https.globalAgent : http.globalAgent;
}
if (usingSsl && this._ignoreSslError) { if (usingSsl && this._ignoreSslError) {
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
@@ -6872,7 +6868,7 @@ var import_graphql = __nccwpck_require__(8467);
var import_auth_token = __nccwpck_require__(334); var import_auth_token = __nccwpck_require__(334);
// pkg/dist-src/version.js // pkg/dist-src/version.js
var VERSION = "5.1.0"; var VERSION = "5.2.0";
// pkg/dist-src/index.js // pkg/dist-src/index.js
var noop = () => { var noop = () => {
@@ -7039,7 +7035,7 @@ module.exports = __toCommonJS(dist_src_exports);
var import_universal_user_agent = __nccwpck_require__(5030); var import_universal_user_agent = __nccwpck_require__(5030);
// pkg/dist-src/version.js // pkg/dist-src/version.js
var VERSION = "9.0.4"; var VERSION = "9.0.5";
// pkg/dist-src/defaults.js // pkg/dist-src/defaults.js
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`; var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
@@ -7424,7 +7420,7 @@ var import_request3 = __nccwpck_require__(6234);
var import_universal_user_agent = __nccwpck_require__(5030); var import_universal_user_agent = __nccwpck_require__(5030);
// pkg/dist-src/version.js // pkg/dist-src/version.js
var VERSION = "7.0.2"; var VERSION = "7.1.0";
// pkg/dist-src/with-defaults.js // pkg/dist-src/with-defaults.js
var import_request2 = __nccwpck_require__(6234); var import_request2 = __nccwpck_require__(6234);
@@ -10309,7 +10305,7 @@ var import_endpoint = __nccwpck_require__(9440);
var import_universal_user_agent = __nccwpck_require__(5030); var import_universal_user_agent = __nccwpck_require__(5030);
// pkg/dist-src/version.js // pkg/dist-src/version.js
var VERSION = "8.2.0"; var VERSION = "8.4.0";
// pkg/dist-src/is-plain-object.js // pkg/dist-src/is-plain-object.js
function isPlainObject(value) { function isPlainObject(value) {
@@ -10334,7 +10330,7 @@ function getBufferResponse(response) {
// pkg/dist-src/fetch-wrapper.js // pkg/dist-src/fetch-wrapper.js
function fetchWrapper(requestOptions) { function fetchWrapper(requestOptions) {
var _a, _b, _c; var _a, _b, _c, _d;
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false;
if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) { if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
@@ -10355,8 +10351,9 @@ function fetchWrapper(requestOptions) {
return fetch(requestOptions.url, { return fetch(requestOptions.url, {
method: requestOptions.method, method: requestOptions.method,
body: requestOptions.body, body: requestOptions.body,
redirect: (_c = requestOptions.request) == null ? void 0 : _c.redirect,
headers: requestOptions.headers, headers: requestOptions.headers,
signal: (_c = requestOptions.request) == null ? void 0 : _c.signal, signal: (_d = requestOptions.request) == null ? void 0 : _d.signal,
// duplex must be set if request.body is ReadableStream or Async Iterables. // duplex must be set if request.body is ReadableStream or Async Iterables.
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex. // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
...requestOptions.body && { duplex: "half" } ...requestOptions.body && { duplex: "half" }
@@ -10540,7 +10537,7 @@ var import_plugin_paginate_rest = __nccwpck_require__(4193);
var import_plugin_rest_endpoint_methods = __nccwpck_require__(3044); var import_plugin_rest_endpoint_methods = __nccwpck_require__(3044);
// pkg/dist-src/version.js // pkg/dist-src/version.js
var VERSION = "20.0.2"; var VERSION = "20.1.0";
// pkg/dist-src/index.js // pkg/dist-src/index.js
var Octokit = import_core.Octokit.plugin( var Octokit = import_core.Octokit.plugin(
@@ -10662,7 +10659,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Agent = void 0; exports.Agent = void 0;
const net = __importStar(__nccwpck_require__(1808));
const http = __importStar(__nccwpck_require__(3685)); const http = __importStar(__nccwpck_require__(3685));
const https_1 = __nccwpck_require__(5687);
__exportStar(__nccwpck_require__(8348), exports); __exportStar(__nccwpck_require__(8348), exports);
const INTERNAL = Symbol('AgentBaseInternalState'); const INTERNAL = Symbol('AgentBaseInternalState');
class Agent extends http.Agent { class Agent extends http.Agent {
@@ -10699,14 +10698,72 @@ class Agent extends http.Agent {
.some((l) => l.indexOf('(https.js:') !== -1 || .some((l) => l.indexOf('(https.js:') !== -1 ||
l.indexOf('node:https:') !== -1); l.indexOf('node:https:') !== -1);
} }
// In order to support async signatures in `connect()` and Node's native
// connection pooling in `http.Agent`, the array of sockets for each origin
// has to be updated synchronously. This is so the length of the array is
// accurate when `addRequest()` is next called. We achieve this by creating a
// fake socket and adding it to `sockets[origin]` and incrementing
// `totalSocketCount`.
incrementSockets(name) {
// If `maxSockets` and `maxTotalSockets` are both Infinity then there is no
// need to create a fake socket because Node.js native connection pooling
// will never be invoked.
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
return null;
}
// All instances of `sockets` are expected TypeScript errors. The
// alternative is to add it as a private property of this class but that
// will break TypeScript subclassing.
if (!this.sockets[name]) {
// @ts-expect-error `sockets` is readonly in `@types/node`
this.sockets[name] = [];
}
const fakeSocket = new net.Socket({ writable: false });
this.sockets[name].push(fakeSocket);
// @ts-expect-error `totalSocketCount` isn't defined in `@types/node`
this.totalSocketCount++;
return fakeSocket;
}
decrementSockets(name, socket) {
if (!this.sockets[name] || socket === null) {
return;
}
const sockets = this.sockets[name];
const index = sockets.indexOf(socket);
if (index !== -1) {
sockets.splice(index, 1);
// @ts-expect-error `totalSocketCount` isn't defined in `@types/node`
this.totalSocketCount--;
if (sockets.length === 0) {
// @ts-expect-error `sockets` is readonly in `@types/node`
delete this.sockets[name];
}
}
}
// In order to properly update the socket pool, we need to call `getName()` on
// the core `https.Agent` if it is a secureEndpoint.
getName(options) {
const secureEndpoint = typeof options.secureEndpoint === 'boolean'
? options.secureEndpoint
: this.isSecureEndpoint(options);
if (secureEndpoint) {
// @ts-expect-error `getName()` isn't defined in `@types/node`
return https_1.Agent.prototype.getName.call(this, options);
}
// @ts-expect-error `getName()` isn't defined in `@types/node`
return super.getName(options);
}
createSocket(req, options, cb) { createSocket(req, options, cb) {
const connectOpts = { const connectOpts = {
...options, ...options,
secureEndpoint: this.isSecureEndpoint(options), secureEndpoint: this.isSecureEndpoint(options),
}; };
const name = this.getName(connectOpts);
const fakeSocket = this.incrementSockets(name);
Promise.resolve() Promise.resolve()
.then(() => this.connect(req, connectOpts)) .then(() => this.connect(req, connectOpts))
.then((socket) => { .then((socket) => {
this.decrementSockets(name, fakeSocket);
if (socket instanceof http.Agent) { if (socket instanceof http.Agent) {
// @ts-expect-error `addRequest()` isn't defined in `@types/node` // @ts-expect-error `addRequest()` isn't defined in `@types/node`
return socket.addRequest(req, connectOpts); return socket.addRequest(req, connectOpts);
@@ -10714,7 +10771,10 @@ class Agent extends http.Agent {
this[INTERNAL].currentSocket = socket; this[INTERNAL].currentSocket = socket;
// @ts-expect-error `createSocket()` isn't defined in `@types/node` // @ts-expect-error `createSocket()` isn't defined in `@types/node`
super.createSocket(req, options, cb); super.createSocket(req, options, cb);
}, cb); }, (err) => {
this.decrementSockets(name, fakeSocket);
cb(err);
});
} }
createConnection() { createConnection() {
const socket = this[INTERNAL].currentSocket; const socket = this[INTERNAL].currentSocket;
@@ -12712,6 +12772,35 @@ var Api = class extends HttpClient {
query, query,
secure: true secure: true
}, params)), }, params)),
/**
* No description
*
* @tags organization
* @name OrgUpdateAvatar
* @summary Update Avatar
* @request POST:/orgs/{org}/avatar
* @secure
*/
orgUpdateAvatar: (org, body, params = {}) => this.request(__spreadValues({
path: `/orgs/${org}/avatar`,
method: "POST",
body,
secure: true
}, params)),
/**
* No description
*
* @tags organization
* @name OrgDeleteAvatar
* @summary Delete Avatar
* @request DELETE:/orgs/{org}/avatar
* @secure
*/
orgDeleteAvatar: (org, params = {}) => this.request(__spreadValues({
path: `/orgs/${org}/avatar`,
method: "DELETE",
secure: true
}, params)),
/** /**
* No description * No description
* *
@@ -13234,6 +13323,36 @@ var Api = class extends HttpClient {
method: "GET", method: "GET",
secure: true secure: true
}, params)), }, params)),
/**
* No description
*
* @tags repository
* @name RepoUpdateAvatar
* @summary Update avatar
* @request POST:/repos/{owner}/{repo}/avatar
* @secure
*/
repoUpdateAvatar: (owner, repo, body, params = {}) => this.request(__spreadValues({
path: `/repos/${owner}/${repo}/avatar`,
method: "POST",
body,
secure: true,
type: "application/json" /* Json */
}, params)),
/**
* No description
*
* @tags repository
* @name RepoDeleteAvatar
* @summary Delete avatar
* @request DELETE:/repos/{owner}/{repo}/avatar
* @secure
*/
repoDeleteAvatar: (owner, repo, params = {}) => this.request(__spreadValues({
path: `/repos/${owner}/${repo}/avatar`,
method: "DELETE",
secure: true
}, params)),
/** /**
* No description * No description
* *
@@ -16568,6 +16687,35 @@ var Api = class extends HttpClient {
body, body,
secure: true secure: true
}, params)), }, params)),
/**
* No description
*
* @tags user
* @name UserUpdateAvatar
* @summary Update Avatar
* @request POST:/user/avatar
* @secure
*/
userUpdateAvatar: (body, params = {}) => this.request(__spreadValues({
path: `/user/avatar`,
method: "POST",
body,
secure: true
}, params)),
/**
* No description
*
* @tags user
* @name UserDeleteAvatar
* @summary Delete Avatar
* @request DELETE:/user/avatar
* @secure
*/
userDeleteAvatar: (params = {}) => this.request(__spreadValues({
path: `/user/avatar`,
method: "DELETE",
secure: true
}, params)),
/** /**
* No description * No description
* *
@@ -17390,7 +17538,7 @@ function giteaApi(baseUrl, options) {
return { return {
secure: true, secure: true,
headers: { headers: {
Authorization: `token ${options.token}` Authorization: `Bearer ${options.token}`
} }
}; };
} }
@@ -17400,7 +17548,7 @@ function giteaApi(baseUrl, options) {
0 && (0); 0 && (0);
/** /**
* @title Gitea API. * @title Gitea API.
* @version 1.20.1 * @version 1.21.0+dev-326-g28ecac802
* @license MIT (http://opensource.org/licenses/MIT) * @license MIT (http://opensource.org/licenses/MIT)
* @baseUrl /api/v1 * @baseUrl /api/v1
* *
@@ -33663,6 +33811,132 @@ function onConnectTimeout (socket) {
module.exports = buildConnector module.exports = buildConnector
/***/ }),
/***/ 4462:
/***/ ((module) => {
"use strict";
/** @type {Record<string, string | undefined>} */
const headerNameLowerCasedRecord = {}
// https://developer.mozilla.org/docs/Web/HTTP/Headers
const wellknownHeaderNames = [
'Accept',
'Accept-Encoding',
'Accept-Language',
'Accept-Ranges',
'Access-Control-Allow-Credentials',
'Access-Control-Allow-Headers',
'Access-Control-Allow-Methods',
'Access-Control-Allow-Origin',
'Access-Control-Expose-Headers',
'Access-Control-Max-Age',
'Access-Control-Request-Headers',
'Access-Control-Request-Method',
'Age',
'Allow',
'Alt-Svc',
'Alt-Used',
'Authorization',
'Cache-Control',
'Clear-Site-Data',
'Connection',
'Content-Disposition',
'Content-Encoding',
'Content-Language',
'Content-Length',
'Content-Location',
'Content-Range',
'Content-Security-Policy',
'Content-Security-Policy-Report-Only',
'Content-Type',
'Cookie',
'Cross-Origin-Embedder-Policy',
'Cross-Origin-Opener-Policy',
'Cross-Origin-Resource-Policy',
'Date',
'Device-Memory',
'Downlink',
'ECT',
'ETag',
'Expect',
'Expect-CT',
'Expires',
'Forwarded',
'From',
'Host',
'If-Match',
'If-Modified-Since',
'If-None-Match',
'If-Range',
'If-Unmodified-Since',
'Keep-Alive',
'Last-Modified',
'Link',
'Location',
'Max-Forwards',
'Origin',
'Permissions-Policy',
'Pragma',
'Proxy-Authenticate',
'Proxy-Authorization',
'RTT',
'Range',
'Referer',
'Referrer-Policy',
'Refresh',
'Retry-After',
'Sec-WebSocket-Accept',
'Sec-WebSocket-Extensions',
'Sec-WebSocket-Key',
'Sec-WebSocket-Protocol',
'Sec-WebSocket-Version',
'Server',
'Server-Timing',
'Service-Worker-Allowed',
'Service-Worker-Navigation-Preload',
'Set-Cookie',
'SourceMap',
'Strict-Transport-Security',
'Supports-Loading-Mode',
'TE',
'Timing-Allow-Origin',
'Trailer',
'Transfer-Encoding',
'Upgrade',
'Upgrade-Insecure-Requests',
'User-Agent',
'Vary',
'Via',
'WWW-Authenticate',
'X-Content-Type-Options',
'X-DNS-Prefetch-Control',
'X-Frame-Options',
'X-Permitted-Cross-Domain-Policies',
'X-Powered-By',
'X-Requested-With',
'X-XSS-Protection'
]
for (let i = 0; i < wellknownHeaderNames.length; ++i) {
const key = wellknownHeaderNames[i]
const lowerCasedKey = key.toLowerCase()
headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] =
lowerCasedKey
}
// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
Object.setPrototypeOf(headerNameLowerCasedRecord, null)
module.exports = {
wellknownHeaderNames,
headerNameLowerCasedRecord
}
/***/ }), /***/ }),
/***/ 8045: /***/ 8045:
@@ -34495,6 +34769,7 @@ const { InvalidArgumentError } = __nccwpck_require__(8045)
const { Blob } = __nccwpck_require__(4300) const { Blob } = __nccwpck_require__(4300)
const nodeUtil = __nccwpck_require__(3837) const nodeUtil = __nccwpck_require__(3837)
const { stringify } = __nccwpck_require__(3477) const { stringify } = __nccwpck_require__(3477)
const { headerNameLowerCasedRecord } = __nccwpck_require__(4462)
const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
@@ -34704,6 +34979,15 @@ function parseKeepAliveTimeout (val) {
return m ? parseInt(m[1], 10) * 1000 : null return m ? parseInt(m[1], 10) * 1000 : null
} }
/**
* Retrieves a header name and returns its lowercase value.
* @param {string | Buffer} value Header name
* @returns {string}
*/
function headerNameToString (value) {
return headerNameLowerCasedRecord[value] || value.toLowerCase()
}
function parseHeaders (headers, obj = {}) { function parseHeaders (headers, obj = {}) {
// For H2 support // For H2 support
if (!Array.isArray(headers)) return headers if (!Array.isArray(headers)) return headers
@@ -34975,6 +35259,7 @@ module.exports = {
isIterable, isIterable,
isAsyncIterable, isAsyncIterable,
isDestroyed, isDestroyed,
headerNameToString,
parseRawHeaders, parseRawHeaders,
parseHeaders, parseHeaders,
parseKeepAliveTimeout, parseKeepAliveTimeout,
@@ -41622,14 +41907,18 @@ const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983
const assert = __nccwpck_require__(9491) const assert = __nccwpck_require__(9491)
const { isUint8Array } = __nccwpck_require__(9830) const { isUint8Array } = __nccwpck_require__(9830)
let supportedHashes = []
// https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
/** @type {import('crypto')|undefined} */ /** @type {import('crypto')|undefined} */
let crypto let crypto
try { try {
crypto = __nccwpck_require__(6113) crypto = __nccwpck_require__(6113)
const possibleRelevantHashes = ['sha256', 'sha384', 'sha512']
supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash))
/* c8 ignore next 3 */
} catch { } catch {
} }
function responseURL (response) { function responseURL (response) {
@@ -42157,66 +42446,56 @@ function bytesMatch (bytes, metadataList) {
return true return true
} }
// 3. If parsedMetadata is the empty set, return true. // 3. If response is not eligible for integrity validation, return false.
// TODO
// 4. If parsedMetadata is the empty set, return true.
if (parsedMetadata.length === 0) { if (parsedMetadata.length === 0) {
return true return true
} }
// 4. Let metadata be the result of getting the strongest // 5. Let metadata be the result of getting the strongest
// metadata from parsedMetadata. // metadata from parsedMetadata.
const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo)) const strongest = getStrongestMetadata(parsedMetadata)
// get the strongest algorithm const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest)
const strongest = list[0].algo
// get all entries that use the strongest algorithm; ignore weaker
const metadata = list.filter((item) => item.algo === strongest)
// 5. For each item in metadata: // 6. For each item in metadata:
for (const item of metadata) { for (const item of metadata) {
// 1. Let algorithm be the alg component of item. // 1. Let algorithm be the alg component of item.
const algorithm = item.algo const algorithm = item.algo
// 2. Let expectedValue be the val component of item. // 2. Let expectedValue be the val component of item.
let expectedValue = item.hash const expectedValue = item.hash
// See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
// "be liberal with padding". This is annoying, and it's not even in the spec. // "be liberal with padding". This is annoying, and it's not even in the spec.
if (expectedValue.endsWith('==')) {
expectedValue = expectedValue.slice(0, -2)
}
// 3. Let actualValue be the result of applying algorithm to bytes. // 3. Let actualValue be the result of applying algorithm to bytes.
let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64')
if (actualValue.endsWith('==')) { if (actualValue[actualValue.length - 1] === '=') {
actualValue = actualValue.slice(0, -2) if (actualValue[actualValue.length - 2] === '=') {
actualValue = actualValue.slice(0, -2)
} else {
actualValue = actualValue.slice(0, -1)
}
} }
// 4. If actualValue is a case-sensitive match for expectedValue, // 4. If actualValue is a case-sensitive match for expectedValue,
// return true. // return true.
if (actualValue === expectedValue) { if (compareBase64Mixed(actualValue, expectedValue)) {
return true
}
let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url')
if (actualBase64URL.endsWith('==')) {
actualBase64URL = actualBase64URL.slice(0, -2)
}
if (actualBase64URL === expectedValue) {
return true return true
} }
} }
// 6. Return false. // 7. Return false.
return false return false
} }
// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
// https://www.w3.org/TR/CSP2/#source-list-syntax // https://www.w3.org/TR/CSP2/#source-list-syntax
// https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1 // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
const parseHashWithOptions = /((?<algo>sha256|sha384|sha512)-(?<hash>[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i const parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i
/** /**
* @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
@@ -42230,8 +42509,6 @@ function parseMetadata (metadata) {
// 2. Let empty be equal to true. // 2. Let empty be equal to true.
let empty = true let empty = true
const supportedHashes = crypto.getHashes()
// 3. For each token returned by splitting metadata on spaces: // 3. For each token returned by splitting metadata on spaces:
for (const token of metadata.split(' ')) { for (const token of metadata.split(' ')) {
// 1. Set empty to false. // 1. Set empty to false.
@@ -42241,7 +42518,11 @@ function parseMetadata (metadata) {
const parsedToken = parseHashWithOptions.exec(token) const parsedToken = parseHashWithOptions.exec(token)
// 3. If token does not parse, continue to the next token. // 3. If token does not parse, continue to the next token.
if (parsedToken === null || parsedToken.groups === undefined) { if (
parsedToken === null ||
parsedToken.groups === undefined ||
parsedToken.groups.algo === undefined
) {
// Note: Chromium blocks the request at this point, but Firefox // Note: Chromium blocks the request at this point, but Firefox
// gives a warning that an invalid integrity was given. The // gives a warning that an invalid integrity was given. The
// correct behavior is to ignore these, and subsequently not // correct behavior is to ignore these, and subsequently not
@@ -42250,11 +42531,11 @@ function parseMetadata (metadata) {
} }
// 4. Let algorithm be the hash-algo component of token. // 4. Let algorithm be the hash-algo component of token.
const algorithm = parsedToken.groups.algo const algorithm = parsedToken.groups.algo.toLowerCase()
// 5. If algorithm is a hash function recognized by the user // 5. If algorithm is a hash function recognized by the user
// agent, add the parsed token to result. // agent, add the parsed token to result.
if (supportedHashes.includes(algorithm.toLowerCase())) { if (supportedHashes.includes(algorithm)) {
result.push(parsedToken.groups) result.push(parsedToken.groups)
} }
} }
@@ -42267,6 +42548,82 @@ function parseMetadata (metadata) {
return result return result
} }
/**
* @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList
*/
function getStrongestMetadata (metadataList) {
// Let algorithm be the algo component of the first item in metadataList.
// Can be sha256
let algorithm = metadataList[0].algo
// If the algorithm is sha512, then it is the strongest
// and we can return immediately
if (algorithm[3] === '5') {
return algorithm
}
for (let i = 1; i < metadataList.length; ++i) {
const metadata = metadataList[i]
// If the algorithm is sha512, then it is the strongest
// and we can break the loop immediately
if (metadata.algo[3] === '5') {
algorithm = 'sha512'
break
// If the algorithm is sha384, then a potential sha256 or sha384 is ignored
} else if (algorithm[3] === '3') {
continue
// algorithm is sha256, check if algorithm is sha384 and if so, set it as
// the strongest
} else if (metadata.algo[3] === '3') {
algorithm = 'sha384'
}
}
return algorithm
}
function filterMetadataListByAlgorithm (metadataList, algorithm) {
if (metadataList.length === 1) {
return metadataList
}
let pos = 0
for (let i = 0; i < metadataList.length; ++i) {
if (metadataList[i].algo === algorithm) {
metadataList[pos++] = metadataList[i]
}
}
metadataList.length = pos
return metadataList
}
/**
* Compares two base64 strings, allowing for base64url
* in the second string.
*
* @param {string} actualValue always base64
* @param {string} expectedValue base64 or base64url
* @returns {boolean}
*/
function compareBase64Mixed (actualValue, expectedValue) {
if (actualValue.length !== expectedValue.length) {
return false
}
for (let i = 0; i < actualValue.length; ++i) {
if (actualValue[i] !== expectedValue[i]) {
if (
(actualValue[i] === '+' && expectedValue[i] === '-') ||
(actualValue[i] === '/' && expectedValue[i] === '_')
) {
continue
}
return false
}
}
return true
}
// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) {
// TODO // TODO
@@ -42682,7 +43039,8 @@ module.exports = {
urlHasHttpsScheme, urlHasHttpsScheme,
urlIsHttpHttpsScheme, urlIsHttpHttpsScheme,
readAllBytes, readAllBytes,
normalizeMethodRecord normalizeMethodRecord,
parseMetadata
} }
@@ -44769,12 +45127,17 @@ function parseLocation (statusCode, headers) {
// https://tools.ietf.org/html/rfc7231#section-6.4.4 // https://tools.ietf.org/html/rfc7231#section-6.4.4
function shouldRemoveHeader (header, removeContent, unknownOrigin) { function shouldRemoveHeader (header, removeContent, unknownOrigin) {
return ( if (header.length === 4) {
(header.length === 4 && header.toString().toLowerCase() === 'host') || return util.headerNameToString(header) === 'host'
(removeContent && header.toString().toLowerCase().indexOf('content-') === 0) || }
(unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') || if (removeContent && util.headerNameToString(header).startsWith('content-')) {
(unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie') return true
) }
if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) {
const name = util.headerNameToString(header)
return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization'
}
return false
} }
// https://tools.ietf.org/html/rfc7231#section-6.4 // https://tools.ietf.org/html/rfc7231#section-6.4
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+22
View File
@@ -304,6 +304,28 @@ THE SOFTWARE.
agent-base agent-base
MIT MIT
(The MIT License)
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
before-after-hook before-after-hook
Apache-2.0 Apache-2.0
+639 -639
View File
File diff suppressed because it is too large Load Diff
+8 -7
View File
@@ -39,28 +39,29 @@
"@actions/core": "^1.10.1", "@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@octokit/rest": "^20.0.2", "@octokit/rest": "^20.1.0",
"gitea-js": "^1.20.1", "gitea-js": "^1.21.2",
"https-proxy-agent": "^7.0.4", "https-proxy-agent": "^7.0.4",
"moment": "^2.30.1", "moment": "^2.30.1",
"semver": "^7.6.0" "semver": "^7.6.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^20.11.24", "@types/node": "^20.12.7",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.1.0", "@typescript-eslint/parser": "^7.6.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-github": "^4.10.2", "eslint-plugin-github": "^4.10.2",
"eslint-plugin-jest": "^27.9.0", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "3.2.5", "prettier": "3.2.5",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
"typescript": "^5.3.3" "typescript": "^5.4.4"
} }
} }