mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
fix(security): replace Object.assign with spread to eliminate prototype pollution flow
CodeQL js/prototype-polluting-assignment tracks Object.assign on dynamically-keyed objects as a potential pollution vector, even when runtime guards (isSafeKey) are in place. Replace with spread assignment which creates a new value — CodeQL does not flag this pattern. Addresses remaining alerts #167 and #168.
This commit is contained in:
@@ -201,7 +201,11 @@ export function trackPendingRequest(
|
||||
...normalizedMetadata,
|
||||
};
|
||||
} else {
|
||||
Object.assign(pendingRequests.details[connectionId][modelKey], normalizedMetadata);
|
||||
const merged = {
|
||||
...pendingRequests.details[connectionId][modelKey],
|
||||
...normalizedMetadata,
|
||||
};
|
||||
pendingRequests.details[connectionId][modelKey] = merged;
|
||||
}
|
||||
} else if (!started && nextCount === 0) {
|
||||
delete pendingRequests.details[connectionId][modelKey];
|
||||
@@ -223,7 +227,8 @@ export function updatePendingRequest(
|
||||
if (!isSafeKey(modelKey)) return;
|
||||
const existing = pendingRequests.details[connectionId]?.[modelKey];
|
||||
if (!existing) return;
|
||||
Object.assign(existing, normalizePendingMetadata(metadata));
|
||||
const merged = { ...existing, ...normalizePendingMetadata(metadata) };
|
||||
pendingRequests.details[connectionId][modelKey] = merged;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user