yam-flow 2.7.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +5 -0
- package/CHANGELOG.md +41 -0
- package/COMMANDS.md +52 -5
- package/README.md +40 -8
- package/ROADMAP.md +17 -6
- package/dist/bin/yam.js +462 -74
- package/dist/lib/external-updates.d.ts +9 -0
- package/dist/lib/external-updates.js +232 -4
- package/dist/lib/next-step.d.ts +61 -0
- package/dist/lib/next-step.js +340 -0
- package/dist/lib/release-auth-readiness.d.ts +81 -0
- package/dist/lib/release-auth-readiness.js +106 -0
- package/dist/lib/release-registry-status.d.ts +18 -0
- package/dist/lib/release-registry-status.js +37 -0
- package/dist/lib/scout-receipt.d.ts +89 -0
- package/dist/lib/scout-receipt.js +542 -0
- package/dist/lib/security-check.d.ts +98 -0
- package/dist/lib/security-check.js +262 -0
- package/dist/lib/security-integration.d.ts +8 -0
- package/dist/lib/security-integration.js +428 -0
- package/dist/lib/skill-installation.d.ts +30 -0
- package/dist/lib/skill-installation.js +470 -82
- package/dist/lib/trust-kernel.d.ts +2 -0
- package/dist/lib/trust-kernel.js +21 -2
- package/package.json +26 -4
- package/references/final-report.md +17 -1
- package/references/next-step.md +67 -0
- package/references/scout-wide-scan.md +16 -0
- package/references/security-check.md +131 -0
- package/references/study-note.md +10 -2
- package/references/tool-trust-layer.md +2 -0
- package/skills/deep/SKILL.md +6 -0
- package/skills/mission/SKILL.md +6 -0
- package/skills/quick/SKILL.md +5 -0
- package/skills/scout/SKILL.md +19 -9
- package/skills/ueye/SKILL.md +5 -0
- package/src/bin/yam.ts +465 -72
- package/src/lib/external-updates.ts +262 -4
- package/src/lib/next-step.ts +397 -0
- package/src/lib/release-auth-readiness.ts +148 -0
- package/src/lib/release-registry-status.ts +55 -0
- package/src/lib/scout-receipt.ts +593 -0
- package/src/lib/security-check.ts +184 -0
- package/src/lib/security-integration.ts +299 -0
- package/src/lib/skill-installation.ts +542 -87
- package/src/lib/trust-kernel.ts +25 -2
- package/templates/security-check-note.md +42 -0
- package/templates/security-gate.yml +44 -0
- package/yam.manifest.json +4 -3
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import fsp from 'node:fs/promises';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
export const SECURITY_STATUSES = ['passed', 'needs_improvement', 'failed', 'unverified', 'not_applicable'];
|
|
6
|
+
export const SEC_AREAS = {
|
|
7
|
+
'SEC-01': '사용자·관리자·외부 서비스·DB·파일 사이의 신뢰 경계와 보호할 데이터·작업을 식별한다.',
|
|
8
|
+
'SEC-02': '명시적으로 허용한 접근만 열고, 사용자·서비스 계정에 필요한 최소 권한만 부여한다.',
|
|
9
|
+
'SEC-03': '화면을 우회한 API·서버 함수·DB·파일·백그라운드 작업에서도 사용자·조직·대상별 권한을 확인한다.',
|
|
10
|
+
'SEC-04': '계정 정지·승인 철회·탈퇴·소속 변경 후 기존 세션·토큰·캐시에서도 권한 회수가 반영된다.',
|
|
11
|
+
'SEC-05': '코드의 보안 정책·migration·ACL·환경 설정이 대상 배포 환경의 실제 상태와 일치한다.',
|
|
12
|
+
'SEC-06': '로그인·관리자 인증·세션 만료·로그아웃·비밀번호 재설정·계정 복구가 계정 탈취를 막도록 동작한다.',
|
|
13
|
+
'SEC-07': '외부 입력·파일 업로드·출력의 형식·크기·경로를 검증하고 SQL 주입·XSS·SSRF·CSRF 등 해당 공격을 방어한다.',
|
|
14
|
+
'SEC-08': 'API 키·토큰·개인키·개인정보가 코드·브라우저 번들·로그·점검 기록에 불필요하게 노출되지 않는다.',
|
|
15
|
+
'SEC-09': '의존성·CI/CD 권한·배포 자격증명·릴리스 산출물의 출처와 무결성을 확인해 공급망 위험을 통제한다.'
|
|
16
|
+
};
|
|
17
|
+
export const SECURITY_AREA_IDS = Object.keys(SEC_AREAS);
|
|
18
|
+
export const STATUS_KO = {
|
|
19
|
+
passed: '점검 완료 - 이상 없음', needs_improvement: '점검 완료 - 보완 필요', failed: '점검 실패',
|
|
20
|
+
unverified: '미검증', not_applicable: '해당 없음'
|
|
21
|
+
};
|
|
22
|
+
const secretPatterns = [/https?:\/\/[^\s/]+:[^\s/]+@/i, /[?&](?:token|key|secret|password)=[^\s&]+/i, /\bgh[pousr]_[A-Za-z0-9]{20,}\b/i, /\bnpm_[A-Za-z0-9]{20,}\b/i, /\bsk-[A-Za-z0-9_-]{20,}\b/i, /\bAKIA[A-Z0-9]{16}\b/, /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/, /(?:password|secret|token|api[_-]?key)\s*[:=]\s*[^\s,}]{8,}/i];
|
|
23
|
+
const SHA256 = /^sha256:[a-f0-9]{64}$/;
|
|
24
|
+
const unsafeText = (x) => typeof x === 'string' && (/[\r\n\x00-\x1f\x7f<>]/.test(x) || x.length > 2048);
|
|
25
|
+
const iso = (x) => typeof x === 'string' && !Number.isNaN(Date.parse(x));
|
|
26
|
+
const obj = (x) => !!x && typeof x === 'object' && !Array.isArray(x);
|
|
27
|
+
const stable = (x) => {
|
|
28
|
+
if (Array.isArray(x))
|
|
29
|
+
return `[${x.map(stable).join(',')}]`;
|
|
30
|
+
if (x && typeof x === 'object')
|
|
31
|
+
return `{${Object.keys(x).filter(k => x[k] !== undefined).sort().map((k) => `${JSON.stringify(k)}:${stable(x[k])}`).join(',')}}`;
|
|
32
|
+
return JSON.stringify(x);
|
|
33
|
+
};
|
|
34
|
+
const digest = (x) => `sha256:${createHash('sha256').update(stable(x)).digest('hex')}`;
|
|
35
|
+
const clone = (x) => JSON.parse(JSON.stringify(x));
|
|
36
|
+
const hasSecret = (x) => secretPatterns.some((p) => p.test(typeof x === 'string' ? x : JSON.stringify(x)));
|
|
37
|
+
export function createSecurityStarter(input) {
|
|
38
|
+
const policy = clone(input.policy || { version: 'security-check-v1', required_at: {} });
|
|
39
|
+
const requiredAt = policy.required_at || {};
|
|
40
|
+
return { run_id: input.run_id || `security-${randomUUID()}`, time: (input.now || new Date()).toISOString(), stage: input.stage, policy, policy_digest: policy.digest || digest(policy), binding: clone(input.binding), environment: input.environment, scope: input.scope || [], checker: input.checker || 'yam-security-check', areas: SECURITY_AREA_IDS.map((id) => ({ id, explanation: SEC_AREAS[id], status: 'unverified', required_at: requiredAt[id] || [input.stage] })) };
|
|
41
|
+
}
|
|
42
|
+
function evidenceErrors(e, index) {
|
|
43
|
+
const out = [];
|
|
44
|
+
if (!obj(e))
|
|
45
|
+
return [`evidence_invalid:${index}`];
|
|
46
|
+
if (typeof e.reference !== 'string' || !e.reference.trim() || e.reference.includes('\0'))
|
|
47
|
+
out.push(`evidence_reference_invalid:${index}`);
|
|
48
|
+
if (!SHA256.test(String(e.sha256 || '')))
|
|
49
|
+
out.push(`evidence_sha256_invalid:${index}`);
|
|
50
|
+
if (typeof e.checker !== 'string' || !e.checker.trim() || hasSecret(e.checker))
|
|
51
|
+
out.push(`evidence_checker_invalid:${index}`);
|
|
52
|
+
if (!iso(e.checked_at))
|
|
53
|
+
out.push(`evidence_time_invalid:${index}`);
|
|
54
|
+
if (Object.values(e).some(unsafeText))
|
|
55
|
+
out.push(`evidence_text_invalid:${index}`);
|
|
56
|
+
if (hasSecret(e))
|
|
57
|
+
out.push(`evidence_secret:${index}`);
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
export function validateSecurityCheck(input, expectedBinding, expectedPolicy) {
|
|
61
|
+
const errors = [];
|
|
62
|
+
const x = obj(input) ? input : {};
|
|
63
|
+
const validRun = typeof x.run_id === 'string' && /^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/.test(x.run_id);
|
|
64
|
+
const runId = validRun ? x.run_id : `invalid-${randomUUID()}`;
|
|
65
|
+
if (!validRun)
|
|
66
|
+
errors.push('run_id_invalid');
|
|
67
|
+
if (!['commit', 'push', 'deploy'].includes(x.stage))
|
|
68
|
+
errors.push('stage_invalid');
|
|
69
|
+
if (!iso(x.time))
|
|
70
|
+
errors.push('time_invalid');
|
|
71
|
+
if (!obj(x.binding))
|
|
72
|
+
errors.push('binding_missing');
|
|
73
|
+
if (x.binding?.stage !== x.stage)
|
|
74
|
+
errors.push('binding_stage_mismatch');
|
|
75
|
+
if (x.stage === 'deploy' && x.environment !== x.binding?.environment)
|
|
76
|
+
errors.push('environment_binding_mismatch');
|
|
77
|
+
if (Object.values(x).filter(v => typeof v === 'string').some(unsafeText))
|
|
78
|
+
errors.push('record_text_invalid');
|
|
79
|
+
if (expectedBinding && stable(x.binding) !== stable(expectedBinding))
|
|
80
|
+
errors.push('binding_mismatch');
|
|
81
|
+
if (typeof x.environment !== 'string' || !x.environment.trim())
|
|
82
|
+
errors.push('environment_invalid');
|
|
83
|
+
if (!Array.isArray(x.scope) || !x.scope.length || x.scope.some(v => typeof v !== 'string' || !v.trim() || unsafeText(v)))
|
|
84
|
+
errors.push('scope_invalid');
|
|
85
|
+
if (typeof x.checker !== 'string' || !x.checker.trim())
|
|
86
|
+
errors.push('checker_invalid');
|
|
87
|
+
const policy = obj(x.policy) ? clone(x.policy) : { version: 'security-check-v1', required_at: {} };
|
|
88
|
+
const policyDigest = x.policy_digest || policy.digest || digest(policy);
|
|
89
|
+
if (expectedPolicy && stable(policy) !== stable(expectedPolicy))
|
|
90
|
+
errors.push('policy_mismatch');
|
|
91
|
+
if (typeof x.policy_digest === 'string' && !SHA256.test(x.policy_digest))
|
|
92
|
+
errors.push('policy_digest_invalid');
|
|
93
|
+
if (!Array.isArray(x.areas))
|
|
94
|
+
errors.push('areas_missing');
|
|
95
|
+
const supplied = Array.isArray(x.areas) ? x.areas : [];
|
|
96
|
+
const byId = new Map();
|
|
97
|
+
supplied.forEach((a, i) => { if (!obj(a) || !Object.prototype.hasOwnProperty.call(SEC_AREAS, a.id))
|
|
98
|
+
errors.push(`area_invalid:${i}`);
|
|
99
|
+
else if (byId.has(a.id))
|
|
100
|
+
errors.push(`area_duplicate:${a.id}`);
|
|
101
|
+
else
|
|
102
|
+
byId.set(a.id, clone(a)); });
|
|
103
|
+
const requiredAt = (expectedPolicy || policy).required_at || {};
|
|
104
|
+
if (!policy.version || unsafeText(policy.version))
|
|
105
|
+
errors.push('policy_version_invalid');
|
|
106
|
+
for (const id of SECURITY_AREA_IDS) {
|
|
107
|
+
const stages = requiredAt[id];
|
|
108
|
+
if (!Array.isArray(stages) || !stages.length || stages.some(v => !['commit', 'push', 'deploy'].includes(v)))
|
|
109
|
+
errors.push(`policy_requirement_invalid:${id}`);
|
|
110
|
+
}
|
|
111
|
+
for (const id of SECURITY_AREA_IDS)
|
|
112
|
+
if (!byId.has(id))
|
|
113
|
+
errors.push(`area_missing:${id}`);
|
|
114
|
+
const areas = SECURITY_AREA_IDS.map((id) => {
|
|
115
|
+
const a = byId.get(id) || { id, explanation: SEC_AREAS[id], status: 'unverified', required_at: requiredAt[id] || [x.stage] };
|
|
116
|
+
if (a.explanation !== SEC_AREAS[id])
|
|
117
|
+
errors.push(`explanation_mismatch:${id}`);
|
|
118
|
+
if (!SECURITY_STATUSES.includes(a.status))
|
|
119
|
+
errors.push(`status_invalid:${id}`);
|
|
120
|
+
const trustedRequired = Array.isArray(requiredAt[id]) && requiredAt[id].length ? requiredAt[id] : ['commit', 'push', 'deploy'];
|
|
121
|
+
if (Object.values(a).filter(v => typeof v === 'string').some(unsafeText))
|
|
122
|
+
errors.push(`area_text_invalid:${id}`);
|
|
123
|
+
if (a.status === 'passed' && Array.isArray(a.evidence) && a.evidence.some(e => e?.result !== 'passed'))
|
|
124
|
+
errors.push(`evidence_result_mismatch:${id}`);
|
|
125
|
+
if (a.status === 'passed' && (!Array.isArray(a.evidence) || !a.evidence.length))
|
|
126
|
+
errors.push(`evidence_missing:${id}`);
|
|
127
|
+
if (['SEC-01', 'SEC-08'].includes(id) && (a.status === 'not_applicable' || !trustedRequired.includes(x.stage)))
|
|
128
|
+
errors.push(`mandatory_area_invalid:${id}`);
|
|
129
|
+
if (JSON.stringify(a.required_at) !== JSON.stringify(trustedRequired))
|
|
130
|
+
errors.push(`required_at_tampered:${id}`);
|
|
131
|
+
if (a.status === 'not_applicable' && (!a.reason || !a.reason.trim()))
|
|
132
|
+
errors.push(`not_applicable_reason_missing:${id}`);
|
|
133
|
+
if (a.status === 'needs_improvement' && (!a.finding || !a.severity || !a.owner || !a.follow_up || !a.mitigation))
|
|
134
|
+
errors.push(`improvement_details_missing:${id}`);
|
|
135
|
+
if (a.status === 'failed' && (!a.finding || !a.severity || !a.owner || !a.follow_up || !a.mitigation || !a.evidence?.length))
|
|
136
|
+
errors.push(`failure_details_missing:${id}`);
|
|
137
|
+
if (a.evidence && !Array.isArray(a.evidence))
|
|
138
|
+
errors.push(`evidence_array_invalid:${id}`);
|
|
139
|
+
(Array.isArray(a.evidence) ? a.evidence : []).forEach((e, i) => errors.push(...evidenceErrors(e, i).map((z) => `${id}:${z}`)));
|
|
140
|
+
return { ...a, explanation: SEC_AREAS[id], required_at: trustedRequired };
|
|
141
|
+
});
|
|
142
|
+
if (areas.filter((a) => a.id === 'SEC-01').length !== 1 || areas.filter((a) => a.id === 'SEC-08').length !== 1)
|
|
143
|
+
errors.push('mandatory_areas_missing');
|
|
144
|
+
if (hasSecret(x))
|
|
145
|
+
errors.push('record_contains_secret');
|
|
146
|
+
const blocking = areas.filter((a) => (a.required_at || []).includes(x.stage) && !['passed', 'not_applicable'].includes(a.status)).map((a) => `${a.id}:${a.status}`);
|
|
147
|
+
const allErrors = [...new Set(errors)];
|
|
148
|
+
const finalBlocking = [...new Set([...blocking, ...allErrors.map((e) => `contract:${e}`)])];
|
|
149
|
+
const result = finalBlocking.length ? 'BLOCKED' : 'PASS';
|
|
150
|
+
const canonical = { schema: 'yam.security-check-result.v1', retry_of: x.retry_of || 'none', run_id: runId, time: x.time, stage: x.stage, policy, policy_digest: policyDigest, binding: x.binding, environment: x.environment, scope: x.scope || [], checker: x.checker, areas, result, blocking: finalBlocking, deferred: areas.filter((a) => !(a.required_at || []).includes(x.stage) && a.status === 'unverified').map((a) => a.id), errors: allErrors };
|
|
151
|
+
return { ...canonical, digest: digest(canonical) };
|
|
152
|
+
}
|
|
153
|
+
function ensureSafePath(root, target) {
|
|
154
|
+
const r = path.resolve(root);
|
|
155
|
+
const t = path.resolve(target);
|
|
156
|
+
if (t !== r && !t.startsWith(`${r}${path.sep}`))
|
|
157
|
+
throw new Error('path_outside_root');
|
|
158
|
+
return t;
|
|
159
|
+
}
|
|
160
|
+
async function noSymlinkComponents(root, target) {
|
|
161
|
+
const rel = path.relative(root, target);
|
|
162
|
+
let cur = root;
|
|
163
|
+
for (const part of rel.split(path.sep).filter(Boolean)) {
|
|
164
|
+
cur = path.join(cur, part);
|
|
165
|
+
try {
|
|
166
|
+
if ((await fsp.lstat(cur)).isSymbolicLink())
|
|
167
|
+
throw new Error('symlink_path_rejected');
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
if (e.code !== 'ENOENT')
|
|
171
|
+
throw e;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async function withLock(lock, fn) { for (let i = 0; i < 50; i++) {
|
|
176
|
+
try {
|
|
177
|
+
await fsp.mkdir(lock);
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
catch (e) {
|
|
181
|
+
if (e.code !== 'EEXIST')
|
|
182
|
+
throw e;
|
|
183
|
+
await new Promise((r) => setTimeout(r, 10));
|
|
184
|
+
}
|
|
185
|
+
if (i === 49)
|
|
186
|
+
throw new Error('security_note_lock_timeout');
|
|
187
|
+
} try {
|
|
188
|
+
await fn();
|
|
189
|
+
}
|
|
190
|
+
finally {
|
|
191
|
+
await fsp.rm(lock, { recursive: true, force: true });
|
|
192
|
+
} }
|
|
193
|
+
export async function persistSecurityCheck(dir, input, result, options = {}) {
|
|
194
|
+
const root = await fsp.realpath(dir);
|
|
195
|
+
let checked = validateSecurityCheck(input);
|
|
196
|
+
// Integration may only add blocking findings; it cannot promote a failed contract.
|
|
197
|
+
if (result?.result === 'BLOCKED') {
|
|
198
|
+
checked = { ...checked, result: 'BLOCKED', errors: [...new Set([...checked.errors, ...result.errors])], blocking: [...new Set([...checked.blocking, ...result.blocking])] };
|
|
199
|
+
}
|
|
200
|
+
if (hasSecret(checked) || checked.errors.some(e => /text_invalid|secret/.test(e))) {
|
|
201
|
+
const sanitized = createSecurityStarter({ stage: ['commit', 'push', 'deploy'].includes(input?.stage) ? input.stage : 'commit', binding: { stage: input?.stage || 'commit', withheld: true }, environment: 'withheld', scope: ['unsafe input omitted'], checker: 'yam-security-check' });
|
|
202
|
+
checked = validateSecurityCheck(sanitized);
|
|
203
|
+
checked.errors.push('unsafe_input_redacted');
|
|
204
|
+
checked.blocking.push('contract:unsafe_input_redacted');
|
|
205
|
+
}
|
|
206
|
+
checked.digest = digest({ ...checked, digest: undefined });
|
|
207
|
+
const base = ensureSafePath(root, path.join(root, '.yam', 'security'));
|
|
208
|
+
await noSymlinkComponents(root, base);
|
|
209
|
+
await fsp.mkdir(base, { recursive: true, mode: 0o700 });
|
|
210
|
+
const runs = ensureSafePath(root, path.join(base, 'runs'));
|
|
211
|
+
const originalRoot = path.resolve(dir);
|
|
212
|
+
const requestedNote = options.notePath ? path.resolve(originalRoot, options.notePath) : path.join(originalRoot, '.yam', 'security', 'notes.md');
|
|
213
|
+
ensureSafePath(originalRoot, requestedNote);
|
|
214
|
+
const note = ensureSafePath(root, path.resolve(root, path.relative(originalRoot, requestedNote)));
|
|
215
|
+
const lock = path.join(base, '.lock');
|
|
216
|
+
await noSymlinkComponents(root, note);
|
|
217
|
+
await noSymlinkComponents(root, runs);
|
|
218
|
+
let runPath = '';
|
|
219
|
+
await withLock(lock, async () => {
|
|
220
|
+
await noSymlinkComponents(root, note);
|
|
221
|
+
await fsp.mkdir(path.dirname(note), { recursive: true, mode: 0o700 });
|
|
222
|
+
await fsp.mkdir(runs, { recursive: true, mode: 0o700 });
|
|
223
|
+
runPath = ensureSafePath(runs, path.join(runs, `${checked.run_id}.json`));
|
|
224
|
+
await noSymlinkComponents(root, runPath);
|
|
225
|
+
try {
|
|
226
|
+
await fsp.lstat(runPath);
|
|
227
|
+
throw new Error('security_run_exists');
|
|
228
|
+
}
|
|
229
|
+
catch (e) {
|
|
230
|
+
if (e.code !== 'ENOENT')
|
|
231
|
+
throw e;
|
|
232
|
+
}
|
|
233
|
+
const handle = await fsp.open(note, fs.constants.O_WRONLY | fs.constants.O_APPEND | fs.constants.O_CREAT | fs.constants.O_NOFOLLOW, 0o600);
|
|
234
|
+
try {
|
|
235
|
+
const info = await handle.stat();
|
|
236
|
+
if (!info.isFile() || info.nlink !== 1)
|
|
237
|
+
throw new Error('unsafe_note_file');
|
|
238
|
+
await fsp.writeFile(runPath, JSON.stringify(checked, null, 2) + '\n', { encoding: 'utf8', mode: 0o600, flag: 'wx' });
|
|
239
|
+
await handle.writeFile(renderSecurityNote(checked), 'utf8');
|
|
240
|
+
await handle.sync();
|
|
241
|
+
}
|
|
242
|
+
finally {
|
|
243
|
+
await handle.close();
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
return { run_path: path.relative(root, runPath), note_path: path.relative(root, note), result: checked };
|
|
247
|
+
}
|
|
248
|
+
export function renderSecurityNote(result) {
|
|
249
|
+
const clean = (x) => String(x ?? '').replace(/[\r\n\x00-\x1f\x7f]/g, ' ');
|
|
250
|
+
const lines = ['-- Security check --', '', 'Contract: security-check-v1', `Run: ${clean(result.run_id)}; Time: ${clean(result.time)}`, `Stage: ${result.stage}; Policy: ${clean(result.policy_digest)}`, `Environment: ${clean(result.environment)}`, `Binding: ${clean(JSON.stringify(result.binding))}`, `Scope: ${result.scope.map(clean).join(', ')}`, `Checker: ${clean(result.checker)}`, ''];
|
|
251
|
+
result.areas.forEach((a, i) => {
|
|
252
|
+
lines.push(`${i + 1}. ${a.id} : "${SEC_AREAS[a.id]}" : ${STATUS_KO[a.status] || '미검증'}`);
|
|
253
|
+
lines.push(` - Required at: ${a.required_at.join(', ')}`);
|
|
254
|
+
if (Array.isArray(a.evidence) && a.evidence.length)
|
|
255
|
+
lines.push(` - Evidence: ${a.evidence.map(e => `${clean(e.reference)} (${clean(e.sha256)}) by ${clean(e.checker)} at ${clean(e.checked_at)}`).join('; ')}`);
|
|
256
|
+
for (const field of ['reason', 'finding', 'severity', 'owner', 'follow_up', 'mitigation'])
|
|
257
|
+
if (a[field])
|
|
258
|
+
lines.push(` - ${field}: ${clean(a[field])}`);
|
|
259
|
+
});
|
|
260
|
+
lines.push('', `Retry of: ${clean(result.retry_of || 'none')}`, `Result: ${result.result}`, `Blocking: ${result.blocking.map(clean).join(', ') || 'none'}`, `Deferred: ${result.deferred.join(', ') || 'none'}`, '-- End Security check --', '');
|
|
261
|
+
return lines.join('\n');
|
|
262
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type SecurityBinding = Record<string, unknown>;
|
|
2
|
+
export interface SecurityCommandOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
cliPath?: string;
|
|
5
|
+
stdin?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function collectSecurityBinding(cwd: string, stage: string, options: Map<string, string>, stdin?: string): SecurityBinding;
|
|
8
|
+
export declare function runSecurityCommand(args: string[], settings?: SecurityCommandOptions): Promise<Record<string, unknown>>;
|