fix(security): fail-close node camera URL downloads
This commit is contained in:
@@ -73,6 +73,10 @@ export function unauthorizedHintForMessage(message: string): string | null {
|
||||
}
|
||||
|
||||
export async function resolveNodeId(opts: NodesRpcOpts, query: string) {
|
||||
return (await resolveNode(opts, query)).nodeId;
|
||||
}
|
||||
|
||||
export async function resolveNode(opts: NodesRpcOpts, query: string): Promise<NodeListNode> {
|
||||
const q = String(query ?? "").trim();
|
||||
if (!q) {
|
||||
throw new Error("node required");
|
||||
@@ -93,5 +97,6 @@ export async function resolveNodeId(opts: NodesRpcOpts, query: string) {
|
||||
remoteIp: n.remoteIp,
|
||||
}));
|
||||
}
|
||||
return resolveNodeIdFromCandidates(nodes, q);
|
||||
const nodeId = resolveNodeIdFromCandidates(nodes, q);
|
||||
return nodes.find((node) => node.nodeId === nodeId) ?? { nodeId };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user