Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(brands): ignore HTML noscript icon declarations
asts-top194fa091d056
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 41b05ca3..6f469d67 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,7 +8,7 @@ All notable changes are documented here. Format loosely follows [Keep a Changelo### Fixed-- **Inactive brand icon declarations.** Capture ignores icon markup in comments, raw text, quoted attributes and templates, so inactive page edits cannot replace the selected image or break its pinned digest. Complete link attributes keep quoted delimiters and distinguish `href` from `data-href`.+- **Inactive brand icon declarations.** Capture ignores icon markup in comments, raw text (including `noscript` for `text/html`), quoted attributes and templates, so inactive page edits cannot replace the selected image or break its pinned digest. Complete link attributes keep quoted delimiters and distinguish `href` from `data-href`; XHTML `noscript` discovery is unchanged.- **Brand ICO data bounds (#585).** Capture and pinned re-fetches reject empty, directory-overlapping or out-of-bounds image ranges in ICO directory entries, while preserving valid PNG/DIB payloads and normal icon fallback.### Changeddiff --git a/archify.zip b/archify.zipindex 6294a1d4..15e26149 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/references/brand-marks.md b/archify/references/brand-marks.mdindex 3e994c04..33d0665e 100644--- a/archify/references/brand-marks.md+++ b/archify/references/brand-marks.md@@ -61,6 +61,10 @@ head is not read for icon discovery.Icon candidates come from complete `link` tags outside comments, raw text andtemplate contents. Attribute values and lookalike names such as `data-href`cannot supply icon declarations; quoted `>` characters stay within their tags.+For `text/html`, discovery treats `noscript` contents as raw text, matching+scripting-enabled HTML parsing; capture does not execute scripts. This exclusion+does not apply to `application/xhtml+xml`, where `noscript` links remain+discoverable.Unknown URL capture accepts only bounded raster image formats, blockscredentials, nonstandard public ports, and private or link-local destinations,uses bounded concurrency and one total deadline, and returns the captureddiff --git a/archify/renderers/shared/brand-marks.mjs b/archify/renderers/shared/brand-marks.mjsindex 3a38d0af..26771b6e 100644--- a/archify/renderers/shared/brand-marks.mjs+++ b/archify/renderers/shared/brand-marks.mjs@@ -280,7 +280,7 @@ async function readLimited(response, maximum) {// bytes once so many tiny chunks cannot cause repeated concatenation/rescanning.// Collect link tags in the same pass: markup in comments, raw text, attributes// or templates must not become an icon candidate or an early head ending.-async function readHtmlHeadLinks(response, maximum) {+async function readHtmlHeadLinks(response, maximum, htmlScriptingEnabled) {const chunks = response.body && typeof response.body[Symbol.asyncIterator] === 'function'? response.body : [await readLimited(response, maximum)];const buffer = Buffer.alloc(maximum);@@ -344,7 +344,8 @@ async function readHtmlHeadLinks(response, maximum) {if (/^<template(?=[\t\n\f\r />])/i.test(tag)) templateDepth += 1;else if (/^<\/template(?=[\t\n\f\r />])/i.test(tag)) templateDepth = Math.max(0, templateDepth - 1);else if (!templateDepth && /^<link(?=[\t\n\f\r />])/i.test(tag)) links.push(tag);- const raw = /^<(script|style|title|textarea|xmp|iframe|noembed|noframes)(?=[\t\n\f\r />])/i.exec(tag);+ const raw = /^<(script|style|title|textarea|xmp|iframe|noembed|noframes)(?=[\t\n\f\r />])/i.exec(tag)+ || (htmlScriptingEnabled && /^<(noscript)(?=[\t\n\f\r />])/i.exec(tag));if (raw) rawClosing = `</${raw[1].toLowerCase()}`;tagStart = -1;}@@ -505,7 +506,9 @@ async function captureRemoteBrand(value, deadline = Date.now() + captureTimeoutMpage.response.body?.destroy?.();return fallback('linked page is not HTML');}- const links = await readHtmlHeadLinks(page.response, MAX_HTML_BYTES);+ // Match scripting-enabled HTML parsing for noscript without executing scripts.+ const htmlScriptingEnabled = pageType.split(';')[0].trim() === 'text/html';+ const links = await readHtmlHeadLinks(page.response, MAX_HTML_BYTES, htmlScriptingEnabled);const iconErrors = [];for (const candidate of iconCandidates(links, page.finalUrl)) {try {diff --git a/archify/test/brand-icon-contexts.test.mjs b/archify/test/brand-icon-contexts.test.mjsindex 8a1e84e1..01ef8f72 100644--- a/archify/test/brand-icon-contexts.test.mjs+++ b/archify/test/brand-icon-contexts.test.mjs@@ -14,8 +14,10 @@ const cli = path.join(skillRoot, 'bin/archify.mjs');const icon = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGNgYPj/HwADAgH/5ncLrgAAAABJRU5ErkJggg==', 'base64');const inactiveIcon = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg==', 'base64');const digest = createHash('sha256').update(icon).digest('hex');+const inactiveDigest = createHash('sha256').update(inactiveIcon).digest('hex');const activeLink = '<link rel="icon" href="/active.png">';const inactiveLink = '<link rel="icon" href="/inactive.png">';+const noscriptLink = '<noscript><link rel="apple-touch-icon" href="/inactive.png" sizes="512x512" /></noscript>';function run(args) {return new Promise((resolve, reject) => {@@ -34,12 +36,12 @@ function run(args) {});}-async function fixture(t, markup, { byteChunks = false } = {}) {+async function fixture(t, markup, { byteChunks = false, contentType = 'text/html; charset=utf-8' } = {}) {const data = { markup, requests: [] };const server = http.createServer(async (request, response) => {data.requests.push(request.url);if (request.url === '/studio') {- response.writeHead(200, { 'content-type': 'text/html; charset=utf-8' });+ response.writeHead(200, { 'content-type': contentType });const html = `<head>${data.markup}</head>`;if (byteChunks) {for (const byte of Buffer.from(html)) {@@ -74,13 +76,13 @@ async function fixture(t, markup, { byteChunks = false } = {}) {return data;}-async function capture(data, paths = ['/active.png']) {+async function capture(data, paths = ['/active.png'], expectedDigest = digest) {const result = await run(['brands', 'capture', data.url, '--json']);assert.equal(result.status, 0, result.stderr || result.stdout);const receipt = JSON.parse(result.stdout);assert.deepEqual(data.requests, ['/studio', ...paths]);assert.equal(receipt.ok, true);- assert.deepEqual(receipt.brand, { url: data.url, sha256: digest });+ assert.deepEqual(receipt.brand, { url: data.url, sha256: expectedDigest });assert.equal(receipt.evidence.status, 'captured');return receipt.brand;}@@ -95,6 +97,7 @@ for (const [name, prefix] of [['nested template', `<template><template>${inactiveLink}</template>${inactiveLink}</template>`],['template with literal closing tags', `<template><script>const end = '</template></head>';</script>${inactiveLink}</template>`],['raw closing-tag prefix', `<script>"</scripture>${inactiveLink}";</script>`],+ ['noscript closing-tag prefix', `<noscript></noscripture>${inactiveLink}</noscript>`],['self-closing script flag', `<script/>"${inactiveLink}";</script>`],['lookalike tag name', '<link-preview rel="icon" href="/inactive.png"></link-preview>'],['lookalike rel attribute', '<link data-rel="icon" href="/inactive.png">'],@@ -104,6 +107,20 @@ for (const [name, prefix] of [});}+for (const contentType of ['text/html', 'Text/Html; charset=utf-8']) {+ test(`capture ignores a higher-ranked noscript icon for ${contentType}`, async (t) => {+ const markup = noscriptLink + '<link rel="icon" href="/active.png" />';+ await capture(await fixture(t, markup, { contentType }));+ });+}++for (const contentType of ['application/xhtml+xml', 'Application/XHTML+XML; charset=utf-8; profile="text/html"']) {+ test(`capture preserves noscript icon discovery for ${contentType}`, async (t) => {+ const markup = noscriptLink + '<link rel="icon" href="/active.png" />';+ await capture(await fixture(t, markup, { contentType }), ['/inactive.png'], inactiveDigest);+ });+}+for (const [name, markup] of [['ordinary icon', activeLink],['quoted greater-than', '<link title="size > zero" rel="icon" href="/active.png">'],@@ -133,6 +150,7 @@ test('active declarations retain the five-candidate limit and favicon fallback',for (const [name, markup] of [['unclosed comment', `<!-- ${inactiveLink}`],['unclosed script', `<script>const example = '${inactiveLink}';`],+ ['unclosed noscript', `<noscript>${inactiveLink}`],['unclosed template', `<template>${inactiveLink}`],]) {test(`capture uses the favicon fallback for an ${name}`, async (t) => {@@ -143,6 +161,7 @@ for (const [name, markup] of [for (const [name, prefix] of [['comment', `<!-- ${inactiveLink} </head> -->`],['script', `<ScRiPt data-note=">">'${inactiveLink}'</sCrIpT \n>`],+ ['noscript', `<NoScRiPt>${inactiveLink}</head></nOsCrIpT>`],['template', `<template>${inactiveLink}</template>`],]) {test(`link attributes and ${name} context survive one-byte response chunks`, { timeout: 20000 }, async (t) => {@@ -171,7 +190,7 @@ for (const [type, example, collection] of [const output = path.join(temporary, 'diagram.html');fs.writeFileSync(input, JSON.stringify(diagram));let original;- for (const prefix of ['', `<!-- ${inactiveLink} --><script>const sample = '${inactiveLink}';</script>`]) {+ for (const prefix of ['', `<!-- ${inactiveLink} --><script>const sample = '${inactiveLink}';</script>${noscriptLink}`]) {data.markup = prefix + activeLink;for (const command of ['validate', 'render']) {data.requests.length = 0;