refactor: strengthen client boundaries and quality gates
This commit is contained in:
@@ -9,7 +9,10 @@ const apiLock = JSON.parse(readFileSync(join(workspaceRoot, 'api', 'package-lock
|
||||
assertVersionAtLeast(rootLock.packages['node_modules/postcss']?.version, [8, 5, 18], 'postcss');
|
||||
assertVersionAtLeast(rootLock.packages['node_modules/react-router']?.version, [7, 18, 2], 'react-router');
|
||||
assertVersionAtLeast(rootLock.packages['node_modules/nanoid']?.version, [3, 3, 18], 'nanoid');
|
||||
assertEqual(apiLock.packages['node_modules/brace-expansion-safe']?.version, '5.0.8', 'brace-expansion-safe');
|
||||
assertEqual(apiLock.packages['node_modules/brace-expansion-safe']?.version, '5.0.9', 'brace-expansion-safe');
|
||||
assertEqual(apiLock.packages['node_modules/fast-uri']?.version, '3.1.5', 'fast-uri');
|
||||
assertEqual(apiLock.packages['node_modules/js-yaml']?.version, '4.3.1', 'js-yaml');
|
||||
assertEqual(apiLock.packages['node_modules/@nestjs/swagger']?.version, '11.4.7', '@nestjs/swagger');
|
||||
assertEqual(
|
||||
apiLock.packages['node_modules/brace-expansion']?.resolved,
|
||||
'vendor/brace-expansion-compat',
|
||||
@@ -35,7 +38,7 @@ for (const filePath of sourceFiles(join(workspaceRoot, 'src'))) {
|
||||
const apiRequire = createRequire(join(workspaceRoot, 'api', 'package.json'));
|
||||
const expand = apiRequire('brace-expansion');
|
||||
if (typeof expand !== 'function' || expand.EXPANSION_MAX_LENGTH !== 4_000_000) {
|
||||
throw new Error('brace-expansion compatibility adapter is not using the bounded 5.0.8 implementation');
|
||||
throw new Error('brace-expansion compatibility adapter is not using the bounded 5.0.9 implementation');
|
||||
}
|
||||
assertEqual(expand('{a,b}{1,2}').join(','), 'a1,a2,b1,b2', 'brace-expansion legacy API');
|
||||
|
||||
@@ -51,7 +54,9 @@ for (const relativePath of [
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Dependency mitigations verified: PostCSS, React Router and NanoID patched; RSC unused; brace expansion bounded and compatible.');
|
||||
console.log(
|
||||
'Dependency mitigations verified: frontend baselines, Swagger YAML/URI parsers and bounded brace expansion are patched.',
|
||||
);
|
||||
|
||||
function sourceFiles(directory) {
|
||||
return readdirSync(directory).flatMap((name) => {
|
||||
@@ -64,7 +69,11 @@ function sourceFiles(directory) {
|
||||
function assertVersionAtLeast(actual, minimum, label) {
|
||||
if (!actual) throw new Error(`${label} is missing from package-lock.json`);
|
||||
const parts = actual.split('.').map((part) => Number(part.replace(/\D.*$/u, '')));
|
||||
if (minimum.some((value, index) => parts[index] < value && minimum.slice(0, index).every((item, i) => parts[i] === item))) {
|
||||
if (
|
||||
minimum.some(
|
||||
(value, index) => parts[index] < value && minimum.slice(0, index).every((item, i) => parts[i] === item),
|
||||
)
|
||||
) {
|
||||
throw new Error(`${label} ${actual} is older than ${minimum.join('.')}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user