Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 45cfd0e

Browse filesBrowse files
committed
updates
1 parent edd449b commit 45cfd0e
Copy full SHA for 45cfd0e

File tree

4 files changed

+64
-428
lines changed
Filter options

4 files changed

+64
-428
lines changed

‎dist/restore-only/index.js

Copy file name to clipboardExpand all lines: dist/restore-only/index.js
+16-107Lines changed: 16 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -8754,7 +8754,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
87548754
});
87558755
};
87568756
Object.defineProperty(exports, "__esModule", ({ value: true }));
8757-
exports.internalCacheTwirpClient = exports.CacheServiceClient = void 0;
8757+
exports.internalCacheTwirpClient = void 0;
87588758
const core_1 = __nccwpck_require__(9728);
87598759
const user_agent_1 = __nccwpck_require__(3909);
87608760
const errors_1 = __nccwpck_require__(1069);
@@ -8899,7 +8899,6 @@ class CacheServiceClient {
88998899
return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
89008900
}
89018901
}
8902-
exports.CacheServiceClient = CacheServiceClient;
89038902
function internalCacheTwirpClient(options) {
89048903
const client = new CacheServiceClient((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);
89058904
return new cache_twirp_client_1.CacheServiceClientJSON(client);
@@ -9024,127 +9023,37 @@ function maskSigUrl(url) {
90249023
if (!url)
90259024
return url;
90269025
try {
9027-
const rawSigRegex = /[?&](sig)=([^&=#]+)/gi;
9028-
let match;
9029-
while ((match = rawSigRegex.exec(url)) !== null) {
9030-
const rawSignature = match[2];
9031-
if (rawSignature) {
9032-
(0, core_1.setSecret)(rawSignature);
9033-
}
9034-
}
9035-
let parsedUrl;
9036-
try {
9037-
parsedUrl = new URL(url);
9038-
}
9039-
catch (_a) {
9040-
try {
9041-
parsedUrl = new URL(url, 'https://example.com');
9042-
}
9043-
catch (error) {
9044-
(0, core_1.debug)(`Failed to parse URL: ${url}`);
9045-
return maskSigWithRegex(url);
9046-
}
9047-
}
9048-
let masked = false;
9049-
const paramNames = Array.from(parsedUrl.searchParams.keys());
9050-
for (const paramName of paramNames) {
9051-
if (paramName.toLowerCase() === 'sig') {
9052-
const signature = parsedUrl.searchParams.get(paramName);
9053-
if (signature) {
9054-
(0, core_1.setSecret)(signature);
9055-
(0, core_1.setSecret)(encodeURIComponent(signature));
9056-
parsedUrl.searchParams.set(paramName, '***');
9057-
masked = true;
9058-
}
9059-
}
9060-
}
9061-
if (masked) {
9026+
const parsedUrl = new URL(url);
9027+
const signature = parsedUrl.searchParams.get('sig');
9028+
if (signature) {
9029+
(0, core_1.setSecret)(signature);
9030+
(0, core_1.setSecret)(encodeURIComponent(signature));
9031+
parsedUrl.searchParams.set('sig', '***');
90629032
return parsedUrl.toString();
90639033
}
9064-
if (/([:?&]|^)(sig)=([^&=#]+)/i.test(url)) {
9065-
return maskSigWithRegex(url);
9066-
}
90679034
}
90689035
catch (error) {
9069-
(0, core_1.debug)(`Error masking URL: ${error instanceof Error ? error.message : String(error)}`);
9070-
return maskSigWithRegex(url);
9036+
(0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`);
90719037
}
90729038
return url;
90739039
}
90749040
exports.maskSigUrl = maskSigUrl;
9075-
/**
9076-
* Fallback method to mask signatures using regex when URL parsing fails
9077-
*/
9078-
function maskSigWithRegex(url) {
9079-
try {
9080-
const regex = /([:?&]|^)(sig)=([^&=#]+)/gi;
9081-
return url.replace(regex, (fullMatch, prefix, paramName, value) => {
9082-
if (value) {
9083-
(0, core_1.setSecret)(value);
9084-
try {
9085-
(0, core_1.setSecret)(decodeURIComponent(value));
9086-
}
9087-
catch (_a) {
9088-
// Ignore decoding errors
9089-
}
9090-
return `${prefix}${paramName}=***`;
9091-
}
9092-
return fullMatch;
9093-
});
9094-
}
9095-
catch (error) {
9096-
(0, core_1.debug)(`Error in maskSigWithRegex: ${error instanceof Error ? error.message : String(error)}`);
9097-
return url;
9098-
}
9099-
}
91009041
/**
91019042
* Masks any URLs containing signature parameters in the provided object
9102-
* Recursively searches through nested objects and arrays
91039043
*/
91049044
function maskSecretUrls(body) {
91059045
if (typeof body !== 'object' || body === null) {
91069046
(0, core_1.debug)('body is not an object or is null');
91079047
return;
91089048
}
9109-
const processUrl = (url) => {
9110-
maskSigUrl(url);
9111-
};
9112-
const processObject = (obj) => {
9113-
if (typeof obj !== 'object' || obj === null) {
9114-
return;
9115-
}
9116-
if (Array.isArray(obj)) {
9117-
for (const item of obj) {
9118-
if (typeof item === 'string') {
9119-
processUrl(item);
9120-
}
9121-
else if (typeof item === 'object' && item !== null) {
9122-
processObject(item);
9123-
}
9124-
}
9125-
return;
9126-
}
9127-
if ('signed_upload_url' in obj &&
9128-
typeof obj.signed_upload_url === 'string') {
9129-
maskSigUrl(obj.signed_upload_url);
9130-
}
9131-
if ('signed_download_url' in obj &&
9132-
typeof obj.signed_download_url === 'string') {
9133-
maskSigUrl(obj.signed_download_url);
9134-
}
9135-
for (const key in obj) {
9136-
const value = obj[key];
9137-
if (typeof value === 'string') {
9138-
if (/([:?&]|^)(sig)=/i.test(value)) {
9139-
maskSigUrl(value);
9140-
}
9141-
}
9142-
else if (typeof value === 'object' && value !== null) {
9143-
processObject(value);
9144-
}
9145-
}
9146-
};
9147-
processObject(body);
9049+
if ('signed_upload_url' in body &&
9050+
typeof body.signed_upload_url === 'string') {
9051+
maskSigUrl(body.signed_upload_url);
9052+
}
9053+
if ('signed_download_url' in body &&
9054+
typeof body.signed_download_url === 'string') {
9055+
maskSigUrl(body.signed_download_url);
9056+
}
91489057
}
91499058
exports.maskSecretUrls = maskSecretUrls;
91509059
//# sourceMappingURL=util.js.map

‎dist/restore/index.js

Copy file name to clipboardExpand all lines: dist/restore/index.js
+16-107Lines changed: 16 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -8754,7 +8754,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
87548754
});
87558755
};
87568756
Object.defineProperty(exports, "__esModule", ({ value: true }));
8757-
exports.internalCacheTwirpClient = exports.CacheServiceClient = void 0;
8757+
exports.internalCacheTwirpClient = void 0;
87588758
const core_1 = __nccwpck_require__(9728);
87598759
const user_agent_1 = __nccwpck_require__(3909);
87608760
const errors_1 = __nccwpck_require__(1069);
@@ -8899,7 +8899,6 @@ class CacheServiceClient {
88998899
return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
89008900
}
89018901
}
8902-
exports.CacheServiceClient = CacheServiceClient;
89038902
function internalCacheTwirpClient(options) {
89048903
const client = new CacheServiceClient((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);
89058904
return new cache_twirp_client_1.CacheServiceClientJSON(client);
@@ -9024,127 +9023,37 @@ function maskSigUrl(url) {
90249023
if (!url)
90259024
return url;
90269025
try {
9027-
const rawSigRegex = /[?&](sig)=([^&=#]+)/gi;
9028-
let match;
9029-
while ((match = rawSigRegex.exec(url)) !== null) {
9030-
const rawSignature = match[2];
9031-
if (rawSignature) {
9032-
(0, core_1.setSecret)(rawSignature);
9033-
}
9034-
}
9035-
let parsedUrl;
9036-
try {
9037-
parsedUrl = new URL(url);
9038-
}
9039-
catch (_a) {
9040-
try {
9041-
parsedUrl = new URL(url, 'https://example.com');
9042-
}
9043-
catch (error) {
9044-
(0, core_1.debug)(`Failed to parse URL: ${url}`);
9045-
return maskSigWithRegex(url);
9046-
}
9047-
}
9048-
let masked = false;
9049-
const paramNames = Array.from(parsedUrl.searchParams.keys());
9050-
for (const paramName of paramNames) {
9051-
if (paramName.toLowerCase() === 'sig') {
9052-
const signature = parsedUrl.searchParams.get(paramName);
9053-
if (signature) {
9054-
(0, core_1.setSecret)(signature);
9055-
(0, core_1.setSecret)(encodeURIComponent(signature));
9056-
parsedUrl.searchParams.set(paramName, '***');
9057-
masked = true;
9058-
}
9059-
}
9060-
}
9061-
if (masked) {
9026+
const parsedUrl = new URL(url);
9027+
const signature = parsedUrl.searchParams.get('sig');
9028+
if (signature) {
9029+
(0, core_1.setSecret)(signature);
9030+
(0, core_1.setSecret)(encodeURIComponent(signature));
9031+
parsedUrl.searchParams.set('sig', '***');
90629032
return parsedUrl.toString();
90639033
}
9064-
if (/([:?&]|^)(sig)=([^&=#]+)/i.test(url)) {
9065-
return maskSigWithRegex(url);
9066-
}
90679034
}
90689035
catch (error) {
9069-
(0, core_1.debug)(`Error masking URL: ${error instanceof Error ? error.message : String(error)}`);
9070-
return maskSigWithRegex(url);
9036+
(0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`);
90719037
}
90729038
return url;
90739039
}
90749040
exports.maskSigUrl = maskSigUrl;
9075-
/**
9076-
* Fallback method to mask signatures using regex when URL parsing fails
9077-
*/
9078-
function maskSigWithRegex(url) {
9079-
try {
9080-
const regex = /([:?&]|^)(sig)=([^&=#]+)/gi;
9081-
return url.replace(regex, (fullMatch, prefix, paramName, value) => {
9082-
if (value) {
9083-
(0, core_1.setSecret)(value);
9084-
try {
9085-
(0, core_1.setSecret)(decodeURIComponent(value));
9086-
}
9087-
catch (_a) {
9088-
// Ignore decoding errors
9089-
}
9090-
return `${prefix}${paramName}=***`;
9091-
}
9092-
return fullMatch;
9093-
});
9094-
}
9095-
catch (error) {
9096-
(0, core_1.debug)(`Error in maskSigWithRegex: ${error instanceof Error ? error.message : String(error)}`);
9097-
return url;
9098-
}
9099-
}
91009041
/**
91019042
* Masks any URLs containing signature parameters in the provided object
9102-
* Recursively searches through nested objects and arrays
91039043
*/
91049044
function maskSecretUrls(body) {
91059045
if (typeof body !== 'object' || body === null) {
91069046
(0, core_1.debug)('body is not an object or is null');
91079047
return;
91089048
}
9109-
const processUrl = (url) => {
9110-
maskSigUrl(url);
9111-
};
9112-
const processObject = (obj) => {
9113-
if (typeof obj !== 'object' || obj === null) {
9114-
return;
9115-
}
9116-
if (Array.isArray(obj)) {
9117-
for (const item of obj) {
9118-
if (typeof item === 'string') {
9119-
processUrl(item);
9120-
}
9121-
else if (typeof item === 'object' && item !== null) {
9122-
processObject(item);
9123-
}
9124-
}
9125-
return;
9126-
}
9127-
if ('signed_upload_url' in obj &&
9128-
typeof obj.signed_upload_url === 'string') {
9129-
maskSigUrl(obj.signed_upload_url);
9130-
}
9131-
if ('signed_download_url' in obj &&
9132-
typeof obj.signed_download_url === 'string') {
9133-
maskSigUrl(obj.signed_download_url);
9134-
}
9135-
for (const key in obj) {
9136-
const value = obj[key];
9137-
if (typeof value === 'string') {
9138-
if (/([:?&]|^)(sig)=/i.test(value)) {
9139-
maskSigUrl(value);
9140-
}
9141-
}
9142-
else if (typeof value === 'object' && value !== null) {
9143-
processObject(value);
9144-
}
9145-
}
9146-
};
9147-
processObject(body);
9049+
if ('signed_upload_url' in body &&
9050+
typeof body.signed_upload_url === 'string') {
9051+
maskSigUrl(body.signed_upload_url);
9052+
}
9053+
if ('signed_download_url' in body &&
9054+
typeof body.signed_download_url === 'string') {
9055+
maskSigUrl(body.signed_download_url);
9056+
}
91489057
}
91499058
exports.maskSecretUrls = maskSecretUrls;
91509059
//# sourceMappingURL=util.js.map

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.