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(mixpanel): reject non-object event and profile properties
Rudy Celeklidfc39702ee49
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..8825ada 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 Mixpanel event and profile property dictionaries before ingestion or preview.+### 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/mixpanel-property-objects.test.cjs b/tests/clis/mixpanel-property-objects.test.cjsnew file mode 100644index 0000000..89aa5bd--- /dev/null+++ b/tests/clis/mixpanel-property-objects.test.cjs@@ -0,0 +1,24 @@+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/mixpanel.js')+function run(command,properties,preview=false){+ const args=[...command,'--distinct-id','fixture','--properties',properties];if(preview)args.push('--dry-run')+ const source=`global.fetch=async(url,opts)=>{process.stderr.write('FETCH_CALLED');return {ok:true,status:200,text:async()=>JSON.stringify({body:JSON.parse(opts.body)})}};process.argv=['node',${JSON.stringify(cli)},...${JSON.stringify(args)}];require(${JSON.stringify(cli)})`+ return spawnSync(process.execPath,['-e',source],{encoding:'utf8',env:{...process.env,MIXPANEL_TOKEN:'fixture-token'},timeout:5000})+}+const commands=[['track','event','--event','Purchased'],['profiles','set']]+test('rejects invalid property containers before delivery and preview',()=>{+ for(const command of commands)for(const value of ['null','[]','true','42','"text"'])for(const preview of [false,true]){+ const result=run(command,value,preview);assert.equal(result.status,1,`${command}: ${value}: ${result.stdout}`);assert.equal(result.stderr.includes('FETCH_CALLED'),false);assert.match(JSON.parse(result.stderr).error,/must be a JSON object/);assert.equal(result.stdout,'')+ }+})+test('preserves dictionaries, tracking identity, and preview masking',()=>{+ for(const command of commands)for(const properties of [{},{nested:{name:'Zoë'},items:[1,2],active:false}])for(const preview of [false,true]){+ const result=run(command,JSON.stringify(properties),preview);assert.equal(result.status,0,result.stderr);const body=JSON.parse(result.stdout).body[0];if(command[0]==='track')assert.deepEqual(body.properties,{...properties,token:preview?'***':'fixture-token',distinct_id:'fixture'});else {assert.deepEqual(body.$set,properties);assert.equal(body.$token,preview?'***':'fixture-token')}+ }+})+test('retains malformed JSON diagnostic and avoids delivery',()=>{+ for(const command of commands){const result=run(command,'{broken');assert.equal(result.stderr.includes('FETCH_CALLED'),false);assert.equal(JSON.parse(result.stdout).error,'Invalid JSON in --properties')}+})diff --git a/tools/clis/mixpanel.js b/tools/clis/mixpanel.jsindex 4b6f71a..e81fda1 100755--- a/tools/clis/mixpanel.js+++ b/tools/clis/mixpanel.js@@ -132,6 +132,9 @@ async function main() {if (!args.event) { result = { error: '--event required' }; break }let propertiestry { properties = args.properties ? JSON.parse(args.properties) : {} } catch { result = { error: 'Invalid JSON in --properties' }; break }+ if (properties === null || typeof properties !== 'object' || Array.isArray(properties)) {+ throw new Error('--properties must be a JSON object')+ }properties.token = TOKENproperties.distinct_id = args['distinct-id']result = await ingestApi('POST', '/track', [{@@ -152,6 +155,9 @@ async function main() {if (!args['distinct-id']) { result = { error: '--distinct-id required' }; break }let propertiestry { properties = args.properties ? JSON.parse(args.properties) : {} } catch { result = { error: 'Invalid JSON in --properties' }; break }+ if (properties === null || typeof properties !== 'object' || Array.isArray(properties)) {+ throw new Error('--properties must be a JSON object')+ }result = await ingestApi('POST', '/engage', [{$token: TOKEN,$distinct_id: args['distinct-id'],