ci(fa02): isolated security backport source probe (manual only) [skip ci]
This commit is contained in:
1 parent
659b677dd4
commit
8a4f080cfd
1 file changed
+46
@@ -1,9 +1,16 @@
|
||||
name: DataStack Docker Build CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
security_probe_only:
|
||||
description: Inspect locked security dependencies on disposable runner only
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
docker-build:
|
||||
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.security_probe_only != 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
container: node:22-alpine
|
||||
timeout-minutes: 45
|
||||
@@ -39,3 +46,42 @@ jobs:
|
||||
docker buildx build --builder "$builder" --progress=plain --no-cache --load -f docker/Dockerfile.proxy -t "$tag-proxy" .
|
||||
docker image inspect "$tag-ingestion" "$tag-web" "$tag-proxy" >/dev/null
|
||||
echo DATASTACK_THREE_IMAGES_BUILD_PASS
|
||||
|
||||
security-backport-source-probe:
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.security_probe_only == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
container: node:22-alpine
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
github-server-url: https://dev.ivib.cc
|
||||
persist-credentials: false
|
||||
- name: Inspect locked production package sources in disposable checkout
|
||||
run: |
|
||||
set -eu
|
||||
npm ci --omit=dev --ignore-scripts --no-audit --no-fund
|
||||
node <<'NODE'
|
||||
const fs = require('node:fs');
|
||||
const crypto = require('node:crypto');
|
||||
const targets = [
|
||||
['got10', 'node_modules/got/dist/source/request-as-event-emitter.js', /redirectUrl|headers\.location|unix/i],
|
||||
['glob10', 'node_modules/glob/dist/commonjs/walker.js', /this\.signal.*aborted|walkCB\(/],
|
||||
['glob13', 'node_modules/onezip/node_modules/glob/dist/commonjs/walker.js', /this\.signal.*aborted|walkCB\(/],
|
||||
['minimatch9', 'node_modules/glob/node_modules/minimatch/dist/commonjs/index.js', /firstPhasePreProcess|secondPhasePreProcess|globParts\.length|didSomething/],
|
||||
['minimatch10', 'node_modules/onezip/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js', /firstPhasePreProcess|secondPhasePreProcess|globParts\.length|didSomething/],
|
||||
['filetype16-join', 'node_modules/join-io/node_modules/ponse/node_modules/file-type/core.js', /tokenizer\.position \+ 24|readHeader\(|await tokenizer\.ignore\(payload\)/],
|
||||
['filetype16-rest', 'node_modules/restbox/node_modules/ponse/node_modules/file-type/core.js', /tokenizer\.position \+ 24|readHeader\(|await tokenizer\.ignore\(payload\)/],
|
||||
];
|
||||
for (const [name,path,re] of targets) {
|
||||
if (!fs.existsSync(path)) {console.log('PROBE_MISSING', name, path);continue}
|
||||
const src=fs.readFileSync(path,'utf8'),lines=src.split('\n');
|
||||
const indices=[];
|
||||
for(let i=0;i<lines.length;i++)if(re.test(lines[i]))indices.push(i);
|
||||
console.log('PROBE_FILE',JSON.stringify({name,path,bytes:Buffer.byteLength(src),sha256:crypto.createHash('sha256').update(src).digest('hex'),hits:indices.length}));
|
||||
for(const i of indices.slice(0, name.startsWith('minimatch') ? 9 : name.startsWith('filetype')?5:11)){
|
||||
const lo=Math.max(0,i-3),hi=Math.min(lines.length,i+5);
|
||||
console.log('PROBE_SNIPPET',JSON.stringify({name,line:i+1,range:[lo+1,hi],text:lines.slice(lo,hi).join('\n')}));
|
||||
}
|
||||
}
|
||||
NODE
|
||||
Reference in new issue
Block a user