@byteplus-iga-pages/agent 1.0.4 → 1.0.5
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/cjs/419.js +1 -1
- package/dist/cjs/647.js +8 -3
- package/dist/esm/392.js +1 -1
- package/dist/esm/613.js +8 -3
- package/package.json +1 -1
package/dist/cjs/419.js
CHANGED
package/dist/cjs/647.js
CHANGED
|
@@ -211,9 +211,14 @@ exports.modules = {
|
|
|
211
211
|
function controlPlaneMessage(body, token) {
|
|
212
212
|
const record = body && "object" == typeof body ? body : void 0;
|
|
213
213
|
const value = "string" == typeof record?.message && record.message.trim() ? record.message : "string" == typeof record?.error && record.error.trim() ? record.error : "The sandbox request could not be completed.";
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
const sanitize = (text)=>{
|
|
215
|
+
let message = token ? text.split(token).join("[redacted]") : text;
|
|
216
|
+
message = message.replace(/\bBearer\s+[A-Za-z0-9._~+\/-]+=*/gi, "Bearer [redacted]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[redacted]").replace(/([?&](?:access[_-]?token|api[_-]?key|key|token|signature|credential|auth|password|secret)\s*=)[^&#\s]*/gi, "$1[redacted]").replace(/([a-z][a-z0-9+.-]*:\/\/)[^@\s/]+@/gi, "$1[redacted]@").replace(/\b(token|authorization|password|secret|api[_-]?key|credential|signature)\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1=[redacted]");
|
|
217
|
+
return message;
|
|
218
|
+
};
|
|
219
|
+
const logId = "string" == typeof record?.log_id && record.log_id.trim() ? sanitize(record.log_id).replace(/[\r\n]/g, " ").slice(0, 256) : void 0;
|
|
220
|
+
const suffix = logId ? ` (log_id: ${logId})` : "";
|
|
221
|
+
return sanitize(value).slice(0, 2048 - suffix.length) + suffix;
|
|
217
222
|
}
|
|
218
223
|
function sandboxNotFoundError() {
|
|
219
224
|
return new _error_js__rspack_import_3.YA("The sandbox was not found.");
|
package/dist/esm/392.js
CHANGED
|
@@ -3640,7 +3640,7 @@ function normalizeError(tool, error) {
|
|
|
3640
3640
|
if (error instanceof SandboxError) return {
|
|
3641
3641
|
tool,
|
|
3642
3642
|
...error.toJSON(),
|
|
3643
|
-
message:
|
|
3643
|
+
message: redactText(error.message)
|
|
3644
3644
|
};
|
|
3645
3645
|
if (isAbortError(error)) return {
|
|
3646
3646
|
tool,
|
package/dist/esm/613.js
CHANGED
|
@@ -18076,9 +18076,14 @@ function controlPlaneHttpError(input) {
|
|
|
18076
18076
|
function controlPlaneMessage(body, token) {
|
|
18077
18077
|
const record = body && "object" == typeof body ? body : void 0;
|
|
18078
18078
|
const value = "string" == typeof record?.message && record.message.trim() ? record.message : "string" == typeof record?.error && record.error.trim() ? record.error : "The sandbox request could not be completed.";
|
|
18079
|
-
|
|
18080
|
-
|
|
18081
|
-
|
|
18079
|
+
const sanitize = (text)=>{
|
|
18080
|
+
let message = token ? text.split(token).join("[redacted]") : text;
|
|
18081
|
+
message = message.replace(/\bBearer\s+[A-Za-z0-9._~+\/-]+=*/gi, "Bearer [redacted]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[redacted]").replace(/([?&](?:access[_-]?token|api[_-]?key|key|token|signature|credential|auth|password|secret)\s*=)[^&#\s]*/gi, "$1[redacted]").replace(/([a-z][a-z0-9+.-]*:\/\/)[^@\s/]+@/gi, "$1[redacted]@").replace(/\b(token|authorization|password|secret|api[_-]?key|credential|signature)\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1=[redacted]");
|
|
18082
|
+
return message;
|
|
18083
|
+
};
|
|
18084
|
+
const logId = "string" == typeof record?.log_id && record.log_id.trim() ? sanitize(record.log_id).replace(/[\r\n]/g, " ").slice(0, 256) : void 0;
|
|
18085
|
+
const suffix = logId ? ` (log_id: ${logId})` : "";
|
|
18086
|
+
return sanitize(value).slice(0, 2048 - suffix.length) + suffix;
|
|
18082
18087
|
}
|
|
18083
18088
|
function sandboxNotFoundError() {
|
|
18084
18089
|
return new SandboxInstanceGoneError("The sandbox was not found.");
|