Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(digest): a secret redacts its whole entry and PEM body [A2,N26]
Corey Olson675d0e003201
diff --git a/src/digest.js b/src/digest.jsindex d7628947..5c32476c 100644--- a/src/digest.js+++ b/src/digest.js@@ -27,8 +27,11 @@ const REASONS = {};/**- * Board text as one safe Markdown line: any line that matches Pullboard's secret patterns is- * redacted before the text is shortened, so a cut can never expose part of a secret.+ * Board text as one safe Markdown line. Pullboard's secret patterns are checked on the whole+ * source text, on each of its lines and on the text as it would print, before anything is split+ * or shortened; any match redacts the whole entry. Why the whole entry: a multi-line secret such+ * as a private key block is recognised by its header, and redacting only that line would print+ * the body and footer that follow it.** @param {unknown} value* @param {number} limit UTF-8 bytes@@ -36,12 +39,11 @@ const REASONS = {* @returns {string}*/function line(value, limit, cut) {- const lines = String(value ?? '').split(/\r?\n/u)- .map((text) => (secretsIn([{ path: 'digest', line: 1, text }]).length ? '[redacted secret]' : text));- let text = lines.join('\n');- // A multi-line secret, such as a private key block, is caught on the joined text.- if (secretsIn([{ path: 'digest', line: 1, text }]).length) text = '[redacted secret]';- text = text.replace(/[\u0000-\u001f\u007f]/gu, ' ').replace(/\s+/gu, ' ').trim();+ const source = String(value ?? '');+ const printed = source.replace(/[\u0000-\u001f\u007f]/gu, ' ').replace(/\s+/gu, ' ').trim();+ const views = [source, printed, ...source.split(/\r?\n/u)];+ if (secretsIn(views.map((text) => ({ path: 'digest', line: 1, text }))).length) return '[redacted secret]';+ const text = printed;if (Buffer.byteLength(text) <= limit) return text;cut.count += 1;let kept = text.slice(0, limit);@@ -204,7 +206,7 @@ function render(db, { name, now, root, config }) {].join('\n');const left = [...sections.filter((entry) => entry.shown < entry.total).map((entry) => `- ${entry.title}: ${entry.shown} of ${entry.total} shown.`),- `- ${cut.count} long texts were cut short, and lines that look like secrets read [redacted secret].`,+ `- ${cut.count} long texts were cut short, and any entry that looks like it holds a secret reads [redacted secret].`,`- ${elsewhere} milestone items from other boards were left out; this briefing covers this board only.`,'- Older history, finished work, code and full conversations stay on the board: pullboard show <number> prints any item.',].join('\n');diff --git a/test/digest.test.js b/test/digest.test.jsindex a776be95..7e56f378 100644--- a/test/digest.test.js+++ b/test/digest.test.js@@ -93,6 +93,12 @@ test('the digest is a readable briefing of one board [A2,N26]', (t) => {store.holdItem(box.board, held, { agentId: 'coordinator', reason: 'The person picks the prices first' });add(box.board, 'Secret in a bar', { criterion: `Use token ${planted} for the demo` });store.appendFact(box.board, first, { agentId: 'coordinator', kind: 'decision', text: 'One upload path, because two paths drift apart' });+ // A synthetic PEM-shaped block, built here: its header is what the secret patterns recognise.+ const pemHeader = '-----BEGIN ' + 'PRIVATE KEY-----';+ const pemBody = 'U3ludGhldGljRGlnZXN0' + 'Qm9keU9ubHlGb3JUZXN0';+ const pemFooter = '-----END ' + 'PRIVATE KEY-----';+ store.appendFact(box.board, first, { agentId: 'coordinator', kind: 'root-cause',+ text: `The demo leaked this key:\n${pemHeader}\n${pemBody}\n${pemBody}\n${pemFooter}\nRotate it.` });const ask = store.shout(box.board, { from: 'web-1', to: 'coordinator', text: 'May the cache be the source of truth?', lanes: ['web'], decision: true });store.answerDecision(box.board, ask, { agentId: 'coordinator', text: 'No, because the cache must stay disposable', lanes: ['web'] });store.shout(box.board, { from: 'coordinator', to: 'person', text: 'Should a newcomer see the tour first?', lanes: ['web'], decision: true });@@ -133,6 +139,10 @@ test('the digest is a readable briefing of one board [A2,N26]', (t) => {assert.equal(markdown.includes(planted), false, 'a secret never reaches the briefing');assert.equal(markdown.includes('ghp_'), false, 'no part of the secret survives');+ for (const part of [pemHeader, pemBody, pemFooter, 'PRIVATE KEY', 'Rotate it']) {+ assert.equal(markdown.includes(part), false, `no part of a multi-line secret block prints: ${part}`);+ }+ assert.match(decisions, /A root-cause on Upload page \(#1\) by coordinator.*\n {2}\[redacted secret\]\n/u, 'the whole entry is redacted');assert.match(sectionOf(markdown, 'Open work'), /Secret in a bar \(#5\).*\n {2}Done when: \[redacted secret\]/u);assert.match(shouts, /web-1, .*: \[redacted secret\]/u);for (const foreign of ['Other private project', 'Other board private item', 'Other board shout', other.repo]) {