mirror of
https://github.com/actions/upload-artifact.git
synced 2025-04-01 17:26:34 +00:00
update
This commit is contained in:
parent
139bd3da44
commit
e87b6b880a
2 changed files with 30 additions and 212 deletions
121
dist/merge/index.js
vendored
121
dist/merge/index.js
vendored
|
@ -5568,7 +5568,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.internalArtifactTwirpClient = exports.ArtifactHttpClient = void 0;
|
exports.internalArtifactTwirpClient = void 0;
|
||||||
const http_client_1 = __nccwpck_require__(52179);
|
const http_client_1 = __nccwpck_require__(52179);
|
||||||
const auth_1 = __nccwpck_require__(91669);
|
const auth_1 = __nccwpck_require__(91669);
|
||||||
const core_1 = __nccwpck_require__(57818);
|
const core_1 = __nccwpck_require__(57818);
|
||||||
|
@ -5705,7 +5705,6 @@ class ArtifactHttpClient {
|
||||||
return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
|
return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ArtifactHttpClient = ArtifactHttpClient;
|
|
||||||
function internalArtifactTwirpClient(options) {
|
function internalArtifactTwirpClient(options) {
|
||||||
const client = new ArtifactHttpClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier);
|
const client = new ArtifactHttpClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier);
|
||||||
return new generated_1.ArtifactServiceClientJSON(client);
|
return new generated_1.ArtifactServiceClientJSON(client);
|
||||||
|
@ -6010,126 +6009,36 @@ function maskSigUrl(url) {
|
||||||
if (!url)
|
if (!url)
|
||||||
return url;
|
return url;
|
||||||
try {
|
try {
|
||||||
const rawSigRegex = /[?&](sig)=([^&=#]+)/gi;
|
const parsedUrl = new URL(url);
|
||||||
let match;
|
const signature = parsedUrl.searchParams.get('sig');
|
||||||
while ((match = rawSigRegex.exec(url)) !== null) {
|
if (signature) {
|
||||||
const rawSignature = match[2];
|
(0, core_1.setSecret)(signature);
|
||||||
if (rawSignature) {
|
(0, core_1.setSecret)(encodeURIComponent(signature));
|
||||||
(0, core_1.setSecret)(rawSignature);
|
parsedUrl.searchParams.set('sig', '***');
|
||||||
}
|
|
||||||
}
|
|
||||||
let parsedUrl;
|
|
||||||
try {
|
|
||||||
parsedUrl = new URL(url);
|
|
||||||
}
|
|
||||||
catch (_a) {
|
|
||||||
try {
|
|
||||||
parsedUrl = new URL(url, 'https://example.com');
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
(0, core_1.debug)(`Failed to parse URL: ${url}`);
|
|
||||||
return maskSigWithRegex(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let masked = false;
|
|
||||||
const paramNames = Array.from(parsedUrl.searchParams.keys());
|
|
||||||
for (const paramName of paramNames) {
|
|
||||||
if (paramName.toLowerCase() === 'sig') {
|
|
||||||
const signature = parsedUrl.searchParams.get(paramName);
|
|
||||||
if (signature) {
|
|
||||||
(0, core_1.setSecret)(signature);
|
|
||||||
(0, core_1.setSecret)(encodeURIComponent(signature));
|
|
||||||
parsedUrl.searchParams.set(paramName, '***');
|
|
||||||
masked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (masked) {
|
|
||||||
return parsedUrl.toString();
|
return parsedUrl.toString();
|
||||||
}
|
}
|
||||||
if (/([:?&]|^)(sig)=([^&=#]+)/i.test(url)) {
|
|
||||||
return maskSigWithRegex(url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
(0, core_1.debug)(`Error masking URL: ${error instanceof Error ? error.message : String(error)}`);
|
(0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`);
|
||||||
return maskSigWithRegex(url);
|
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
exports.maskSigUrl = maskSigUrl;
|
exports.maskSigUrl = maskSigUrl;
|
||||||
/**
|
|
||||||
* Fallback method to mask signatures using regex when URL parsing fails
|
|
||||||
*/
|
|
||||||
function maskSigWithRegex(url) {
|
|
||||||
try {
|
|
||||||
const regex = /([:?&]|^)(sig)=([^&=#]+)/gi;
|
|
||||||
return url.replace(regex, (fullMatch, prefix, paramName, value) => {
|
|
||||||
if (value) {
|
|
||||||
(0, core_1.setSecret)(value);
|
|
||||||
try {
|
|
||||||
(0, core_1.setSecret)(decodeURIComponent(value));
|
|
||||||
}
|
|
||||||
catch (_a) {
|
|
||||||
// Ignore decoding errors
|
|
||||||
}
|
|
||||||
return `${prefix}${paramName}=***`;
|
|
||||||
}
|
|
||||||
return fullMatch;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
(0, core_1.debug)(`Error in maskSigWithRegex: ${error instanceof Error ? error.message : String(error)}`);
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Masks any URLs containing signature parameters in the provided object
|
* Masks any URLs containing signature parameters in the provided object
|
||||||
* Recursively searches through nested objects and arrays
|
|
||||||
*/
|
*/
|
||||||
function maskSecretUrls(body) {
|
function maskSecretUrls(body) {
|
||||||
if (typeof body !== 'object' || body === null) {
|
if (typeof body !== 'object' || body === null) {
|
||||||
(0, core_1.debug)('body is not an object or is null');
|
(0, core_1.debug)('body is not an object or is null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const processUrl = (url) => {
|
if ('signed_upload_url' in body &&
|
||||||
maskSigUrl(url);
|
typeof body.signed_upload_url === 'string') {
|
||||||
};
|
maskSigUrl(body.signed_upload_url);
|
||||||
const processObject = (obj) => {
|
}
|
||||||
if (typeof obj !== 'object' || obj === null) {
|
if ('signed_url' in body && typeof body.signed_url === 'string') {
|
||||||
return;
|
maskSigUrl(body.signed_url);
|
||||||
}
|
}
|
||||||
if (Array.isArray(obj)) {
|
|
||||||
for (const item of obj) {
|
|
||||||
if (typeof item === 'string') {
|
|
||||||
processUrl(item);
|
|
||||||
}
|
|
||||||
else if (typeof item === 'object' && item !== null) {
|
|
||||||
processObject(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ('signed_upload_url' in obj &&
|
|
||||||
typeof obj.signed_upload_url === 'string') {
|
|
||||||
maskSigUrl(obj.signed_upload_url);
|
|
||||||
}
|
|
||||||
if ('signed_url' in obj && typeof obj.signed_url === 'string') {
|
|
||||||
maskSigUrl(obj.signed_url);
|
|
||||||
}
|
|
||||||
for (const key in obj) {
|
|
||||||
const value = obj[key];
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
if (/([:?&]|^)(sig)=/i.test(value)) {
|
|
||||||
maskSigUrl(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (typeof value === 'object' && value !== null) {
|
|
||||||
processObject(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
processObject(body);
|
|
||||||
}
|
}
|
||||||
exports.maskSecretUrls = maskSecretUrls;
|
exports.maskSecretUrls = maskSecretUrls;
|
||||||
//# sourceMappingURL=util.js.map
|
//# sourceMappingURL=util.js.map
|
||||||
|
|
121
dist/upload/index.js
vendored
121
dist/upload/index.js
vendored
|
@ -5568,7 +5568,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.internalArtifactTwirpClient = exports.ArtifactHttpClient = void 0;
|
exports.internalArtifactTwirpClient = void 0;
|
||||||
const http_client_1 = __nccwpck_require__(52179);
|
const http_client_1 = __nccwpck_require__(52179);
|
||||||
const auth_1 = __nccwpck_require__(91669);
|
const auth_1 = __nccwpck_require__(91669);
|
||||||
const core_1 = __nccwpck_require__(57818);
|
const core_1 = __nccwpck_require__(57818);
|
||||||
|
@ -5705,7 +5705,6 @@ class ArtifactHttpClient {
|
||||||
return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
|
return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ArtifactHttpClient = ArtifactHttpClient;
|
|
||||||
function internalArtifactTwirpClient(options) {
|
function internalArtifactTwirpClient(options) {
|
||||||
const client = new ArtifactHttpClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier);
|
const client = new ArtifactHttpClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier);
|
||||||
return new generated_1.ArtifactServiceClientJSON(client);
|
return new generated_1.ArtifactServiceClientJSON(client);
|
||||||
|
@ -6010,126 +6009,36 @@ function maskSigUrl(url) {
|
||||||
if (!url)
|
if (!url)
|
||||||
return url;
|
return url;
|
||||||
try {
|
try {
|
||||||
const rawSigRegex = /[?&](sig)=([^&=#]+)/gi;
|
const parsedUrl = new URL(url);
|
||||||
let match;
|
const signature = parsedUrl.searchParams.get('sig');
|
||||||
while ((match = rawSigRegex.exec(url)) !== null) {
|
if (signature) {
|
||||||
const rawSignature = match[2];
|
(0, core_1.setSecret)(signature);
|
||||||
if (rawSignature) {
|
(0, core_1.setSecret)(encodeURIComponent(signature));
|
||||||
(0, core_1.setSecret)(rawSignature);
|
parsedUrl.searchParams.set('sig', '***');
|
||||||
}
|
|
||||||
}
|
|
||||||
let parsedUrl;
|
|
||||||
try {
|
|
||||||
parsedUrl = new URL(url);
|
|
||||||
}
|
|
||||||
catch (_a) {
|
|
||||||
try {
|
|
||||||
parsedUrl = new URL(url, 'https://example.com');
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
(0, core_1.debug)(`Failed to parse URL: ${url}`);
|
|
||||||
return maskSigWithRegex(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let masked = false;
|
|
||||||
const paramNames = Array.from(parsedUrl.searchParams.keys());
|
|
||||||
for (const paramName of paramNames) {
|
|
||||||
if (paramName.toLowerCase() === 'sig') {
|
|
||||||
const signature = parsedUrl.searchParams.get(paramName);
|
|
||||||
if (signature) {
|
|
||||||
(0, core_1.setSecret)(signature);
|
|
||||||
(0, core_1.setSecret)(encodeURIComponent(signature));
|
|
||||||
parsedUrl.searchParams.set(paramName, '***');
|
|
||||||
masked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (masked) {
|
|
||||||
return parsedUrl.toString();
|
return parsedUrl.toString();
|
||||||
}
|
}
|
||||||
if (/([:?&]|^)(sig)=([^&=#]+)/i.test(url)) {
|
|
||||||
return maskSigWithRegex(url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
(0, core_1.debug)(`Error masking URL: ${error instanceof Error ? error.message : String(error)}`);
|
(0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`);
|
||||||
return maskSigWithRegex(url);
|
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
exports.maskSigUrl = maskSigUrl;
|
exports.maskSigUrl = maskSigUrl;
|
||||||
/**
|
|
||||||
* Fallback method to mask signatures using regex when URL parsing fails
|
|
||||||
*/
|
|
||||||
function maskSigWithRegex(url) {
|
|
||||||
try {
|
|
||||||
const regex = /([:?&]|^)(sig)=([^&=#]+)/gi;
|
|
||||||
return url.replace(regex, (fullMatch, prefix, paramName, value) => {
|
|
||||||
if (value) {
|
|
||||||
(0, core_1.setSecret)(value);
|
|
||||||
try {
|
|
||||||
(0, core_1.setSecret)(decodeURIComponent(value));
|
|
||||||
}
|
|
||||||
catch (_a) {
|
|
||||||
// Ignore decoding errors
|
|
||||||
}
|
|
||||||
return `${prefix}${paramName}=***`;
|
|
||||||
}
|
|
||||||
return fullMatch;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
(0, core_1.debug)(`Error in maskSigWithRegex: ${error instanceof Error ? error.message : String(error)}`);
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Masks any URLs containing signature parameters in the provided object
|
* Masks any URLs containing signature parameters in the provided object
|
||||||
* Recursively searches through nested objects and arrays
|
|
||||||
*/
|
*/
|
||||||
function maskSecretUrls(body) {
|
function maskSecretUrls(body) {
|
||||||
if (typeof body !== 'object' || body === null) {
|
if (typeof body !== 'object' || body === null) {
|
||||||
(0, core_1.debug)('body is not an object or is null');
|
(0, core_1.debug)('body is not an object or is null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const processUrl = (url) => {
|
if ('signed_upload_url' in body &&
|
||||||
maskSigUrl(url);
|
typeof body.signed_upload_url === 'string') {
|
||||||
};
|
maskSigUrl(body.signed_upload_url);
|
||||||
const processObject = (obj) => {
|
}
|
||||||
if (typeof obj !== 'object' || obj === null) {
|
if ('signed_url' in body && typeof body.signed_url === 'string') {
|
||||||
return;
|
maskSigUrl(body.signed_url);
|
||||||
}
|
}
|
||||||
if (Array.isArray(obj)) {
|
|
||||||
for (const item of obj) {
|
|
||||||
if (typeof item === 'string') {
|
|
||||||
processUrl(item);
|
|
||||||
}
|
|
||||||
else if (typeof item === 'object' && item !== null) {
|
|
||||||
processObject(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ('signed_upload_url' in obj &&
|
|
||||||
typeof obj.signed_upload_url === 'string') {
|
|
||||||
maskSigUrl(obj.signed_upload_url);
|
|
||||||
}
|
|
||||||
if ('signed_url' in obj && typeof obj.signed_url === 'string') {
|
|
||||||
maskSigUrl(obj.signed_url);
|
|
||||||
}
|
|
||||||
for (const key in obj) {
|
|
||||||
const value = obj[key];
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
if (/([:?&]|^)(sig)=/i.test(value)) {
|
|
||||||
maskSigUrl(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (typeof value === 'object' && value !== null) {
|
|
||||||
processObject(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
processObject(body);
|
|
||||||
}
|
}
|
||||||
exports.maskSecretUrls = maskSecretUrls;
|
exports.maskSecretUrls = maskSecretUrls;
|
||||||
//# sourceMappingURL=util.js.map
|
//# sourceMappingURL=util.js.map
|
||||||
|
|
Loading…
Add table
Reference in a new issue