fix(ci): make Vault live fixture capability-free

This commit is contained in:
whyour
2026-08-25 00:31:55 +08:00
parent b0ab255a68
commit 9c736f0943
4 changed files with 25 additions and 6 deletions
@@ -1,6 +1,8 @@
'use strict';
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const { test } = require('node:test');
const {
@@ -10,6 +12,14 @@ const {
validateVaultKvWorkerSecretLiveReport,
} = require('../../scripts/ql3-vault-kv-worker-secret-live-audit.cjs');
const LIVE_CONTRACT = fs.readFileSync(
path.resolve(
__dirname,
'../../scripts/ql3-vault-kv-worker-secret-live-contract.cjs',
),
'utf8',
);
function fixture() {
return {
schemaVersion: 1,
@@ -86,3 +96,10 @@ test('rejects sensitive material or widened report shape', () => {
assert.ok(findings.includes('report envelope is invalid'));
assert.match(findings.join('; '), /endpoint is forbidden/);
});
test('keeps the hosted-runner fixture capability-free and non-swappable', () => {
assert.match(LIVE_CONTRACT, /'--cap-drop',\n\s+'ALL'/);
assert.match(LIVE_CONTRACT, /'--memory-swappiness',\n\s+'0'/);
assert.match(LIVE_CONTRACT, /'disable_mlock = true'/);
assert.doesNotMatch(LIVE_CONTRACT, /'--cap-add'|'IPC_LOCK'/);
});