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(resend): validate template variable arrays and limits
Rudy Celekli73d593e4b8c0
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 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.jsonindex 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.jsonindex 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.mdindex dc6d5ce..6f5b589 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 template variable object arrays and their 50-variable limit before create/update 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/resend-template-variables.test.cjs b/tests/clis/resend-template-variables.test.cjsnew file mode 100644index 0000000..00901dc--- /dev/null+++ b/tests/clis/resend-template-variables.test.cjs@@ -0,0 +1,27 @@+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/resend.js')+function run(value,preview=false,sub="create"){+ const args=['templates',sub,'fixture-id','--name','Fixture','--html','<p>Hi</p>'];if(value!==undefined)args.push('--variables',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,RESEND_API_KEY:'fixture-key'},timeout:5000})+}+const variable={key:'NAME',type:'string',fallback_value:'Reader'}+test('rejects invalid variable containers, entries, and sizes before delivery or preview',()=>{+ for(const value of ['null','{}','true','42','"text"','[null]','[[]]','[42]',JSON.stringify(Array(51).fill(variable))])for(const preview of [false,true])for(const sub of ["create","update"]){+ const result=run(value,preview,sub);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 up to 50 variable objects/);assert.equal(result.stdout,'')+ }+})+test('zero, one and fifty variables retain payload and masking',()=>{+ for(const count of [0,1,50])for(const preview of [false,true])for(const sub of ["create","update"]){const variables=Array.from({length:count},(_,i)=>({key:`FIXTURE_${i}`,type:i%2 ? "number" : "string",fallback_value:i%2 ? 25 : "Reader"}));const result=run(JSON.stringify(variables),preview,sub);assert.equal(result.status,0,result.stderr);const response=JSON.parse(result.stdout);assert.deepEqual(response.body.variables,variables);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 for --variables:/)+})+test('omitted optional variables remain absent for creation and update',()=>{+ for(const sub of ['create','update'])for(const preview of [false,true]){+ const result=run(undefined,preview,sub);assert.equal(result.status,0,result.stderr);assert.equal(Object.hasOwn(JSON.parse(result.stdout).body,'variables'),false)+ }+})diff --git a/tools/clis/resend.js b/tools/clis/resend.jsindex 2e39a3e..a7e9089 100755--- a/tools/clis/resend.js+++ b/tools/clis/resend.js@@ -290,6 +290,10 @@ async function main() {if (args.text) body.text = args.textif (args.variables) {try { body.variables = JSON.parse(args.variables) } catch (e) { result = { error: 'Invalid JSON for --variables: ' + e.message }; break }+ if (!Array.isArray(body.variables) || body.variables.length > 50 ||+ body.variables.some(variable => !variable || typeof variable !== 'object' || Array.isArray(variable))) {+ throw new Error('--variables must be an array of up to 50 variable objects')+ }}result = await api('POST', '/templates', body)break@@ -305,6 +309,10 @@ async function main() {if (args.text) body.text = args.textif (args.variables) {try { body.variables = JSON.parse(args.variables) } catch (e) { result = { error: 'Invalid JSON for --variables: ' + e.message }; break }+ if (!Array.isArray(body.variables) || body.variables.length > 50 ||+ body.variables.some(variable => !variable || typeof variable !== 'object' || Array.isArray(variable))) {+ throw new Error('--variables must be an array of up to 50 variable objects')+ }}result = await api('PATCH', `/templates/${rest[0]}`, body)break