Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -40,6 +40,7 @@ export const mfaScopeMfaScopeInventoryPatterns = [
|
||||
{ id: "auth-session", pattern: /\b(?:auth session|session token|session cookie|session invalidation|remembered device|trusted device)\b/gi },
|
||||
{ id: "security-doc", pattern: /\b(?:security doc|security documentation|threat model|risk assessment|security checklist|security policy)\b/gi },
|
||||
];
|
||||
const INVENTORY_READ_BATCH_SIZE = 32;
|
||||
|
||||
export const gates = [
|
||||
{ id: "typecheck", command: "pnpm", args: ["run", "typecheck"] },
|
||||
@@ -167,19 +168,23 @@ export async function runMfaScopeMfaScopeInventory(root = repoRoot) {
|
||||
const files = (await Promise.all(existingRoots.map((rootRelativePath) => collectFiles(root, rootRelativePath)))).flat();
|
||||
const counts = new Map(mfaScopeMfaScopeInventoryPatterns.map(({ id }) => [id, 0]));
|
||||
const matches = [];
|
||||
for (const file of files) {
|
||||
const relativeFile = path.relative(root, file).split(path.sep).join("/");
|
||||
const lines = (await readFile(file, "utf8")).split(/\r?\n/);
|
||||
lines.forEach((line, index) => {
|
||||
for (const { id, pattern } of mfaScopeMfaScopeInventoryPatterns) {
|
||||
pattern.lastIndex = 0;
|
||||
const found = line.match(pattern);
|
||||
if (!found) continue;
|
||||
counts.set(id, (counts.get(id) ?? 0) + found.length);
|
||||
for (const match of found) {
|
||||
matches.push(`${relativeFile}:${index + 1}: [${id}] ${match}: ${line.trim()}`);
|
||||
for (let batchStart = 0; batchStart < files.length; batchStart += INVENTORY_READ_BATCH_SIZE) {
|
||||
const batch = files.slice(batchStart, batchStart + INVENTORY_READ_BATCH_SIZE);
|
||||
const contents = await Promise.all(batch.map((file) => readFile(file, "utf8")));
|
||||
batch.forEach((file, fileIndex) => {
|
||||
const relativeFile = path.relative(root, file).split(path.sep).join("/");
|
||||
const lines = contents[fileIndex].split(/\r?\n/);
|
||||
lines.forEach((line, index) => {
|
||||
for (const { id, pattern } of mfaScopeMfaScopeInventoryPatterns) {
|
||||
pattern.lastIndex = 0;
|
||||
const found = line.match(pattern);
|
||||
if (!found) continue;
|
||||
counts.set(id, (counts.get(id) ?? 0) + found.length);
|
||||
for (const match of found) {
|
||||
matches.push(`${relativeFile}:${index + 1}: [${id}] ${match}: ${line.trim()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return { roots: existingRoots, missingRoots, filesScanned: files.length, counts: Object.fromEntries(counts.entries()), totalMatches: matches.length, matches };
|
||||
|
||||
Reference in new issue
Block a user