CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

adobe/aem-cloud-service

All AEM as a Cloud Service skills: component development, Workflow model design, development, triggering, launchers, debugging, and triaging, Dispatcher config authoring, advisory, incident response, performance tuning, and security hardening, Rapid Development Environment (RDE) deployment, log inspection, snapshots, and troubleshooting via `aio aem rde`, Jackrabbit Oak query/index tuning (property, Lucene index definitions), and extracting/inventorying JCR queries (XPath, SQL2, QueryBuilder) across a codebase.

Quality

85%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

dispatcher-crossboundary.test.jsskills/migration/scripts/

'use strict';
const { test, after } = require('node:test');
const assert = require('node:assert');
const fs = require('fs');
const os = require('os');
const path = require('path');
const CB = require('./dispatcher-crossboundary.js');

const _tmpDirs = [];
after(() => { for (const d of _tmpDirs) fs.rmSync(d, { recursive: true, force: true }); });
function mk() { const d = fs.mkdtempSync(path.join(os.tmpdir(), 'cb-')); _tmpDirs.push(d); return d; }
function w(root, rel, c) { const f = path.join(root, rel); fs.mkdirSync(path.dirname(f), { recursive: true }); fs.writeFileSync(f, c); return f; }

test('cmVars: external var (no Define) captured with location, not secret', () => {
  const r = mk();
  w(r, 'conf.d/enabled_vhosts/site.vhost', 'ServerName "${SITE_DOMAIN}"\nHeader set X-Env "${SITE_DOMAIN}"\n');
  const { cmVars } = CB.analyzeCrossBoundary({ configRoot: r, inventory: {} });
  const v = cmVars.find(x => x.name === 'SITE_DOMAIN');
  assert.ok(v, 'SITE_DOMAIN present');
  assert.strictEqual(v.origin, 'external');
  assert.strictEqual(v.secretLike, false);
  assert.strictEqual(v.files.length, 2, 'both usages located');
  assert.ok(v.files.every(u => typeof u.line === 'number' && u.line > 0));
});

test('cmVars: Define with concrete value => config-defined; secret-looking name flagged; value never emitted', () => {
  const r = mk();
  w(r, 'conf.d/vars.conf', 'Define ADMIN_TOKEN "s3cr3t-value"\n');
  w(r, 'conf.d/enabled_vhosts/site.vhost', 'Header set X-Auth "${ADMIN_TOKEN}"\n');
  const { cmVars } = CB.analyzeCrossBoundary({ configRoot: r, inventory: {} });
  const v = cmVars.find(x => x.name === 'ADMIN_TOKEN');
  assert.ok(v);
  assert.strictEqual(v.origin, 'config-defined');
  assert.strictEqual(v.secretLike, true, 'TOKEN name is secret-like');
  const serialized = JSON.stringify(cmVars);
  assert.ok(!serialized.includes('s3cr3t-value'), 'the Defined value must never appear in the artifact');
});

test('cmVars: self-referential Define (${NAME}) is treated as external (CM passthrough)', () => {
  const r = mk();
  w(r, 'conf.d/vars.conf', 'Define SITE_DOMAIN ${SITE_DOMAIN}\n');
  w(r, 'conf.d/enabled_vhosts/site.vhost', 'ServerName "${SITE_DOMAIN}"\n');
  const { cmVars } = CB.analyzeCrossBoundary({ configRoot: r, inventory: {} });
  const v = cmVars.find(x => x.name === 'SITE_DOMAIN');
  assert.ok(v);
  assert.strictEqual(v.origin, 'external', 'Define X ${X} does not locally resolve X');
});

test('cmVars: empty when no ${VAR} usages', () => {
  const r = mk();
  w(r, 'conf.d/enabled_vhosts/site.vhost', 'ServerName "example.com"\n');
  const { cmVars } = CB.analyzeCrossBoundary({ configRoot: r, inventory: {} });
  assert.deepStrictEqual(cmVars, []);
});

// Fix D (crossboundary): a `${OLD}` on a full-line comment must not surface as a cmVar; a live
// `${LIVE}` on an uncommented line still does (comment lines are skipped for both Define + ${VAR}).
test('cmVars: skips ${VAR} inside full-line comments', () => {
  const r = mk();
  w(r, 'conf.d/enabled_vhosts/site.vhost', '# ServerName "${OLD}"\nHeader set X-Live "${LIVE}"\n');
  const { cmVars } = CB.analyzeCrossBoundary({ configRoot: r, inventory: {} });
  assert.ok(cmVars.find(x => x.name === 'LIVE'), 'LIVE (uncommented) present');
  assert.ok(!cmVars.find(x => x.name === 'OLD'), 'OLD (commented) excluded');
});

// Fix F: the file predicate must also scan templated vhosts (*.vhost.tmpl), not only *.vhost.
test('cmVars: captures ${VAR} inside a *.vhost.tmpl file', () => {
  const r = mk();
  w(r, 'conf.d/available_vhosts/site.vhost.tmpl', 'ServerName "${TMPL_DOMAIN}"\n');
  const { cmVars } = CB.analyzeCrossBoundary({ configRoot: r, inventory: {} });
  assert.ok(cmVars.find(x => x.name === 'TMPL_DOMAIN'), 'TMPL_DOMAIN captured from .vhost.tmpl');
});

skills

migration

README.md

SKILL.md

README.md

tile.json