fix(security): harden CodeQL findings across console and Go server

Address GitHub code scanning alerts with OIDC SSRF guards, confined path
helpers, safer client routing, branding sanitization, upload rate limits,
and CodeQL config exclusions for dev-only and protocol-intentional hashes.
This commit is contained in:
UNITRONIX
2026-06-11 06:57:58 +02:00
parent 8b3dadfd17
commit c2e0e2e784
32 changed files with 497 additions and 98 deletions
@@ -45,17 +45,26 @@ function flattenKeys(obj, prefix = '', result = new Map()) {
return result;
}
const UNSAFE_NESTED_KEYS = new Set(['__proto__', 'prototype', 'constructor']);
function setNested(obj, dotPath, value) {
const parts = dotPath.split('.');
let cur = obj;
for (let i = 0; i < parts.length - 1; i++) {
const p = parts[i];
if (UNSAFE_NESTED_KEYS.has(p)) {
throw new Error(`Unsafe key segment: ${p}`);
}
if (!cur[p] || typeof cur[p] !== 'object' || Array.isArray(cur[p])) {
cur[p] = {};
}
cur = cur[p];
}
cur[parts[parts.length - 1]] = value;
const leaf = parts[parts.length - 1];
if (UNSAFE_NESTED_KEYS.has(leaf)) {
throw new Error(`Unsafe key segment: ${leaf}`);
}
cur[leaf] = value;
}
function collectPatchEntries(patch, prefix = '', entries = []) {