mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 08:23:12 +09:00
Maintain repeated credential parameters
This commit is contained in:
2 files changed
+6
-5
No files matched your search
@@ -304,11 +304,12 @@ export function redactUrl(url: URL | string) {
|
|||||||
return String(url);
|
return String(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const name of [...parsed.searchParams.keys()]) {
|
const searchParams = new URLSearchParams();
|
||||||
if (sensitiveSearchParams.has(name.toLowerCase())) {
|
for (const [name, value] of parsed.searchParams) {
|
||||||
parsed.searchParams.set(name, "REDACTED");
|
searchParams.append(name, sensitiveSearchParams.has(name.toLowerCase()) ? "REDACTED" : value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parsed.search = searchParams.toString();
|
||||||
return parsed.toString();
|
return parsed.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -256,7 +256,7 @@ describe("lib/helpers", function() {
|
|||||||
it("should redact every occurrence of a repeated credential parameter", function() {
|
it("should redact every occurrence of a repeated credential parameter", function() {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
lib.redactUrl("https://example.com/?token=first&token=second"),
|
lib.redactUrl("https://example.com/?token=first&token=second"),
|
||||||
"https://example.com/?token=REDACTED"
|
"https://example.com/?token=REDACTED&token=REDACTED"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it("should accept a URL object", function() {
|
it("should accept a URL object", function() {
|
||||||
|
|||||||
Reference in new issue
Block a user