Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.
JavaScript agent-skillsai-agentsai-seoclaudeclaude-codeclaude-code-pluginclaude-skillscodexcontent-marketingconversion-rate-optimizationcopywritingcursoremail-marketinggenerative-engine-optimizationgrowth-marketingmarketingmarketing-automationsaas-marketingseoskill-md
fix(ad-creative): prevent normalized remote image requests
Rudy Celekli7433769833a3
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex ea384a9..a6f60db 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -6,7 +6,7 @@},"metadata": {"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, and growth",- "version": "2.11.17",+ "version": "2.11.18","repository": "https://github.com/coreyhaines31/marketingskills"},"plugins": [diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex 83527da..d155ceb 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "marketing-skills","description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",- "version": "2.11.17",+ "version": "2.11.18","author": {"name": "Corey Haines"},diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.jsonindex 7f59e6e..5884655 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "marketing-skills","description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",- "version": "2.11.17",+ "version": "2.11.18","author": {"name": "Corey Haines"},diff --git a/.github/workflows/regression-tests.yml b/.github/workflows/regression-tests.ymlindex e1f5181..08f783b 100644--- a/.github/workflows/regression-tests.yml+++ b/.github/workflows/regression-tests.yml@@ -7,6 +7,7 @@ on:- "validate-skills.sh"- "tests/**"- "tools/clis/**"+ - "skills/ad-creative/assets/creative-review-template.html"- ".github/workflows/regression-tests.yml"pull_request:branches: [main]@@ -14,6 +15,7 @@ on:- "validate-skills.sh"- "tests/**"- "tools/clis/**"+ - "skills/ad-creative/assets/creative-review-template.html"- ".github/workflows/regression-tests.yml"concurrency:@@ -44,5 +46,5 @@ jobs:- name: Check CLI syntaxrun: for f in tools/clis/*.js; do node --check "$f"; done- - name: Run CLI contract tests- run: node --test tests/clis/*.test.cjs+ - name: Run CLI and asset contract tests+ run: node --test tests/clis/*.test.cjs tests/assets/*.test.cjsdiff --git a/VERSIONS.md b/VERSIONS.mdindex 404f2de..a2bc945 100644--- a/VERSIONS.md+++ b/VERSIONS.md@@ -5,7 +5,7 @@ Current versions of all skills. Agents can compare against local versions to che| Skill | Version | Last Updated ||-------|---------|--------------|| ab-testing | 2.0.0 | 2026-05-05 |-| ad-creative | 2.9.3 | 2026-10-02 |+| ad-creative | 2.9.4 | 2026-10-06 || ai-seo | 2.7.2 | 2026-10-02 || analytics | 2.0.2 | 2026-10-02 || aso | 2.0.1 | 2026-08-19 |@@ -57,6 +57,10 @@ Current versions of all skills. Agents can compare against local versions to che## Recent Changes+### 2.11.18 (2026-10-06)++- **ad-creative** (2.9.3 → 2.9.4): classify review images using browser URL semantics, block normalized remote/authority forms, retain portable local/data assets, and align the image instructions with the preview restriction.+### 2.11.17 (2026-10-02)- **video** (2.2.0 → 2.2.1) and the **Hyperframes integration guide** (reported in #600 by @pjthegiant): the old example called a `render({ frames })` API that the `hyperframes` package doesn't export. Both now lead with the CLI (`npx hyperframes init`, `preview`, `render -o output.mp4`) and explain the composition format: a root with `data-composition-id`, `class="clip"` elements with timing attributes, and a paused GSAP timeline. Rendering from code goes through `@hyperframes/producer` (`createRenderJob` + `executeRenderJob`). Checked against v0.8.114.diff --git a/skills/ad-creative/SKILL.md b/skills/ad-creative/SKILL.mdindex 350ed1e..db153bf 100644--- a/skills/ad-creative/SKILL.md+++ b/skills/ad-creative/SKILL.md@@ -2,7 +2,7 @@name: ad-creativedescription: "When the user wants to generate, iterate, or scale ad creative — headlines, descriptions, primary text, or full ad variations — for any paid advertising platform. Also use when the user mentions 'ad copy variations,' 'ad creative,' 'generate headlines,' 'RSA headlines,' 'bulk ad copy,' 'ad iterations,' 'creative testing,' 'write me some ads,' 'Facebook ad copy,' 'Google ad headlines,' 'LinkedIn ad text,' 'static ads,' 'ad templates,' 'iMessage ad,' 'chat reveal ad,' 'ChatGPT ad,' 'Apple Notes ad,' 'AirDrop ad,' 'creative strategy,' 'creative roadmap,' 'creative retro,' 'hook writing,' 'creative review page,' 'present ad creative for approval,' 'motion video ad,' 'faceless video ad,' 'UGC ad,' 'greenscreen ad,' 'TikTok/Reels ad format,' 'which ad format to make,' 'Meta ad format tier list,' or 'creative format taxonomy.' Use it to produce or iterate ad copy at scale. Copy avoids AI tells like 'it's not X, it's Y' reveals. For campaign strategy and targeting, see ads. For landing page copy, see copywriting."metadata:- version: 2.9.3+ version: 2.9.4---# Ad Creativediff --git a/skills/ad-creative/assets/creative-review-template.html b/skills/ad-creative/assets/creative-review-template.htmlindex 7866040..a274977 100644--- a/skills/ad-creative/assets/creative-review-template.html+++ b/skills/ad-creative/assets/creative-review-template.html@@ -16,7 +16,8 @@also HTML-escaped again at render time.DATA SHAPE — see references/creative-review-page.md for the annotated spec.- Images: each frame's "image" may be a URL, a relative path, or a data URI.+ Images: each frame's "image" may be a local path/file URL or a data URI.+ Remote and protocol-relative URLs are blocked; package images with the page.If omitted (or the file is missing), a placeholder shows the frame label +the image prompt — use this for concepts not yet rendered to image.-->@@ -322,11 +323,27 @@ function renderToggles() {document.getElementById("preview-label").textContent = (hs.length > 1 ? "Whitelisted ad · " : "") + "In-feed preview";}+// Classify with the browser URL parser; tabs/newlines and backslashes can hide a remote URL.+function localImageSource(value) {+ if (typeof value !== "string") return "";+ const syntax = value.replace(/[\t\n\r]/g, "").replace(/\\/g, "/")+ .replace(/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g, "");+ if (/^\/\//.test(syntax)) return "";+ try {+ const base = new URL(document.baseURI);+ const image = new URL(value, base);+ if (image.protocol === "data:" || (image.protocol === "file:" && !image.host)) return value;+ // Hosted relative assets stay on the review page's origin; absolute network URLs stay blocked.+ if (!/^[a-z][a-z0-9+.-]*:/i.test(syntax) && image.origin === base.origin) return value;+ } catch (_) { /* An invalid source falls back to the placeholder. */ }+ return "";+}+// placeholder underneath + image on top; a missing/broken image removes itself → placeholder showsfunction frameVisual(f, phCls) {const ph = `<div class="${phCls}"><div class="plabel">${esc(f.label)}</div><div class="pprompt">${esc(f.prompt || "")}</div></div>`;// Only local/relative or data: image sources — block remote URLs so the page stays offline and cannot beacon on open.- const localImg = (typeof f.image === "string" && !/^\s*(https?:|\/\/)/i.test(f.image)) ? f.image : "";+ const localImg = localImageSource(f.image);const img = localImg ? `<img src="${esc(localImg)}" alt="${esc(f.label)}" onerror="this.remove()" />` : "";return ph + img;}diff --git a/skills/ad-creative/references/creative-review-page.md b/skills/ad-creative/references/creative-review-page.mdindex 6b8b2f8..5b604fc 100644--- a/skills/ad-creative/references/creative-review-page.md+++ b/skills/ad-creative/references/creative-review-page.md@@ -39,7 +39,7 @@ The template renders entirely from a JSON block near the top of the file — `<s{label: "Hook", // the frame's job in the narrative arcprompt: "Product bag hero on soft pink, gold-lace overlay", // image description (shown as placeholder if no image)- image: "images/heavy-metal-01.png", // optional — URL, relative path, or data URI; omit for text-only concepts+ image: "images/heavy-metal-01.png", // optional — local path/file URL or data URI; omit for text-only conceptsheadline: "Finally, a plant-based protein that's third-party tested for heavy metals.", // optional per-frame overlayheadlineTheme: "dark" // optional: "dark" (default, white text) or "light" (dark text on light imagery)}@@ -71,9 +71,11 @@ A concept's `frames` are its storyboard. Label each frame by the *job it does*,### Images vs. placeholdersEvery frame renders one of two ways:-- **`image` provided** — the real creative (from the Mode 3 `images/` folder, a hosted URL, or a data URI) fills the frame.+- **`image` provided** — the real creative (from the Mode 3 `images/` folder or a data URI) fills the frame.- **`image` omitted** — a styled placeholder shows the frame `label` + `prompt`. This is the intended state for concepts that are copy + image-prompt but not yet rendered to image — the review page is useful *before* images exist, and stays useful as they get filled in.+Remote and protocol-relative image URLs are blocked, including URL spellings the browser normalizes. Download authorized creative assets into the local `images/` folder and keep paths relative when hosting or sharing; hosted relative assets still load from that host. This restriction applies to the supplied image sources, not a sandbox for arbitrary edits to the HTML or an assurance about a hosting server.+Ship review pages with placeholders freely; they communicate the concept. Swap in images as they're generated.## Grounding — the disclosure block is requireddiff --git a/tests/assets/creative-review-images.test.cjs b/tests/assets/creative-review-images.test.cjsnew file mode 100644index 0000000..8a4e9ff--- /dev/null+++ b/tests/assets/creative-review-images.test.cjs@@ -0,0 +1,39 @@+const { test } = require('node:test');+const assert = require('node:assert/strict');+const fs = require('node:fs');+const path = require('node:path');+const vm = require('node:vm');++const html = fs.readFileSync(path.resolve(__dirname, '../../skills/ad-creative/assets/creative-review-template.html'), 'utf8');+const classifier = html.match(/^function localImageSource\(value\) \{[\s\S]*?^\}/m)?.[0];+assert.ok(classifier, 'The shipped template must expose the supplied-image classifier');+function classify(value, baseURI = 'https://review.example/client/index.html') {+ const context = { URL, document: { baseURI } };+ vm.createContext(context);+ vm.runInContext(classifier, context);+ return context.localImageSource(value);+}++for (const value of [+ 'https://remote.example/pixel.png', '//remote.example/pixel.png',+ 'ht\ttps://remote.example/pixel.png', 'ht\ntps://remote.example/pixel.png',+ '\\\\remote.example/pixel.png', '/\\remote.example/pixel.png',+ '\u0000 https://remote.example/pixel.png', 'https://review.example/local.png',+ 'file://remote.example/share/pixel.png', 'javascript:alert(1)',+]) {+ test(`blocks remote or unsupported image source ${JSON.stringify(value)}`, () => {+ assert.equal(classify(value), '');+ });+}+for (const value of ['images/creative.png', '../images/creative.png', '/images/creative.png', 'data:image/png;base64,AA==']) {+ test(`keeps supplied local/data image ${JSON.stringify(value)}`, () => {+ assert.equal(classify(value), value);+ });+}+test('keeps packaged file assets in a local review page', () => {+ assert.equal(classify('images/creative.png', 'file:///tmp/review/index.html'), 'images/creative.png');+ assert.equal(classify('file:///tmp/review/creative.png'), 'file:///tmp/review/creative.png');+});+test('missing, non-string and invalid sources fall back to placeholders', () => {+ for (const value of [undefined, null, 42, '', '//[invalid']) assert.equal(classify(value), '');+});