Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

fix(dub): validate bulk link containers and batch limits

Rudy Celekli7dbd44c89bf7
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 39ddc4c..68a230d 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.26",
+ "version": "2.11.27",
"repository": "https://github.com/coreyhaines31/marketingskills"
},
"plugins": [
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index f1a5cf8..aabe26f 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.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 45d9d89..9cd1f4c 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.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/VERSIONS.md b/VERSIONS.md
index dc6d5ce..72d2c6c 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -57,6 +57,10 @@ Current versions of all skills. Agents can compare against local versions to che
## Recent Changes
+### 2.11.27 (2026-10-10)
+
+- Validate Dub bulk link arrays and enforce the documented 100-link limit before requests.
+
### 2.11.26 (2026-10-08)
- **lead-magnets** (2.0.0 → 2.1.0): new `references/content-to-skill.md` (plus corpus design and release companions) on packaging a course, webinar series, podcast, or newsletter archive you own as an installable agent skill: a new kind of lead magnet. From @rudycelekli's #725 (closes #432), folded in rather than added as a new skill. Triggers added: 'course as a skill,' 'package our content as an agent skill.' **ai-seo** (2.7.5 → 2.7.6) points to it.
diff --git a/tests/clis/dub-bulk-container.test.cjs b/tests/clis/dub-bulk-container.test.cjs
new file mode 100644
index 0000000..ee80ec5
--- /dev/null
+++ b/tests/clis/dub-bulk-container.test.cjs
@@ -0,0 +1,22 @@
+const {test}=require('node:test')
+const assert=require('node:assert/strict')
+const {spawnSync}=require('node:child_process')
+const path=require('node:path')
+const cli=path.resolve(__dirname,'../../tools/clis/dub.js')
+function run(value,preview=false){
+ const args=['links','bulk-create'];if(value!==undefined)args.push('--links',value);if(preview)args.push('--dry-run')
+ const source=`global.fetch=async(url,opts)=>{process.stderr.write('FETCH_CALLED');return {status:200,text:async()=>JSON.stringify({body:JSON.parse(opts.body),headers:opts.headers})}};process.argv=['node',${JSON.stringify(cli)},...${JSON.stringify(args)}];require(${JSON.stringify(cli)})`
+ return spawnSync(process.execPath,['-e',source],{encoding:'utf8',env:{...process.env,DUB_API_KEY:'fixture-key'},timeout:5000})
+}
+const link={url:'https://example.invalid',geo:{US:'https://us.example.invalid'},tagNames:['fixture']}
+test('rejects invalid batch containers, entries, and sizes before delivery or preview',()=>{
+ for(const value of [undefined,'null','{}','true','42','"text"','[]','[null]','[[]]','[42]',JSON.stringify(Array(101).fill(link))])for(const preview of [false,true]){
+ const result=run(value,preview);assert.equal(result.status,1,`${value}: ${result.stdout}`);assert.equal(result.stderr.includes('FETCH_CALLED'),false);assert.match(JSON.parse(result.stderr).error,/array of 1–100 link objects/);assert.equal(result.stdout,'')
+ }
+})
+test('one and one hundred link batches retain nested payload and masking',()=>{
+ for(const count of [1,100])for(const preview of [false,true]){const links=Array(count).fill(link);const result=run(JSON.stringify(links),preview);assert.equal(result.status,0,result.stderr);const response=JSON.parse(result.stdout);assert.deepEqual(response.body,links);assert.equal(response.headers.Authorization,preview?'***':'Bearer fixture-key')}
+})
+test('retains malformed JSON diagnostic without delivery',()=>{
+ const result=run('{broken');assert.equal(result.stderr.includes('FETCH_CALLED'),false);assert.match(JSON.parse(result.stdout).error,/Invalid JSON in --links/)
+})
diff --git a/tools/clis/dub.js b/tools/clis/dub.js
index 98cfca9..9c822df 100755
--- a/tools/clis/dub.js
+++ b/tools/clis/dub.js
@@ -103,6 +103,10 @@ async function main() {
} catch {
result = { error: 'Invalid JSON in --links' }; break
}
+ if (!Array.isArray(links) || links.length < 1 || links.length > 100 ||
+ links.some(link => !link || typeof link !== 'object' || Array.isArray(link))) {
+ throw new Error('--links must be an array of 1–100 link objects')
+ }
result = await api('POST', '/links/bulk', links)
break
}