Skip to content

microsoft/power-platform-skills / plugins/power-pages/skills/scan-code

scan-code

Unverified

Scans a Power Pages site project for security issues in source code and dependencies. Runs static analysis and dependency scanning, then surfaces findings by category (code patterns, vulnerable packages, secrets, license issues). Use when the user wants to review code for security problems, check for vulnerable packages, find hard-coded secrets, run a code scan, or asks "is my code safe?", "check my dependencies", "find security issues in my source" — even if they say "audit my code" without mentioning specific tools.

FileKindSize
SKILL.mdskill md13.3 KB
references/commands.mdmarkdown3.8 KB
scripts/check-tools.jsscript1.8 KB
scripts/run-opengrep.jsscript3.6 KB
scripts/run-trivy.jsscript4.2 KB
scripts/transform-scan-code.jsscript7.8 KB

scripts/check-tools.js

View on GitHub
#!/usr/bin/env node

const { execFileSync } = require('child_process');

if (process.argv.includes('--help')) {
  process.stdout.write(`check-tools.js — Detects whether opengrep and trivy are installed.

Usage:
  node check-tools.js

No flags required.

Exit codes:
  0  Both tools available
  1  At least one tool missing (see error field per tool)

Output (stdout, JSON):
  {
    "opengrep": { "available": true, "version": "1.50.0", "error": null },
    "trivy":    { "available": false, "version": null, "error": "command not found" }
  }
`);
  process.exit(0);
}

function probe(runVersion, parseVersion) {
  try {
    const out = runVersion();
    return { available: true, version: parseVersion(out), error: null };
  } catch (err) {
    return { available: false, version: null, error: (err.stderr || err.message || '').toString().trim() };
  }
}

// Keep executable names at the child_process call sites. Passing an executable
// into probe() would make future CLI/env-derived values indistinguishable from
// this fixed two-tool allowlist to the repository security validator.
const runOpenGrepVersion = () => execFileSync('opengrep', ['--version'], {
  encoding: 'utf8',
  timeout: 60000,
  stdio: ['ignore', 'pipe', 'pipe'],
  shell: false,
});
const runTrivyVersion = () => execFileSync('trivy', ['--version'], {
  encoding: 'utf8',
  timeout: 60000,
  stdio: ['ignore', 'pipe', 'pipe'],
  shell: false,
});

const result = {
  opengrep: probe(runOpenGrepVersion, (out) => (out.match(/[\d.]+/) || [null])[0]),
  trivy: probe(runTrivyVersion, (out) => {
    const m = out.match(/Version:\s*([\d.]+)/i) || out.match(/[\d.]+/);
    return m ? m[1] || m[0] : null;
  }),
};

process.stdout.write(JSON.stringify(result, null, 2) + '\n');
process.exit(result.opengrep.available && result.trivy.available ? 0 : 1);
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 193kUpdated Claude CodeCodexVerifiedInstall