mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-14 00:07:00 +01:00
chore(deps): upgrade dependencies and remove production vulnerabilities
This commit is contained in:
1 parent
9435a99b6c
commit
fd0dd0adbd
29 files changed
+5220
-21129
No files matched your search
@@ -11,26 +11,28 @@ async function main() {
|
||||
await client.connect();
|
||||
let found = 0;
|
||||
let removed = 0;
|
||||
for await (const key of client.scanIterator({ MATCH: "anoGH_session:*", COUNT: 100 })) {
|
||||
const raw = await client.get(key);
|
||||
if (!raw) continue;
|
||||
let legacy = false;
|
||||
try {
|
||||
const value = JSON.parse(raw);
|
||||
legacy = !!value.passport?.user && typeof value.passport.user !== "string";
|
||||
} catch { legacy = true; }
|
||||
if (!legacy) continue;
|
||||
found++;
|
||||
if (args.includes("--apply")) {
|
||||
// Do not remove a session replaced since the scan read it.
|
||||
removed += Number(await client.eval(
|
||||
'if redis.call("GET", KEYS[1]) == ARGV[1] then return redis.call("DEL", KEYS[1]) else return 0 end',
|
||||
{ keys: [key], arguments: [raw] }
|
||||
));
|
||||
for await (const keys of client.scanIterator({ MATCH: "anoGH_session:*", COUNT: 100 })) {
|
||||
for (const key of keys) {
|
||||
const raw = await client.get(key);
|
||||
if (!raw) continue;
|
||||
let legacy = false;
|
||||
try {
|
||||
const value = JSON.parse(raw);
|
||||
legacy = !!value.passport?.user && typeof value.passport.user !== "string";
|
||||
} catch { legacy = true; }
|
||||
if (!legacy) continue;
|
||||
found++;
|
||||
if (args.includes("--apply")) {
|
||||
// Do not remove a session replaced since the scan read it.
|
||||
removed += Number(await client.eval(
|
||||
'if redis.call("GET", KEYS[1]) == ARGV[1] then return redis.call("DEL", KEYS[1]) else return 0 end',
|
||||
{ keys: [key], arguments: [raw] }
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
process.stdout.write(JSON.stringify({ found, removed }) + "\n");
|
||||
} finally { if (client.isOpen) await client.quit(); }
|
||||
} finally { if (client.isOpen) await client.close(); }
|
||||
}
|
||||
main().catch(() => {
|
||||
process.stderr.write("Legacy session cleanup failed; check Redis configuration and connectivity.\n");
|
||||
|
||||
Reference in new issue
Block a user