@iobroker/repochecker 5.19.11 → 5.19.12
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/README.md +4 -0
- package/index.js +3 -2
- package/lib/common.js +82 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,10 @@ Example:
|
|
|
25
25
|
Placeholder for the next version (at the beginning of the line):
|
|
26
26
|
### **WORK IN PROGRESS**
|
|
27
27
|
-->
|
|
28
|
+
### 5.19.12 (2026-07-13)
|
|
29
|
+
|
|
30
|
+
- (Copilot) Redact sensitive Axios error fields so `OWN_GITHUB_TOKEN`/authorization values are never logged in clear text.
|
|
31
|
+
|
|
28
32
|
### 5.19.11 (2026-07-13)
|
|
29
33
|
|
|
30
34
|
- (Copilot) Send `OWN_GITHUB_TOKEN` only for GitHub URLs to avoid forwarding it to jsDelivr.
|
package/index.js
CHANGED
|
@@ -182,8 +182,9 @@ function check(request, ctx, callback) {
|
|
|
182
182
|
);
|
|
183
183
|
})
|
|
184
184
|
.catch(err => {
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
const sanitizedErrorJson = common.stringifyError(err);
|
|
186
|
+
console.error(`GLOBAL ERROR: ${err.toString()}, ${sanitizedErrorJson}`);
|
|
187
|
+
context.errors.push(`[E9999] GLOBAL ERROR: ${err.toString()}, ${sanitizedErrorJson}`);
|
|
187
188
|
|
|
188
189
|
return callback(
|
|
189
190
|
null,
|
package/lib/common.js
CHANGED
|
@@ -9,6 +9,7 @@ const compareVersions = require('compare-versions');
|
|
|
9
9
|
const semver = require('semver');
|
|
10
10
|
const semverValid = require('semver/functions/valid');
|
|
11
11
|
const githubToken = process.env.OWN_GITHUB_TOKEN;
|
|
12
|
+
const redactedValue = '***REDACTED***';
|
|
12
13
|
|
|
13
14
|
let gDebug = false;
|
|
14
15
|
let gInfo = true;
|
|
@@ -65,6 +66,11 @@ if (githubToken) {
|
|
|
65
66
|
}, error => Promise.reject(error));
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
axios.interceptors.response.use(
|
|
70
|
+
response => response,
|
|
71
|
+
error => Promise.reject(redactAxiosError(error)),
|
|
72
|
+
);
|
|
73
|
+
|
|
68
74
|
// function log(msg) {
|
|
69
75
|
// console.log(`${msg}`);
|
|
70
76
|
// }
|
|
@@ -85,6 +91,80 @@ function error(msg) {
|
|
|
85
91
|
console.error(`${msg ? '[ERROR] ' : ''}${msg}`);
|
|
86
92
|
}
|
|
87
93
|
|
|
94
|
+
function isSensitiveKey(key) {
|
|
95
|
+
if (typeof key !== 'string') {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
const normalizedKey = key.toLowerCase();
|
|
99
|
+
return (
|
|
100
|
+
normalizedKey.includes('authorization') ||
|
|
101
|
+
normalizedKey.includes('token') ||
|
|
102
|
+
normalizedKey.includes('api-key') ||
|
|
103
|
+
normalizedKey.includes('apikey') ||
|
|
104
|
+
normalizedKey.includes('secret') ||
|
|
105
|
+
normalizedKey.includes('password') ||
|
|
106
|
+
normalizedKey.includes('cookie')
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function redactString(value) {
|
|
111
|
+
let result = value;
|
|
112
|
+
if (githubToken && result.includes(githubToken)) {
|
|
113
|
+
result = result.replaceAll(githubToken, redactedValue);
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function redactSensitiveData(value, seen = new WeakSet()) {
|
|
119
|
+
if (!value || typeof value !== 'object') {
|
|
120
|
+
return typeof value === 'string' ? redactString(value) : value;
|
|
121
|
+
}
|
|
122
|
+
if (seen.has(value)) {
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
seen.add(value);
|
|
126
|
+
|
|
127
|
+
for (const key of Object.keys(value)) {
|
|
128
|
+
const entry = value[key];
|
|
129
|
+
if (isSensitiveKey(key)) {
|
|
130
|
+
value[key] = redactedValue;
|
|
131
|
+
} else if (typeof entry === 'string') {
|
|
132
|
+
value[key] = redactString(entry);
|
|
133
|
+
} else if (entry && typeof entry === 'object') {
|
|
134
|
+
redactSensitiveData(entry, seen);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function redactAxiosError(error) {
|
|
141
|
+
if (!error || typeof error !== 'object') {
|
|
142
|
+
return error;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
redactSensitiveData(error);
|
|
146
|
+
return error;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function stringifyError(error) {
|
|
150
|
+
const sanitizedError = redactAxiosError(error);
|
|
151
|
+
try {
|
|
152
|
+
return JSON.stringify(sanitizedError);
|
|
153
|
+
} catch (serializationError) {
|
|
154
|
+
return JSON.stringify({
|
|
155
|
+
message: sanitizedError?.message,
|
|
156
|
+
code: sanitizedError?.code,
|
|
157
|
+
status: sanitizedError?.status,
|
|
158
|
+
config: sanitizedError?.config,
|
|
159
|
+
response: sanitizedError?.response && {
|
|
160
|
+
status: sanitizedError.response.status,
|
|
161
|
+
statusText: sanitizedError.response.statusText,
|
|
162
|
+
},
|
|
163
|
+
stringifyError: redactString(serializationError?.message || `${serializationError}`),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
88
168
|
function isDebug() {
|
|
89
169
|
return gDebug;
|
|
90
170
|
}
|
|
@@ -343,6 +423,8 @@ exports.debug = debug;
|
|
|
343
423
|
exports.info = info;
|
|
344
424
|
exports.error = error;
|
|
345
425
|
exports.warn = warn;
|
|
426
|
+
exports.redactAxiosError = redactAxiosError;
|
|
427
|
+
exports.stringifyError = stringifyError;
|
|
346
428
|
|
|
347
429
|
exports.isDebug = isDebug;
|
|
348
430
|
exports.isInfo = isInfo;
|
package/package.json
CHANGED