GeezerVison is showing github.com — commitwork 0.6.293 · Portll/commitwork@46aa235
File treeExpand file treeCollapse file tree Open diff view settings fixtures/wp-witness/cw-witness-fixture
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md +4-5Lines changed: 4 additions & 5 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # Contributing | 2 | 2 |
| 3 | | -<!-- verified-against: 2026-10-07 --> | | 3 | +<!-- verified-against: 2026-11-15 --> | 4 | 4 |
| 5 | 5 | commitwork is a repository security scanner, local CI runner and scheduled monitoring system with | 6 | 6 | remediation and compliance-evidence tooling. This document covers the contributor licence agreement, | @@ -66,10 +66,9 @@ node bin/docs-doctor.mjs # documentation freshness gate | 66 | 66 |
| 67 | 67 | Two things to know before you read a failure: | 68 | 68 |
| 69 | | -- **The suite has a known pre-existing failure baseline, and it is larger on Windows.** A red test | 70 | | - is not automatically yours. Establish that the way we do: stash nothing — re-run the same globs | 71 | | - against an unmodified checkout and compare. `CLAUDE.md` carries the current measured figures and | 72 | | - the warning that they age quickly. | | 69 | +- **The suite has known pre-existing failures.** A red test is not automatically yours. Establish | | 70 | + that the way we do: stash nothing — re-run the same globs against an unmodified checkout and | | 71 | + compare. `CLAUDE.md` records the last measured figures and the warning that they age quickly. | 73 | 72 | - **Every input path is overridable through a `CW_*` environment variable** so the suite runs | 74 | 73 | entirely on fixtures in `fixtures/`. A test must never need the private records, a credential or | 75 | 74 | a network call. If you cannot test your change without one, that is a finding about the change. | |
Collapse file Copy file name to clipboardExpand all lines: CLAUDE.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -<!-- verified-against: 2026-10-11 --> | | 1 | +<!-- verified-against: 2026-11-15 --> | 2 | 2 | # CLAUDE.md — working in this repository | 3 | 3 |
| 4 | 4 | commitwork runs a repository's GitHub Actions CI locally and scans it for security defects with a | |
Collapse file Copy file name to clipboardExpand all lines: README.md +79-52Lines changed: 79 additions & 52 deletions - Display the source diff
- Display the rich diff
Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: admin/README.md +9-7Lines changed: 9 additions & 7 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -<!-- verified-against: 2026-10-20 --> | | 1 | +<!-- verified-against: 2026-11-15 --> | 2 | 2 | # admin/ — the :7878 panel | 3 | 3 |
| 4 | 4 | Zero-dependency local web panel over the monitor's evidence (`node:http` + siblings only). | @@ -49,8 +49,9 @@ section rail, view selector, account forms, navigation behavior and inline style | 49 | 49 | source files. `lib/panel-document.mjs` composes the response from a fixed list of these files; | 50 | 50 | inline stylesheet blocks receive matching CSP hashes. | 51 | 51 |
| 52 | | -The client code lives in `static/panel-*.js`: eight classic scripts (`panel-core`, `panel-console`, | 53 | | -`panel-posture`, `panel-views`, `panel-router`, `panel-features`, `panel-settings`, `panel-boot`), | | 52 | +The client code lives in `static/panel-*.js`: fourteen classic scripts (`panel-core`, `panel-console`, | | 53 | +`panel-posture`, `panel-views`, `panel-router`, `panel-features`, `panel-settings`, `panel-palette`, | | 54 | +`panel-feed`, `panel-inbox`, `panel-journey`, `panel-correlations`, `panel-graph`, `panel-boot`), | 54 | 55 | loaded in the order `panel.html` lists them, after the extracted view modules (`learning.js`, | 55 | 56 | `comments.js`, `overwatch-layer.js`, `bola.js`, `perf-console.js`) and with `menus/navigation.js` | 56 | 57 | and `menus/account-menu.js` inlined between them. They share one global scope, and a function | @@ -394,11 +395,12 @@ the CSRF and login gates, static assets, the `/auth/*` hand-off and the map, rep | 394 | 395 | ## Experimental feature flags | 395 | 396 |
| 396 | 397 | Each ring-outward group in `manifests/feature-charter.json` carries `"experimental": true` and a | 397 | | -`flag` id declared in `experimentalFlags` (16 group flags today: `docsite`, `offbox`, `agents`, `launchlist`, | | 398 | +`flag` id declared in `experimentalFlags` (21 group flags today: `docsite`, `offbox`, `agents`, `launchlist`, | 398 | 399 | `memory-view`, `lanes-quality`, `lanes-lint`, `lanes-types`, `codegraph-mcp`, `turns-mcp`, | 399 | | -`scan-images`, `sitemap`, `map`, `flow`, `chunk-diff`, `commitwork-web`). `experimentalFlags` also | 400 | | -declares `feed`, `palette` and `journey`, which have no group and are gated in their routes with | 401 | | -`gateFeature`. Every flag is **on** until switched off, so nothing changes until the operator acts. | | 400 | +`scan-images`, `npm-updates`, `sitemap`, `map`, `flow`, `chunk-diff`, `commitwork-web`, `feed`, | | 401 | +`inbox`, `journey`, `palette`). `experimentalFlags` also declares `pull-request`, which has no | | 402 | +group and is gated in its route with `gateFeature`. Every flag is **on** until switched off, so | | 403 | +nothing changes until the operator acts. | 402 | 404 |
| 403 | 405 | - **Switch one:** Settings → Experimental features, or `POST /api/features {"flag":"docsite","on":false}` | 404 | 406 | (operator port or a signed-in session; stamped with who, written atomically to the | |
Collapse file Copy file name to clipboardExpand all lines: admin/routes/panel-state.mjs +8-5Lines changed: 8 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -109,17 +109,20 @@ export const routes = [ | 109 | 109 | // back to the fleet is how the original defect reads to anyone who does not check. | 110 | 110 | const scopeProject = new URL(req.url, 'http://127.0.0.1').searchParams.get('project') || ''; | 111 | 111 | const scopeArea = scopeProject ? (projectSlug(scopeProject) || String(scopeProject)) : null; | 112 | | - const inScope = (r) => !scopeArea || r.area === scopeArea; | | 112 | + // Unmapped rows (no area declares their hostname) stay in EVERY view: something routed through | | 113 | + // the tunnel that nothing declares is a security signal, and hiding it under a project scope | | 114 | + // would manufacture a clean result. Only other areas' rows are excluded. | | 115 | + const inScope = (r) => !scopeArea || !r.area || r.area === scopeArea; | 113 | 116 | const scopedRows = rows.filter(inScope); | 114 | | - // What the scope is HIDING, so a narrowed view can never read as a complete one. Undeclared | 115 | | - // hostnames are called out separately: they belong to no project, so no project scope will | 116 | | - // ever show them, and they are exactly the rows most worth noticing. | | 117 | + // What the scope is HIDING, so a narrowed view can never read as a complete one. Unmapped | | 118 | + // hostnames are never hidden; they are reported as SHOWN instead. They are declared by no | | 119 | + // project, which is exactly why they appear in every project view and are worth noticing. | 117 | 120 | const hidden = rows.filter((r) => !inScope(r)); | 118 | 121 | const scopeInfo = { | 119 | 122 | project: scopeProject || null, | 120 | 123 | area: scopeArea, | 121 | 124 | hidden: hidden.length, | 122 | | - hiddenUndeclared: hidden.filter((r) => !r.area).length, | | 125 | + shownUndeclared: scopeArea ? scopedRows.filter((r) => !r.area).length : 0, | 123 | 126 | hiddenDrifted: hidden.filter((r) => r.state !== 'ok' && r.state !== 'withheld (correct)').length, | 124 | 127 | }; | 125 | 128 |
| |
Collapse file Copy file name to clipboardExpand all lines: admin/routes/remediation.mjs +34-11Lines changed: 34 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 |
| 3 | 3 | import { spawn } from 'node:child_process'; | 4 | 4 | import { splitThinking } from '../../lib/llm-reply.mjs'; | 5 | | -import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync } from 'node:fs'; | | 5 | +import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync, statSync } from 'node:fs'; | 6 | 6 | import { join, resolve, isAbsolute, basename } from 'node:path'; | 7 | 7 | import { projectSlug } from '../../monitor/project-scope.mjs'; | 8 | 8 | import { SCANNER_CHECKS, canonicalCheck, checkForScanner } from '../../monitor/scanner-checks.mjs'; | @@ -338,7 +338,7 @@ export async function llmTargets() { | 338 | 338 |
| 339 | 339 |
| 340 | 340 | // what the prompt needs to act on: repo, artifact, counts — all resolved server-side | 341 | | -function handoffContext(scope, entry) { | | 341 | +export function handoffContext(scope, entry) { | 342 | 342 | // The read state rides along, so a torn rollup never reaches the agent as "Live counts: none", the | 343 | 343 | // same words as a check with no aggregate; an agent told "none" reasons from zero. | 344 | 344 | const read = readJSONState(join(scope.dir, 'rollup.json')); | @@ -347,20 +347,25 @@ function handoffContext(scope, entry) { | 347 | 347 | const live = (category && rollup.scanners && rollup.scanners[category]) || null; | 348 | 348 | const batch = batchDirOf(rollup.source, reportsRootOf(registry())); | 349 | 349 | const repos = (Array.isArray(rollup.repos) ? rollup.repos : []).filter((r) => r && typeof r.name === 'string'); | 350 | | - let artifact = null, repoName = null; | | 350 | + let artifact = null, repoName = null, artifactMtime = null, artifactAgeError = null; | 351 | 351 | if (batch && entry.report) { | 352 | 352 | const withFindings = category ? repos.filter((r) => r.scanners && r.scanners[category] && r.scanners[category].total > 0) : []; | 353 | 353 | for (const r of [...withFindings, ...repos]) { | 354 | 354 | const p = join(batch, r.name, entry.report); | 355 | | - if (existsSync(p)) { artifact = p; repoName = r.name; break; } | | 355 | + if (existsSync(p)) { | | 356 | + artifact = p; repoName = r.name; | | 357 | + try { artifactMtime = statSync(p).mtimeMs; } | | 358 | + catch (e) { if (e.code !== 'ENOENT') artifactAgeError = e.code || 'UNKNOWN'; } | | 359 | + break; | | 360 | + } | 356 | 361 | } | 357 | 362 | } | 358 | 363 | const known = resolvedRepos(); | 359 | 364 | const pathOf = (name) => { const x = known.find((y) => y.name === name); return x && x.path && existsSync(x.path) ? x.path : null; }; | 360 | 365 | let repoPath = repoName ? pathOf(repoName) : null; | 361 | 366 | // No artifact names a repo: open in THIS project's first resolvable repo, not in commitwork's checkout. | 362 | 367 | if (!repoName) for (const r of repos) { const p = pathOf(r.name); if (p) { repoPath = p; break; } } | 363 | | - return { category, live, artifact, repoName, repoPath, generated: rollup.generated || null, | | 368 | + return { category, live, artifact, repoName, artifactMtime, artifactAgeError, repoPath, generated: rollup.generated || null, | 364 | 369 | rollup: { state: read.state, why: read.state === 'ok' ? null : (read.why || null) } }; | 365 | 370 | } | 366 | 371 |
| @@ -396,12 +401,30 @@ function handoffIssuesSection(entry, project) { | 396 | 401 | } catch { return ['<!-- issue store unavailable -->']; } | 397 | 402 | } | 398 | 403 |
| 399 | | -function composeHandoff(entry, ctx, project) { | | 404 | +const DAY_MS = 86_400_000; | | 405 | +const STALE_ARTIFACT_WARNING = 'STALE ARTIFACT: re-run the check before triaging; findings below may not describe the current tree.'; | | 406 | + | | 407 | +function handoffArtifactLines(ctx, nowMs) { | | 408 | + if (!ctx.artifact) { | | 409 | + return ['Scanner artifact: NOT FOUND on disk for this check — say so in your triage rather than inventing findings.']; | | 410 | + } | | 411 | + const head = `Scanner artifact: ${ctx.artifact} (repo: ${ctx.repoName})`; | | 412 | + if (ctx.artifactMtime == null) { | | 413 | + return [`${head}, age UNKNOWN (${ctx.artifactAgeError || 'mtime unreadable'}) - read it before concluding anything.`, | | 414 | + STALE_ARTIFACT_WARNING]; | | 415 | + } | | 416 | + const days = Math.max(0, Math.floor((nowMs - ctx.artifactMtime) / DAY_MS)); | | 417 | + const line = `${head}, written ${new Date(ctx.artifactMtime).toISOString()}, ` | | 418 | + + `${days} ${days === 1 ? 'day' : 'days'} before this handoff - read it before concluding anything.`; | | 419 | + return days >= 7 ? [line, STALE_ARTIFACT_WARNING] : [line]; | | 420 | +} | | 421 | + | | 422 | +export function composeHandoff(entry, ctx, project, now) { | | 423 | + const nowMs = now instanceof Date ? now.getTime() : Number(now); | 400 | 424 | return [`# commitwork triage handoff — ${entry.check}${project ? ` · ${project}` : ''}`, | 401 | | - `Generated ${new Date().toISOString()} from the rollup of ${ctx.generated || 'an unknown time'}.`, | | 425 | + `Generated ${new Date(nowMs).toISOString()} from the rollup of ${ctx.generated || 'an unknown time'}.`, | 402 | 426 | liveCountsLine(ctx), | 403 | | - ctx.artifact ? `Scanner artifact: ${ctx.artifact} (repo: ${ctx.repoName}) — read it before concluding anything.` | 404 | | - : 'Scanner artifact: NOT FOUND on disk for this check — say so in your triage rather than inventing findings.', | | 427 | + ...handoffArtifactLines(ctx, nowMs), | 405 | 428 | ctx.repoPath ? `Repository: ${ctx.repoPath}` : 'Repository: NOT RESOLVED on this box — no repository in this project\'s rollup has a path here; locate the code before concluding anything.', | 406 | 429 | '', entry.prompt, '', | 407 | 430 | ...(entry.formatNotes ? [entry.formatNotes, ''] : []), | @@ -488,7 +511,7 @@ async function launchClaude(scope, entry, ctx) { | 488 | 511 | const dir = join(scope.dir, 'handoff'); | 489 | 512 | mkdirSync(dir, { recursive: true }); | 490 | 513 | const file = join(dir, `${entry.check}-${Date.now()}.md`); | 491 | | - const prompt = composeHandoff(entry, ctx, scope.project); | | 514 | + const prompt = composeHandoff(entry, ctx, scope.project, Date.now()); | 492 | 515 | writeFileSync(file, prompt); | 493 | 516 | return launchClaudeSession({ file, cwd: ctx.repoPath || CW, prompt }); | 494 | 517 | } | @@ -563,7 +586,7 @@ async function runLocalModel(engine, model, entry, ctx, scope) { | 563 | 586 | const engineSlug = String(engine).replace(/[^a-z0-9]+/gi, '-'); | 564 | 587 | const file = join(dir, `${entry.check}-${engineSlug}-${stamp}.md`); | 565 | 588 | writeFileSync(file, `# local triage — ${entry.check} · ${engine}:${model}\n\n` | 566 | | - + composeHandoff(entry, ctx, project) | | 589 | + + composeHandoff(entry, ctx, project, Date.now()) | 567 | 590 | + (thinking ? '\n---\n\n## Model thinking\n\n' + thinking + '\n' : '') | 568 | 591 | + '\n---\n\n## Model reply\n\n' + reply + '\n' | 569 | 592 | + (verdictSalvaged ? '\n---\n\n> **Verdict SALVAGED from the reasoning channel** — the model emitted no content; the JSON was recovered from its thinking tail.\n' : '') | |
Collapse file Copy file name to clipboardExpand all lines: admin/static/panel-features.js +13-9Lines changed: 13 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1251,15 +1251,19 @@ async function loadExposure(){ | 1251 | 1251 | const sc=d.scope||{}; | 1252 | 1252 | n.textContent=`${(d.rows||[]).length} hostname(s) · ${t.drifted??0} drifted` | 1253 | 1253 | +(sc.area?` · ${sc.area}`:' · every hostname on this box'); | 1254 | | - // A NARROWED VIEW MUST NEVER READ AS A COMPLETE ONE. What the scope removed is stated, with the | 1255 | | - // two categories worth acting on called out: hostnames no project declares (which no project | 1256 | | - // scope will ever show) and hostnames whose applied routing disagrees with the registry. | 1257 | | - const hiddenNote = sc.hidden | 1258 | | - ? `<div class="mut gap-top">${sc.hidden} hostname(s) on this box are <b>not shown</b> — scoped to ` | 1259 | | - + `${esc(sc.project||sc.area||'this project')}.` | 1260 | | - + (sc.hiddenUndeclared?` ${sc.hiddenUndeclared} of them are <b class="txt-part">declared by no project</b>, so no project view will show them.`:'') | 1261 | | - + (sc.hiddenDrifted?` ${sc.hiddenDrifted} are <b class="txt-crit">drifted</b>.`:'') | 1262 | | - + ` Tick <b>show all hostnames on this box</b> above to see them.</div>` | | 1254 | + // A NARROWED VIEW MUST NEVER READ AS A COMPLETE ONE. What the scope removed is stated, together | | 1255 | + // with the hostnames no project declares: those are never hidden, they appear in every project | | 1256 | + // view, and they are exactly the rows most worth noticing. Drifted hostnames among the hidden | | 1257 | + // ones are counted too. | | 1258 | + const scopeSentences = []; | | 1259 | + if (sc.hidden) scopeSentences.push(`${sc.hidden} hostname(s) on this box are <b>not shown</b> — scoped to ` | | 1260 | + + `${esc(sc.project||sc.area||'this project')}.` | | 1261 | + + (sc.hiddenDrifted?` ${sc.hiddenDrifted} are <b class="txt-crit">drifted</b>.`:'') | | 1262 | + + ` Tick <b>show all hostnames on this box</b> above to see them.`); | | 1263 | + if (sc.area && sc.shownUndeclared) scopeSentences.push(`${sc.shownUndeclared} hostname(s) shown are ` | | 1264 | + + `<b class="txt-part">declared by no project</b> and appear in every project view.`); | | 1265 | + const hiddenNote = scopeSentences.length | | 1266 | + ? `<div class="mut gap-top">${scopeSentences.join(' ')}</div>` | 1263 | 1267 | : ''; | 1264 | 1268 | dr.innerHTML+=hiddenNote; | 1265 | 1269 | ft.innerHTML=`tunnel config <code>${esc(d.configPath||'')}</code> · ${d.declaredCount} declared, ${d.routedCount} routed · probed ${esc(String(d.generated||'').slice(0,19))} · ` | |
Collapse file Copy file name to clipboardExpand all lines: admin/static/panel-posture.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -385,6 +385,7 @@ const SCANNER_LABEL={ | 385 | 385 | yaraWitness:'YARA witness · php-malware-finder and signature-base web-shell rules', | 386 | 386 | wpIntegrity:'WordPress integrity · core and plugins against wordpress.org checksums, files loose in plugins/', | 387 | 387 | wpAdvisories:'WordPress advisories · core, plugin and theme versions against published advisories', | | 388 | + wpAuthz:'WordPress access control · request entry points to the state they write, and the guards on the way', | 388 | 389 | logEvidence:'Log evidence · injection, traversal and shell probes recorded in the tree\'s logs', | 389 | 390 | treeIntegrity:'Tree integrity · git drift on a web root, installed-package RECORD hashes', | 390 | 391 | actionsGaps:'CI gaps · self-hosted runners, triggering-head checkouts, missing permissions', | |
Collapse file Copy file name to clipboardExpand all lines: admin/static/panel-views.js +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -255,12 +255,12 @@ async function loadPosture(){ | 255 | 255 | try{ const d=await (await fetch('/api/posture?project='+encodeURIComponent(curProj||''))).json(); renderPosture(d); renderDelivery(d); } | 256 | 256 | catch(e){ if(box)box.innerHTML='<div class="pk-err">could not load the posture board: '+esc(e.message)+'</div>'; const n=$('po-n'); if(n)n.textContent='—'; } | 257 | 257 | } | 258 | | -// Which tab already renders per-finding rows for a category. DECLARED, not derived: only these | 259 | | -// categories have a detail table to open, and guessing a tab name for the rest would produce a | 260 | | -// button that lands on an empty page — worse than no button, because an empty table reads as clean. | | 258 | +// Which tab renders per-finding rows for a category, read from SCANNER_TABS at render time: | | 259 | +// addDerivedLaneTabs appends lanes after load. A category with no entry there gets no button, | | 260 | +// because a button onto an empty table reads as clean. | 261 | 261 | // Kept on ONE line: admin/test/remediation-prompts.test.mjs lifts it out of this source by | 262 | | -// `startsWith('const RP_VIEW_TAB=')`, the same single-line technique the other render tests use. | 263 | | -const RP_VIEW_TAB={secrets:'secrets',maliciousPackages:'malware',supplyChainHeuristic:'supplychain',sastSemgrep:'sast',sastCodeql:'sast',sastCodeqlJava:'sast',sastGo:'sast',iac:'iac',dast:'dast',actionsPosture:'actions',minifiedCode:'minify'}; | | 262 | +// `startsWith('const rpViewTab=')`, the same single-line technique the other render tests use. | | 263 | +const rpViewTab=(cat)=>(SCANNER_TABS.find((t)=>t.key===cat)||{}).view||''; | 264 | 264 | // ONE classifier for a prompt's live counts, carried or not, and the same covState the coverage | 265 | 265 | // table uses: -1 no signal, 0 scanned clean, >0 findings (sev-ranked). A carried row that never ran | 266 | 266 | // goes through covState too, never to total 0, which would render a green clean for a lane nothing | @@ -307,7 +307,7 @@ function renderRemediationPrompts(d){ | 307 | 307 | // scanner tabs use (closed-set category -> check id, never a caller-supplied string), and the | 308 | 308 | // view link routes to the tab that already renders this category's per-finding detail. | 309 | 309 | +(p.category?recBtn({scanner:p.category,label:p.category})+' ':'') | 310 | | - +(RP_VIEW_TAB[p.category]?'<button type="button" class="rp-view" data-view="'+esc(RP_VIEW_TAB[p.category])+'" title="open the tab holding this category’s per-finding rows — file, line and rule as the rollup captured them">view findings ▸</button>':'') | | 310 | + +(rpViewTab(p.category)?'<button type="button" class="rp-view" data-view="'+esc(rpViewTab(p.category))+'" title="open the tab holding this category’s per-finding rows — file, line and rule as the rollup captured them">view findings ▸</button>':'') | 311 | 311 | +'<button type="button" class="rp-copy">copy prompt</button>' | 312 | 312 | +'<button type="button" class="rp-claude" data-check="'+esc(p.check)+'" title="open VS Code at the target repo and start a Claude Code session in Terminal with this handoff (prompt + artifact path + counts) already submitted">Claude Code ↗</button>' | 313 | 313 | +'<button type="button" class="rp-local" data-check="'+esc(p.check)+'" title="triage with a local model — any host declared in manifests/llm-hosts.json, fed this prompt plus the scanner artifact; the exchange is saved as evidence">local LLM ▸</button>' | |
|