fix(fa02): fail-closed install backports, Docker packaging and targeted security regressions
DataStack CI Verification / node-regression (pull_request_target) Canceled after 1m41s
DataStack CI Verification / python-regression (pull_request_target) Canceled after 0s
DataStack CI Verification / quality (pull_request_target) Canceled after 0s
DataStack CI Verification / production-build (pull_request_target) Canceled after 0s
DataStack CI Verification / docker-image-build (pull_request_target) Canceled after 0s
DataStack CI Verification / security-audit (pull_request_target) Canceled after 0s
DataStack CI Verification / windows-compatibility (pull_request_target) Canceled after 1m58s
DataStack CI Verification / node-regression (pull_request_target) Canceled after 1m41s
DataStack CI Verification / python-regression (pull_request_target) Canceled after 0s
DataStack CI Verification / quality (pull_request_target) Canceled after 0s
DataStack CI Verification / production-build (pull_request_target) Canceled after 0s
DataStack CI Verification / docker-image-build (pull_request_target) Canceled after 0s
DataStack CI Verification / security-audit (pull_request_target) Canceled after 0s
DataStack CI Verification / windows-compatibility (pull_request_target) Canceled after 1m58s
This commit is contained in:
1 parent
32cce8f658
commit
76b2c5284b
4 files changed
+92
-1
No files matched your search
@@ -1,6 +1,8 @@
|
|||||||
FROM node:22-alpine AS dependencies
|
FROM node:22-alpine AS dependencies
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
RUN apk add --no-cache git
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
|
COPY patches ./patches
|
||||||
RUN if [ -f package-lock.json ]; then npm ci --omit=dev; else npm install --omit=dev --no-audit --no-fund; fi
|
RUN if [ -f package-lock.json ]; then npm ci --omit=dev; else npm install --omit=dev --no-audit --no-fund; fi
|
||||||
|
|
||||||
FROM node:22-alpine AS runner
|
FROM node:22-alpine AS runner
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
FROM node:22-alpine AS dependencies
|
FROM node:22-alpine AS dependencies
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=development
|
ENV NODE_ENV=development
|
||||||
|
RUN apk add --no-cache git
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
|
COPY patches ./patches
|
||||||
RUN if [ -f package-lock.json ]; then npm ci --include=dev; else npm install --include=dev --no-audit --no-fund; fi
|
RUN if [ -f package-lock.json ]; then npm ci --include=dev; else npm install --include=dev --no-audit --no-fund; fi
|
||||||
|
|
||||||
FROM node:22-alpine AS builder
|
FROM node:22-alpine AS builder
|
||||||
|
|||||||
+2
-1
@@ -15,7 +15,8 @@
|
|||||||
"start:web": "next start",
|
"start:web": "next start",
|
||||||
"start:server": "node server/index.js",
|
"start:server": "node server/index.js",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"clean": "next clean"
|
"clean": "next clean",
|
||||||
|
"postinstall": "node -e \"const cp=require('node:child_process');for(const n of ['got','glob','minimatch','file-type']){const p='patches/cloudcmd-'+n+'-security.patch';const run=a=>cp.execFileSync('git',['apply',...a,p],{stdio:'ignore'});try{run(['--check']);run([]);console.log('SECURITY_BACKPORT_APPLIED',n)}catch(e){try{run(['--reverse','--check']);console.log('SECURITY_BACKPORT_VERIFIED',n)}catch(x){console.error('SECURITY_BACKPORT_MISMATCH',n);process.exit(1)}}}\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^5.2.1",
|
"@hookform/resolvers": "^5.2.1",
|
||||||
|
|||||||
@@ -310,3 +310,89 @@ test('FM-REQ-07..09: proxy routing, SW bypass, Sidebar nav, and /vcon/files work
|
|||||||
assert.ok(workspace.includes('files-manager-offline'));
|
assert.ok(workspace.includes('files-manager-offline'));
|
||||||
assert.ok(workspace.includes('files-manager-iframe'));
|
assert.ok(workspace.includes('files-manager-iframe'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Security acceptance: original upstream fixes backported to the exact Cloudcmd
|
||||||
|
// transitive versions. No public API, UI, or File Manager behavior is changed.
|
||||||
|
test('SEC-FA02-GOT: block redirects from normal HTTP to UNIX sockets and retain normal redirects', async () => {
|
||||||
|
const got = require('../node_modules/got');
|
||||||
|
const server = http.createServer((req, res) => {
|
||||||
|
if (req.url === '/unix') {
|
||||||
|
res.writeHead(302, { location: 'unix:/var/run/docker.sock:/containers/json' }).end();
|
||||||
|
} else if (req.url === '/hostname') {
|
||||||
|
res.writeHead(302, { location: 'http://unix:/var/run/docker.sock:/containers/json' }).end();
|
||||||
|
} else if (req.url === '/normal') {
|
||||||
|
res.writeHead(302, { location: '/ok' }).end();
|
||||||
|
} else {
|
||||||
|
res.writeHead(200, { 'content-type': 'text/plain' }).end('ok');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve));
|
||||||
|
const addr = server.address();
|
||||||
|
assert.ok(addr && typeof addr !== 'string');
|
||||||
|
const origin = `http://127.0.0.1:${addr.port}`;
|
||||||
|
try {
|
||||||
|
for (const endpoint of ['/unix', '/hostname']) {
|
||||||
|
await assert.rejects(
|
||||||
|
got(origin + endpoint),
|
||||||
|
(error: Error) => error.name === 'RequestError' && /Cannot redirect to UNIX socket/.test(error.message),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert.equal((await got(origin + '/normal')).body, 'ok');
|
||||||
|
} finally {
|
||||||
|
await new Promise<void>((resolve, reject) =>
|
||||||
|
server.close((error) => (error ? reject(error) : resolve())),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('SEC-FA02-GLOB: four abort guards in installed CJS/ESM and normal/aborted traversal', async () => {
|
||||||
|
const paths = [
|
||||||
|
'node_modules/glob/dist/commonjs/walker.js',
|
||||||
|
'node_modules/glob/dist/esm/walker.js',
|
||||||
|
'node_modules/onezip/node_modules/glob/dist/commonjs/walker.js',
|
||||||
|
];
|
||||||
|
for (const name of paths) {
|
||||||
|
const contents = fs.readFileSync(path.resolve(name), 'utf8');
|
||||||
|
assert.equal((contents.match(/if \(this\.signal\?\.aborted\)\s+return cb\(\)/g) || []).length, 4, name);
|
||||||
|
}
|
||||||
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'datastack-fa02-glob-'));
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(path.join(root, 'nested'));
|
||||||
|
fs.writeFileSync(path.join(root, 'nested', 'file.js'), 'fixture');
|
||||||
|
const { glob } = require('../node_modules/glob');
|
||||||
|
assert.deepEqual(await glob('**/*.js', { cwd: root, nodir: true }), ['nested/file.js']);
|
||||||
|
const controller = new AbortController();
|
||||||
|
controller.abort(new Error('expected abort'));
|
||||||
|
await assert.rejects(glob('**/*', { cwd: root, signal: controller.signal }), /abort/i);
|
||||||
|
} finally {
|
||||||
|
fs.rmSync(root, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('SEC-FA02-MINIMATCH: older-major pattern expansion is bounded and normal matching preserved', () => {
|
||||||
|
for (const modulePath of [
|
||||||
|
'../node_modules/glob/node_modules/minimatch',
|
||||||
|
'../node_modules/onezip/node_modules/glob/node_modules/minimatch',
|
||||||
|
]) {
|
||||||
|
const { Minimatch } = require(modulePath);
|
||||||
|
const pattern = Array(12).fill('**/../a/b').join('/');
|
||||||
|
const compiled = new Minimatch(pattern, { optimizationLevel: 2, braceExpandMax: 64 });
|
||||||
|
assert.ok(compiled.set.length <= 64, `${modulePath}: ${compiled.set.length}`);
|
||||||
|
assert.equal(new Minimatch('**/*.js', { optimizationLevel: 2 }).match('src/main.js'), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('SEC-FA02-FILETYPE: both nested older-major parsers terminate for malformed ASF', () => {
|
||||||
|
const { spawnSync } = require('node:child_process');
|
||||||
|
for (const modulePath of [
|
||||||
|
'./node_modules/join-io/node_modules/ponse/node_modules/file-type',
|
||||||
|
'./node_modules/restbox/node_modules/ponse/node_modules/file-type',
|
||||||
|
]) {
|
||||||
|
const code = `const f=require(${JSON.stringify(modulePath)});const b=Buffer.from('3026b2758e66cf11a6d9000000000000000000000000000000000000000000000000000000000000000000000000','hex');f.fromBuffer(b).then(v=>{if(!v||v.ext!=='asf')process.exit(1)}).catch(()=>process.exit(1));`;
|
||||||
|
const child = spawnSync(process.execPath, ['-e', code], {
|
||||||
|
cwd: process.cwd(), encoding: 'utf8', timeout: 5000,
|
||||||
|
});
|
||||||
|
assert.equal(child.status, 0, `${modulePath}: ${child.stderr} ${child.stdout} ${child.error || ''}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Reference in new issue
Block a user