agentleFS
Hack23Hack23/European-Parliament-MCP-Server/.github/skills/secure-code-review/SKILL.md

secure-code-review

Skill30 starsChanged 9 months agoApache-2.0View on GitHub

Security code review using OWASP Top 10, input validation, and Hack23 ISMS secure development policy for TypeScript/MCP

Files
SKILL.md

Secure Code Review Skill

Purpose

Conduct thorough security code reviews for TypeScript MCP server code, identifying vulnerabilities before production.

When to Use

  • ✅ Reviewing pull requests before merge
  • ✅ Conducting periodic security audits
  • ✅ Implementing features that handle external API data
  • ✅ Integrating third-party libraries
  • ✅ Before major releases

Security Review Checklist

Input Validation (OWASP A03 - Injection)

// ✅ SECURE: Zod schema validation
import { z } from 'zod';
const InputSchema = z.object({
  id: z.number().int().positive(),
  name: z.string().min(1).max(255),
  country: z.string().length(2)
});

// ❌ INSECURE: No validation
function getUser(id: any) { return db.query(`SELECT * FROM users WHERE id = ${id}`); }

API Security (OWASP A01 - Broken Access Control)

  • ✅ Validate all MCP tool inputs with Zod schemas
  • ✅ Rate limit API calls to European Parliament endpoints
  • ✅ Handle errors without leaking internal details
  • ✅ Use HTTPS for all external API calls
  • ✅ Set appropriate request timeouts

Dependency Security (OWASP A06 - Vulnerable Components)

npm audit --audit-level=high
npx knip                    # Find unused dependencies
npm run test:licenses       # Check license compliance

Error Handling

// ✅ SECURE: Generic error messages
catch (error) {
  logger.error('Internal error details', { error });
  return { error: 'An unexpected error occurred' };
}

// ❌ INSECURE: Leaking internals
catch (error) {
  return { error: error.stack }; // Never expose stack traces
}

Review Exit Criteria

  • ✅ No new CodeQL alerts introduced
  • ✅ All inputs validated with Zod schemas
  • ✅ No secrets or credentials in code
  • ✅ Error handling doesn't leak sensitive info
  • ✅ Security tests added for sensitive features
  • ✅ Dependencies scanned for vulnerabilities

ISMS Policy References

Core SDLC policies (authoritative — always cite the applicable ones in review comments):

Supporting policies (cite when applicable):

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.