@bugb-technologies/bravos 1.12.1 → 1.14.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/dist/cli.js +6 -3
- package/dist/doctor.js +6 -1
- package/dist/guide.js +3 -1
- package/dist/help.js +17 -1
- package/dist/hooks.js +12 -2
- package/dist/plugin.js +4 -2
- package/dist/prefs.js +13 -3
- package/dist/start/answers.js +4 -0
- package/dist/start/index.js +27 -1
- package/dist/uninstall.js +1 -1
- package/docs/GUIDE.md +9 -1
- package/docs/UPGRADING.md +40 -0
- package/hooks/cards.mjs +74 -0
- package/hooks/lib/cards.mjs +201 -0
- package/hooks/lib/prefs.mjs +7 -4
- package/hooks/lib/threat-issues.mjs +343 -0
- package/package.json +1 -1
- package/templates/dashboard/dashboard.html +183 -6
- package/templates/workflows/bravos-nightly-claude.yml +60 -0
- package/templates/workflows/bravos-nightly-codex.yml +60 -0
- package/templates/workflows/bravos-nightly-copilot.yml +60 -0
|
@@ -56,7 +56,13 @@ iframe { flex: 1; width: 100%; border: 0; background: var(--canvas); }
|
|
|
56
56
|
.aged { padding: 8px 16px; font-size: 13px; color: var(--fg); background: var(--canvas-inset); border-bottom: 1px solid var(--border); border-left: 3px solid var(--review); }
|
|
57
57
|
.aged[hidden] { display: none; }
|
|
58
58
|
.aged p { margin: 0; }
|
|
59
|
-
.strip { padding: 6px 16px; font-size: 12px; color: var(--fg-subtle); background: var(--canvas-inset); border-bottom: 1px solid var(--border); }
|
|
59
|
+
.strip { padding: 6px 16px; font-size: 12px; color: var(--fg-subtle); background: var(--canvas-inset); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
|
|
60
|
+
.strip span { flex: 1; min-width: 0; }
|
|
61
|
+
.strip button { font: 500 12px var(--sans); color: var(--fg); background: var(--panel); border: 1px solid var(--border-strong); border-radius: 6px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
|
|
62
|
+
.strip button:hover { background: var(--raised); }
|
|
63
|
+
.strip button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
64
|
+
/* Full screen: the active view takes the whole window; the bar and the age strip step aside until it is left. */
|
|
65
|
+
body.full .bar, body.full .aged { display: none; }
|
|
60
66
|
.note { max-width: 640px; margin: 48px auto; padding: 20px 24px; background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--review); border-radius: var(--radius); }
|
|
61
67
|
.note h2 { margin: 0 0 6px; font-size: 15px; }
|
|
62
68
|
.note p { margin: 0; color: var(--fg-muted); }
|
|
@@ -157,6 +163,138 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
157
163
|
document.title = `Bravos — ${DATA.repo}`;
|
|
158
164
|
|
|
159
165
|
const views = [];
|
|
166
|
+
// A one-line strip above a framed view, with an optional button at its end.
|
|
167
|
+
const strip = (text, button) => {
|
|
168
|
+
const s = el('div', { class: 'strip' });
|
|
169
|
+
s.append(el('span', {}, text || ''));
|
|
170
|
+
if (button) s.append(button);
|
|
171
|
+
return s;
|
|
172
|
+
};
|
|
173
|
+
const RULES = (() => {
|
|
174
|
+
try {
|
|
175
|
+
return JSON.parse(document.getElementById('bravos-rules').textContent);
|
|
176
|
+
} catch {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
const hasRules = !!(RULES && Array.isArray(RULES.rules) && RULES.rules.length);
|
|
181
|
+
let rulesTabNeeded = () => {};
|
|
182
|
+
// Design rules, drawn inside GuardLink's page: a "Design rules" item in its own sidebar and a section in its
|
|
183
|
+
// own style, so the rules sit beside the exposures they guard. Everything goes into the frame's srcdoc, where
|
|
184
|
+
// the frame's own script builds it from inert JSON as text, never as markup. When GuardLink's page has no
|
|
185
|
+
// sidebar to add to, the frame tells this page, which shows the rules on their own tab instead.
|
|
186
|
+
// @comment -- "Runs inside GuardLink's sandboxed frame: adds a Design rules item after Exposures in its sidebar and a section after its exposures, built from inert JSON whose '<' is escaped, with every rule's text set as textContent (the only markup is a fixed icon). With no sidebar it places nothing and posts rules-not-placed to the dashboard, which then shows its fallback tab."
|
|
187
|
+
const frameRules = () => {
|
|
188
|
+
var doc = JSON.parse(document.getElementById('bravos-rules-data').textContent);
|
|
189
|
+
var nav = document.querySelector('.rail-nav');
|
|
190
|
+
var main = document.querySelector('main.main') || document.getElementById('main');
|
|
191
|
+
if (!nav || !main || document.getElementById('sec-rules')) {
|
|
192
|
+
try { parent.postMessage({ bravos: 'rules-not-placed' }, '*'); } catch (e) { /* no parent */ }
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
var mk = function (tag, cls, text) {
|
|
196
|
+
var n = document.createElement(tag);
|
|
197
|
+
if (cls) n.className = cls;
|
|
198
|
+
if (text !== undefined && text !== null) n.textContent = String(text);
|
|
199
|
+
return n;
|
|
200
|
+
};
|
|
201
|
+
var LABEL = { broken: 'broken', 'retest-due': 'retest due', holds: 'holds', unguarded: 'unguarded', 'guarded-untested': 'guarded, untested', 'not-placed': 'not placed' };
|
|
202
|
+
var SITE = { check: 'enforced at', gap: 'no control at', grant: 'granted in' };
|
|
203
|
+
var STATE = { broken: 'a test got through', retest: 'code changed since its test', held: 'a test was refused', untested: 'not tested' };
|
|
204
|
+
var rules = Array.isArray(doc.rules) ? doc.rules : [];
|
|
205
|
+
var attention = rules.filter(function (r) { return r.status !== 'holds'; }).length;
|
|
206
|
+
// The sidebar item, after Exposures.
|
|
207
|
+
var link = mk('a');
|
|
208
|
+
link.href = '#rules';
|
|
209
|
+
link.setAttribute('data-page', 'rules');
|
|
210
|
+
var icon = mk('span', 'nav-icon');
|
|
211
|
+
icon.innerHTML = '<svg class="ico" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 11l3 3L22 4"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></svg>';
|
|
212
|
+
link.append(icon, mk('span', 'nav-text', 'Design rules'));
|
|
213
|
+
if (attention) link.append(mk('span', 'nav-badge num', attention));
|
|
214
|
+
var after = nav.querySelector('a[data-page="exposures"]');
|
|
215
|
+
if (after && after.nextSibling) nav.insertBefore(link, after.nextSibling);
|
|
216
|
+
else nav.append(link);
|
|
217
|
+
// The section, in GuardLink's own layout and colours.
|
|
218
|
+
var sec = mk('section', 'section-content');
|
|
219
|
+
sec.id = 'sec-rules';
|
|
220
|
+
sec.setAttribute('aria-label', 'Design rules');
|
|
221
|
+
var head = mk('div', 'page-head');
|
|
222
|
+
var ht = mk('div', 'ph-text');
|
|
223
|
+
ht.append(mk('h2', 'ph-title', 'Design rules'), mk('p', 'lead', doc.note || ''), mk('p', 'lead', 'The business-logic rules your design states (INV-n in .guardlink/intent.md), where the code enforces each one, and what testing has shown. Broken and lapsed rules come first.'));
|
|
224
|
+
head.append(ht);
|
|
225
|
+
sec.append(head);
|
|
226
|
+
var chips = mk('div', 'rchips');
|
|
227
|
+
var sum = doc.summary || {};
|
|
228
|
+
['broken', 'retest-due', 'unguarded', 'guarded-untested', 'not-placed', 'holds'].forEach(function (k) {
|
|
229
|
+
if (!sum[k]) return;
|
|
230
|
+
var c = mk('span', 'rchip ' + k);
|
|
231
|
+
c.append(mk('b', '', sum[k]), ' ' + LABEL[k]);
|
|
232
|
+
chips.append(c);
|
|
233
|
+
});
|
|
234
|
+
if (sum.draft) {
|
|
235
|
+
var d = mk('span', 'rchip');
|
|
236
|
+
d.append(mk('b', '', sum.draft), ' still a draft');
|
|
237
|
+
chips.append(d);
|
|
238
|
+
}
|
|
239
|
+
sec.append(chips);
|
|
240
|
+
rules.forEach(function (r) {
|
|
241
|
+
var status = LABEL[r.status] ? r.status : 'not-placed';
|
|
242
|
+
var card = mk('article', 'rule ' + status);
|
|
243
|
+
var top = mk('div', 'rule-head');
|
|
244
|
+
top.append(mk('span', 'rpill ' + status, LABEL[status]), mk('span', 'rule-id', r.id || r.threat || 'rule'));
|
|
245
|
+
if (r.decided === 'draft') top.append(mk('span', 'rpill', 'draft'));
|
|
246
|
+
if (r.threat) top.append(mk('span', 'rule-threat', [r.threat, r.severity].filter(Boolean).join(' · ')));
|
|
247
|
+
card.append(top, mk('p', 'rule-text', r.text || ''));
|
|
248
|
+
if (r.why) card.append(mk('p', 'rule-why', r.why));
|
|
249
|
+
var meta = [];
|
|
250
|
+
if (Array.isArray(r.sources) && r.sources.length) meta.push('from ' + r.sources.map(function (s) { return s.id + (s.section ? ' "' + s.section + '"' : ''); }).join('; '));
|
|
251
|
+
meta.push(r.decided === 'draft' ? 'nobody has confirmed it yet' : r.decidedBy ? 'confirmed by ' + r.decidedBy : r.decided === 'confirmed' ? 'confirmed' : '');
|
|
252
|
+
var m = meta.filter(Boolean).join(' · ');
|
|
253
|
+
if (m) card.append(mk('p', 'rule-meta', m));
|
|
254
|
+
if (Array.isArray(r.sites) && r.sites.length) {
|
|
255
|
+
var sites = mk('ul', 'rule-sites');
|
|
256
|
+
r.sites.forEach(function (s) {
|
|
257
|
+
var li = mk('li');
|
|
258
|
+
li.append(mk('span', 'site-kind', SITE[s.kind] || 'at'), mk('span', 'site-where', String(s.file) + (s.line ? ':' + s.line : '')));
|
|
259
|
+
if (s.state) li.append(mk('span', 'site-state ' + s.state, STATE[s.state] || s.state));
|
|
260
|
+
if (s.control) li.append(mk('span', 'site-extra', 'by #' + s.control));
|
|
261
|
+
if (s.testedAt) li.append(mk('span', 'site-extra', String(s.testedAt).slice(0, 10)));
|
|
262
|
+
sites.append(li);
|
|
263
|
+
});
|
|
264
|
+
card.append(sites);
|
|
265
|
+
}
|
|
266
|
+
sec.append(card);
|
|
267
|
+
});
|
|
268
|
+
var exp = document.getElementById('sec-exposures');
|
|
269
|
+
if (exp && exp.parentNode === main && exp.nextSibling) main.insertBefore(sec, exp.nextSibling);
|
|
270
|
+
else main.append(sec);
|
|
271
|
+
};
|
|
272
|
+
const RULES_CSS = [
|
|
273
|
+
'#sec-rules .rchips{display:flex;flex-wrap:wrap;gap:6px;margin:14px 0 16px}',
|
|
274
|
+
'#sec-rules .rchip{display:inline-flex;align-items:baseline;gap:5px;padding:2px 9px;border:1px solid var(--border);border-radius:999px;background:var(--raised);font-size:12px;color:var(--fg-muted)}',
|
|
275
|
+
'#sec-rules .rchip b{font-weight:650;color:var(--fg);font-variant-numeric:tabular-nums}',
|
|
276
|
+
'#sec-rules .rchip.broken{border-color:var(--sev-critical)}#sec-rules .rchip.retest-due,#sec-rules .rchip.unguarded{border-color:var(--review)}#sec-rules .rchip.holds{border-color:var(--resolved)}',
|
|
277
|
+
'#sec-rules .rule{background:var(--panel);border:1px solid var(--border);border-left:3px solid var(--border-strong);border-radius:10px;padding:12px 14px;margin:0 0 10px;max-width:1100px}',
|
|
278
|
+
'#sec-rules .rule.broken{border-left-color:var(--sev-critical)}#sec-rules .rule.retest-due,#sec-rules .rule.unguarded{border-left-color:var(--review)}#sec-rules .rule.holds{border-left-color:var(--resolved)}',
|
|
279
|
+
'#sec-rules .rule-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}',
|
|
280
|
+
'#sec-rules .rpill{font-size:10.5px;font-weight:650;text-transform:uppercase;letter-spacing:.05em;padding:2px 6px;border-radius:4px;border:1px solid var(--border-strong);color:var(--fg-muted);white-space:nowrap}',
|
|
281
|
+
'#sec-rules .rpill.broken{color:var(--sev-critical);border-color:var(--sev-critical)}#sec-rules .rpill.retest-due,#sec-rules .rpill.unguarded{color:var(--review);border-color:var(--review)}#sec-rules .rpill.holds{color:var(--resolved);border-color:var(--resolved)}',
|
|
282
|
+
'#sec-rules .rule-id{font-weight:650;font-family:var(--font-mono,ui-monospace,monospace);font-size:12.5px}',
|
|
283
|
+
'#sec-rules .rule-threat{margin-left:auto;font-family:var(--font-mono,ui-monospace,monospace);font-size:11.5px;color:var(--fg-subtle)}',
|
|
284
|
+
'#sec-rules .rule-text{margin:8px 0 4px;font-size:13.5px;color:var(--fg);line-height:1.45}',
|
|
285
|
+
'#sec-rules .rule-why{margin:0 0 6px;font-size:12.5px;color:var(--fg-muted)}',
|
|
286
|
+
'#sec-rules .rule-meta{margin:0;font-size:12px;color:var(--fg-subtle)}',
|
|
287
|
+
'#sec-rules .rule-sites{list-style:none;margin:10px 0 0;padding:8px 0 0;border-top:1px solid var(--border-muted,var(--border));font-size:12px;display:grid;gap:3px}',
|
|
288
|
+
'#sec-rules .rule-sites li{display:flex;flex-wrap:wrap;gap:4px 10px;color:var(--fg-muted)}',
|
|
289
|
+
'#sec-rules .site-kind{min-width:92px;color:var(--fg-subtle)}#sec-rules .site-where{font-family:var(--font-mono,ui-monospace,monospace);color:var(--fg);overflow-wrap:anywhere}',
|
|
290
|
+
'#sec-rules .site-state.broken{color:var(--sev-critical)}#sec-rules .site-state.retest{color:var(--review)}#sec-rules .site-state.held{color:var(--resolved)}',
|
|
291
|
+
].join('');
|
|
292
|
+
const rulesForFrame = () => {
|
|
293
|
+
// With no rules yet, the sidebar item still appears, saying how to get them.
|
|
294
|
+
const doc = hasRules ? RULES : { rules: [], note: (DATA.rules || {}).note || 'No design rules yet: /bravos-context asks for your design documents and writes the rules they state into .guardlink/intent.md.' };
|
|
295
|
+
const inert = JSON.stringify(doc).replace(/</g, '\\u003c');
|
|
296
|
+
return '<style>' + RULES_CSS + '</style><script type="application/json" id="bravos-rules-data">' + inert + '</scr' + 'ipt><scr' + 'ipt>(' + frameRules.toString() + ')();</scr' + 'ipt>';
|
|
297
|
+
};
|
|
160
298
|
// Threat model: GuardLink's own page, shown whole in a sandboxed frame (srcdoc), so it has no access to this
|
|
161
299
|
// page, and this page's policy keeps it off the network. GuardLink routes on location.hash, and a "#page"
|
|
162
300
|
// link in a srcdoc frame would resolve against this file and load it inside the frame; the small script
|
|
@@ -173,9 +311,14 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
173
311
|
section.append(note(tm.state === 'missing' ? 'GuardLink is not installed' : 'No threat model to show yet', tm.note || 'Run bravos dashboard again after annotating.'));
|
|
174
312
|
return;
|
|
175
313
|
}
|
|
176
|
-
section.append(
|
|
314
|
+
section.append(strip(tm.note));
|
|
177
315
|
const frame = el('iframe', { title: 'GuardLink threat model', sandbox: 'allow-scripts allow-popups allow-popups-to-escape-sandbox', referrerpolicy: 'no-referrer' });
|
|
178
|
-
frame.srcdoc = html + STAY;
|
|
316
|
+
frame.srcdoc = html + STAY + rulesForFrame();
|
|
317
|
+
// The frame says when it found no place for the design rules in GuardLink's page (its layout changed):
|
|
318
|
+
// they are then shown on their own tab instead, so they are never lost.
|
|
319
|
+
window.addEventListener('message', (e) => {
|
|
320
|
+
if (e.source === frame.contentWindow && e.data && e.data.bravos === 'rules-not-placed') rulesTabNeeded();
|
|
321
|
+
});
|
|
179
322
|
section.append(frame);
|
|
180
323
|
},
|
|
181
324
|
});
|
|
@@ -186,6 +329,9 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
186
329
|
views.push({
|
|
187
330
|
id: 'design-rules',
|
|
188
331
|
label: 'Design rules',
|
|
332
|
+
// Shown on its own tab only when there is no GuardLink page to place the rules in, or that page had no
|
|
333
|
+
// sidebar for them; otherwise the rules are under Threat model.
|
|
334
|
+
fallback: true,
|
|
189
335
|
build(section) {
|
|
190
336
|
const part = DATA.rules || {};
|
|
191
337
|
const doc = JSON.parse(document.getElementById('bravos-rules').textContent);
|
|
@@ -269,6 +415,8 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
269
415
|
'--vscode-focusBorder:#8fc4ee;--vscode-textLink-foreground:#8fc4ee;--vscode-button-background:#8fc4ee;--vscode-button-foreground:#08131b;--vscode-button-hoverBackground:#a9d3f3;--vscode-button-secondaryBackground:#1a212a;--vscode-button-secondaryForeground:#e8eef4;',
|
|
270
416
|
'--vscode-charts-green:#3fae86;--vscode-charts-yellow:#e0a24e;--vscode-widget-shadow:rgba(0,0,0,.35)}}',
|
|
271
417
|
'html,body{min-height:100%}#said{position:sticky;bottom:0;margin:0;padding:7px 14px;min-height:30px;font:12px/1.4 var(--vscode-editor-font-family);color:var(--vscode-descriptionForeground);background:var(--vscode-sideBar-background);border-top:1px solid var(--vscode-panel-border);overflow-wrap:anywhere}',
|
|
418
|
+
// The map gets nearly the whole frame; the summary panels below it are reached by scrolling the frame.
|
|
419
|
+
'.map-page{height:auto;min-height:0}.map-host{flex:none;height:max(420px,calc(100vh - 120px))}',
|
|
272
420
|
].join('');
|
|
273
421
|
// The stand-in for the editor, run inside the frame before the pages' script. It speaks the pages' own
|
|
274
422
|
// protocol (siete: clients/vscode/src/webview/pages/protocol.ts): "ready" and "page" are answered with the
|
|
@@ -322,7 +470,25 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
322
470
|
section.append(note(titles[cg.state] || 'No code graph to show', cg.note || 'Run bravos dashboard again after building the code graph.'));
|
|
323
471
|
return;
|
|
324
472
|
}
|
|
325
|
-
|
|
473
|
+
// @comment -- "The code graph's Full screen button: hides the bar so the framed pages fill the window and asks the browser for full screen where it allows; Esc, the button or leaving browser full screen restores the bar."
|
|
474
|
+
// Full screen: the code graph takes the whole window (and the screen, where the browser allows), so the
|
|
475
|
+
// map has room to zoom; Esc or the button returns.
|
|
476
|
+
const button = el('button', { type: 'button' }, 'Full screen');
|
|
477
|
+
const setFull = (on) => {
|
|
478
|
+
document.body.classList.toggle('full', on);
|
|
479
|
+
button.textContent = on ? 'Exit full screen' : 'Full screen';
|
|
480
|
+
};
|
|
481
|
+
button.addEventListener('click', () => {
|
|
482
|
+
const on = !document.body.classList.contains('full');
|
|
483
|
+
setFull(on);
|
|
484
|
+
try {
|
|
485
|
+
if (on && document.documentElement.requestFullscreen && !document.fullscreenElement) document.documentElement.requestFullscreen().catch(() => {});
|
|
486
|
+
if (!on && document.fullscreenElement && document.exitFullscreen) document.exitFullscreen().catch(() => {});
|
|
487
|
+
} catch { /* the window-filling view still applies */ }
|
|
488
|
+
});
|
|
489
|
+
document.addEventListener('fullscreenchange', () => { if (!document.fullscreenElement) setFull(false); });
|
|
490
|
+
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && document.body.classList.contains('full')) setFull(false); });
|
|
491
|
+
section.append(strip(cg.note, button));
|
|
326
492
|
const inert = JSON.stringify(store).replace(/</g, '\\u003c');
|
|
327
493
|
const open = '<scr' + 'ipt>';
|
|
328
494
|
const close = '</scr' + 'ipt>';
|
|
@@ -350,8 +516,11 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
350
516
|
}
|
|
351
517
|
}
|
|
352
518
|
};
|
|
519
|
+
const tmPresent = (DATA.threatModel || {}).state === 'present';
|
|
520
|
+
const visible = () => views.filter((v) => !v.tab.hidden);
|
|
353
521
|
for (const v of views) {
|
|
354
522
|
v.tab = el('button', { type: 'button', role: 'tab', 'aria-controls': `view-${v.id}` }, v.label);
|
|
523
|
+
if (v.fallback) v.tab.hidden = tmPresent;
|
|
355
524
|
v.section = el('section', { id: `view-${v.id}`, role: 'tabpanel' });
|
|
356
525
|
v.tab.addEventListener('click', () => {
|
|
357
526
|
history.replaceState(null, '', `#${v.id}`);
|
|
@@ -361,9 +530,17 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
361
530
|
main.append(v.section);
|
|
362
531
|
}
|
|
363
532
|
// One view needs no tab bar.
|
|
364
|
-
|
|
533
|
+
const sync = () => { tabs.hidden = visible().length < 2; };
|
|
534
|
+
rulesTabNeeded = () => {
|
|
535
|
+
const v = views.find((x) => x.fallback);
|
|
536
|
+
if (v && v.tab.hidden) {
|
|
537
|
+
v.tab.hidden = false;
|
|
538
|
+
sync();
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
sync();
|
|
365
542
|
const wanted = location.hash.slice(1);
|
|
366
|
-
show(
|
|
543
|
+
show(visible().some((v) => v.id === wanted) ? wanted : visible()[0].id);
|
|
367
544
|
})();
|
|
368
545
|
</script>
|
|
369
546
|
</body>
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
# delete that secret to run on your plan instead. Also enable Settings > Actions > General >
|
|
12
12
|
# "Allow GitHub Actions to create and approve pull requests". Pin the actions to commit SHAs if
|
|
13
13
|
# your organisation requires it.
|
|
14
|
+
# Team view, off by default: set the repository variable BRAVOS_THREAT_ISSUES to on (Settings > Secrets and
|
|
15
|
+
# variables > Actions > Variables) and the threat-issues job opens one issue per critical or high threat still
|
|
16
|
+
# untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after it was committed. A confirmed threat keeps its issue,
|
|
17
|
+
# relabelled confirmed; it closes once the threat is refuted, fixed, accepted or removed. It needs no secret: the
|
|
18
|
+
# job's own token opens the issues.
|
|
14
19
|
name: bravos nightly (Claude Code)
|
|
15
20
|
|
|
16
21
|
on:
|
|
@@ -267,3 +272,58 @@ jobs:
|
|
|
267
272
|
guardlink diff "$START" --markdown || true
|
|
268
273
|
} > "$RUNNER_TEMP/body.md"
|
|
269
274
|
gh pr create --base "$base" --head "$branch" --title "annotate: nightly coverage slice" --body-file "$RUNNER_TEMP/body.md"
|
|
275
|
+
|
|
276
|
+
# The team view, off by default: with the repository variable BRAVOS_THREAT_ISSUES set to on, one issue per critical
|
|
277
|
+
# or high @exposes claim still untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after its annotation was committed,
|
|
278
|
+
# relabelled confirmed when a test confirms it, and closed by a later run once the claim is refuted, fixed, accepted
|
|
279
|
+
# or removed; a claim untested again or due a retest reopens the issue the nightly closed. It reads the default
|
|
280
|
+
# branch as merged with guardlink and writes issues with gh and this job's own token; no agent runs here, and annotation
|
|
281
|
+
# text reaches gh only as arguments and --body-file from hooks/lib/threat-issues.mjs, never as a shell line.
|
|
282
|
+
threat-issues:
|
|
283
|
+
if: vars.BRAVOS_THREAT_ISSUES == 'on' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
|
284
|
+
runs-on: ubuntu-latest
|
|
285
|
+
timeout-minutes: 15
|
|
286
|
+
permissions:
|
|
287
|
+
contents: read
|
|
288
|
+
issues: write
|
|
289
|
+
defaults:
|
|
290
|
+
run:
|
|
291
|
+
shell: bash
|
|
292
|
+
steps:
|
|
293
|
+
- uses: actions/checkout@v4
|
|
294
|
+
with:
|
|
295
|
+
# guardlink blame reads when each claim was committed from the full history.
|
|
296
|
+
fetch-depth: 0
|
|
297
|
+
persist-credentials: false
|
|
298
|
+
|
|
299
|
+
- uses: actions/setup-node@v4
|
|
300
|
+
with:
|
|
301
|
+
node-version: 22
|
|
302
|
+
|
|
303
|
+
- name: Install guardlink
|
|
304
|
+
run: bash .bravos/hooks/lib/nightly-tools.sh annotate
|
|
305
|
+
|
|
306
|
+
- name: Issues for untested threats
|
|
307
|
+
env:
|
|
308
|
+
GH_TOKEN: ${{ github.token }}
|
|
309
|
+
REPO: ${{ github.repository }}
|
|
310
|
+
SERVER: ${{ github.server_url }}
|
|
311
|
+
SHA: ${{ github.sha }}
|
|
312
|
+
DAYS: ${{ vars.BRAVOS_THREAT_ISSUES_DAYS }}
|
|
313
|
+
run: |
|
|
314
|
+
model="$RUNNER_TEMP/bravos-issues-model.json"
|
|
315
|
+
ledger="$RUNNER_TEMP/bravos-issues-ledger.json"
|
|
316
|
+
blame="$RUNNER_TEMP/bravos-issues-blame.json"
|
|
317
|
+
if ! guardlink parse . > "$model" || ! jq -e '.exposures | arrays' "$model" > /dev/null; then
|
|
318
|
+
echo "::error::unknown: guardlink parse failed"
|
|
319
|
+
exit 1
|
|
320
|
+
fi
|
|
321
|
+
if ! guardlink hypothesis list --json > "$ledger" || ! jq -e '(.ledger == "present" or .ledger == "absent") and (.records | arrays)' "$ledger" > /dev/null; then
|
|
322
|
+
echo "::error::unknown: GuardLink hypothesis ledger unreadable"
|
|
323
|
+
exit 1
|
|
324
|
+
fi
|
|
325
|
+
if ! guardlink blame . --json > "$blame" || ! jq -e '.entries | arrays' "$blame" > /dev/null; then
|
|
326
|
+
echo "::error::unknown: guardlink blame failed"
|
|
327
|
+
exit 1
|
|
328
|
+
fi
|
|
329
|
+
node .bravos/hooks/lib/threat-issues.mjs "$model" "$ledger" "$blame"
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
# Needs the repo secret OPENAI_API_KEY, and Settings > Actions > General > "Allow GitHub
|
|
9
9
|
# Actions to create and approve pull requests". Pin the actions to commit SHAs if your
|
|
10
10
|
# organisation requires it.
|
|
11
|
+
# Team view, off by default: set the repository variable BRAVOS_THREAT_ISSUES to on (Settings > Secrets and
|
|
12
|
+
# variables > Actions > Variables) and the threat-issues job opens one issue per critical or high threat still
|
|
13
|
+
# untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after it was committed. A confirmed threat keeps its issue,
|
|
14
|
+
# relabelled confirmed; it closes once the threat is refuted, fixed, accepted or removed. It needs no secret: the
|
|
15
|
+
# job's own token opens the issues.
|
|
11
16
|
name: bravos nightly (Codex)
|
|
12
17
|
|
|
13
18
|
on:
|
|
@@ -262,3 +267,58 @@ jobs:
|
|
|
262
267
|
guardlink diff "$START" --markdown || true
|
|
263
268
|
} > "$RUNNER_TEMP/body.md"
|
|
264
269
|
gh pr create --base "$base" --head "$branch" --title "annotate: nightly coverage slice" --body-file "$RUNNER_TEMP/body.md"
|
|
270
|
+
|
|
271
|
+
# The team view, off by default: with the repository variable BRAVOS_THREAT_ISSUES set to on, one issue per critical
|
|
272
|
+
# or high @exposes claim still untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after its annotation was committed,
|
|
273
|
+
# relabelled confirmed when a test confirms it, and closed by a later run once the claim is refuted, fixed, accepted
|
|
274
|
+
# or removed; a claim untested again or due a retest reopens the issue the nightly closed. It reads the default
|
|
275
|
+
# branch as merged with guardlink and writes issues with gh and this job's own token; no agent runs here, and annotation
|
|
276
|
+
# text reaches gh only as arguments and --body-file from hooks/lib/threat-issues.mjs, never as a shell line.
|
|
277
|
+
threat-issues:
|
|
278
|
+
if: vars.BRAVOS_THREAT_ISSUES == 'on' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
|
279
|
+
runs-on: ubuntu-latest
|
|
280
|
+
timeout-minutes: 15
|
|
281
|
+
permissions:
|
|
282
|
+
contents: read
|
|
283
|
+
issues: write
|
|
284
|
+
defaults:
|
|
285
|
+
run:
|
|
286
|
+
shell: bash
|
|
287
|
+
steps:
|
|
288
|
+
- uses: actions/checkout@v4
|
|
289
|
+
with:
|
|
290
|
+
# guardlink blame reads when each claim was committed from the full history.
|
|
291
|
+
fetch-depth: 0
|
|
292
|
+
persist-credentials: false
|
|
293
|
+
|
|
294
|
+
- uses: actions/setup-node@v4
|
|
295
|
+
with:
|
|
296
|
+
node-version: 22
|
|
297
|
+
|
|
298
|
+
- name: Install guardlink
|
|
299
|
+
run: bash .bravos/hooks/lib/nightly-tools.sh annotate
|
|
300
|
+
|
|
301
|
+
- name: Issues for untested threats
|
|
302
|
+
env:
|
|
303
|
+
GH_TOKEN: ${{ github.token }}
|
|
304
|
+
REPO: ${{ github.repository }}
|
|
305
|
+
SERVER: ${{ github.server_url }}
|
|
306
|
+
SHA: ${{ github.sha }}
|
|
307
|
+
DAYS: ${{ vars.BRAVOS_THREAT_ISSUES_DAYS }}
|
|
308
|
+
run: |
|
|
309
|
+
model="$RUNNER_TEMP/bravos-issues-model.json"
|
|
310
|
+
ledger="$RUNNER_TEMP/bravos-issues-ledger.json"
|
|
311
|
+
blame="$RUNNER_TEMP/bravos-issues-blame.json"
|
|
312
|
+
if ! guardlink parse . > "$model" || ! jq -e '.exposures | arrays' "$model" > /dev/null; then
|
|
313
|
+
echo "::error::unknown: guardlink parse failed"
|
|
314
|
+
exit 1
|
|
315
|
+
fi
|
|
316
|
+
if ! guardlink hypothesis list --json > "$ledger" || ! jq -e '(.ledger == "present" or .ledger == "absent") and (.records | arrays)' "$ledger" > /dev/null; then
|
|
317
|
+
echo "::error::unknown: GuardLink hypothesis ledger unreadable"
|
|
318
|
+
exit 1
|
|
319
|
+
fi
|
|
320
|
+
if ! guardlink blame . --json > "$blame" || ! jq -e '.entries | arrays' "$blame" > /dev/null; then
|
|
321
|
+
echo "::error::unknown: guardlink blame failed"
|
|
322
|
+
exit 1
|
|
323
|
+
fi
|
|
324
|
+
node .bravos/hooks/lib/threat-issues.mjs "$model" "$ledger" "$blame"
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
# - BRAVOS_LICENCE as an Agents secret (Settings > Secrets and variables > Agents), so the paid
|
|
16
16
|
# skills run in Copilot's session. Copilot does not see ordinary Actions secrets.
|
|
17
17
|
# Assigning Copilot through the API is in public preview at GitHub and may change.
|
|
18
|
+
# Team view, off by default: set the repository variable BRAVOS_THREAT_ISSUES to on (Settings > Secrets and
|
|
19
|
+
# variables > Actions > Variables) and the threat-issues job opens one issue per critical or high threat still
|
|
20
|
+
# untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after it was committed. A confirmed threat keeps its issue,
|
|
21
|
+
# relabelled confirmed; it closes once the threat is refuted, fixed, accepted or removed. It needs no secret: the
|
|
22
|
+
# job's own token opens the issues.
|
|
18
23
|
name: bravos nightly (GitHub Copilot)
|
|
19
24
|
|
|
20
25
|
on:
|
|
@@ -93,3 +98,58 @@ jobs:
|
|
|
93
98
|
agent_assignment: {target_repo: $repo, base_branch: $base, custom_instructions: "", custom_agent: "", model: ""}}' \
|
|
94
99
|
| gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "repos/$REPO/issues" --input - \
|
|
95
100
|
| jq -r '"Assigned to Copilot: " + .html_url'
|
|
101
|
+
|
|
102
|
+
# The team view, off by default: with the repository variable BRAVOS_THREAT_ISSUES set to on, one issue per critical
|
|
103
|
+
# or high @exposes claim still untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after its annotation was committed,
|
|
104
|
+
# relabelled confirmed when a test confirms it, and closed by a later run once the claim is refuted, fixed, accepted
|
|
105
|
+
# or removed; a claim untested again or due a retest reopens the issue the nightly closed. It reads the default
|
|
106
|
+
# branch as merged with guardlink and writes issues with gh and this job's own token; no agent runs here, and annotation
|
|
107
|
+
# text reaches gh only as arguments and --body-file from hooks/lib/threat-issues.mjs, never as a shell line.
|
|
108
|
+
threat-issues:
|
|
109
|
+
if: vars.BRAVOS_THREAT_ISSUES == 'on' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
|
110
|
+
runs-on: ubuntu-latest
|
|
111
|
+
timeout-minutes: 15
|
|
112
|
+
permissions:
|
|
113
|
+
contents: read
|
|
114
|
+
issues: write
|
|
115
|
+
defaults:
|
|
116
|
+
run:
|
|
117
|
+
shell: bash
|
|
118
|
+
steps:
|
|
119
|
+
- uses: actions/checkout@v4
|
|
120
|
+
with:
|
|
121
|
+
# guardlink blame reads when each claim was committed from the full history.
|
|
122
|
+
fetch-depth: 0
|
|
123
|
+
persist-credentials: false
|
|
124
|
+
|
|
125
|
+
- uses: actions/setup-node@v4
|
|
126
|
+
with:
|
|
127
|
+
node-version: 22
|
|
128
|
+
|
|
129
|
+
- name: Install guardlink
|
|
130
|
+
run: bash .bravos/hooks/lib/nightly-tools.sh annotate
|
|
131
|
+
|
|
132
|
+
- name: Issues for untested threats
|
|
133
|
+
env:
|
|
134
|
+
GH_TOKEN: ${{ github.token }}
|
|
135
|
+
REPO: ${{ github.repository }}
|
|
136
|
+
SERVER: ${{ github.server_url }}
|
|
137
|
+
SHA: ${{ github.sha }}
|
|
138
|
+
DAYS: ${{ vars.BRAVOS_THREAT_ISSUES_DAYS }}
|
|
139
|
+
run: |
|
|
140
|
+
model="$RUNNER_TEMP/bravos-issues-model.json"
|
|
141
|
+
ledger="$RUNNER_TEMP/bravos-issues-ledger.json"
|
|
142
|
+
blame="$RUNNER_TEMP/bravos-issues-blame.json"
|
|
143
|
+
if ! guardlink parse . > "$model" || ! jq -e '.exposures | arrays' "$model" > /dev/null; then
|
|
144
|
+
echo "::error::unknown: guardlink parse failed"
|
|
145
|
+
exit 1
|
|
146
|
+
fi
|
|
147
|
+
if ! guardlink hypothesis list --json > "$ledger" || ! jq -e '(.ledger == "present" or .ledger == "absent") and (.records | arrays)' "$ledger" > /dev/null; then
|
|
148
|
+
echo "::error::unknown: GuardLink hypothesis ledger unreadable"
|
|
149
|
+
exit 1
|
|
150
|
+
fi
|
|
151
|
+
if ! guardlink blame . --json > "$blame" || ! jq -e '.entries | arrays' "$blame" > /dev/null; then
|
|
152
|
+
echo "::error::unknown: guardlink blame failed"
|
|
153
|
+
exit 1
|
|
154
|
+
fi
|
|
155
|
+
node .bravos/hooks/lib/threat-issues.mjs "$model" "$ledger" "$blame"
|