mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
- Add shared validation helper (server/lib/validation.js) with ID regex, provider/type allowlists - Validate all route params against allowlists before filesystem operations to prevent path traversal - Strip stack traces and error.message from production error responses (generic "Internal server error") - Sanitize filenames in Content-Disposition headers - Add X-Content-Type-Options: nosniff and X-Frame-Options: DENY to dev server static responses - Add path traversal (.. ) checks to all static file handlers and catch-all fetch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
19 lines
644 B
JavaScript
19 lines
644 B
JavaScript
import { join, dirname } from "path";
|
|
import { fileURLToPath } from "url";
|
|
import { readPatterns } from "../scripts/lib/utils.js";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
const PROJECT_ROOT = join(__dirname, "..");
|
|
|
|
export default function handler(req, res) {
|
|
try {
|
|
// Extract patterns from SKILL.md using the shared utility
|
|
const { patterns, antipatterns } = readPatterns(PROJECT_ROOT);
|
|
res.status(200).json({ patterns, antipatterns });
|
|
} catch (error) {
|
|
console.error("Error in /api/patterns:", error);
|
|
res.status(500).json({ error: "Internal server error" });
|
|
}
|
|
}
|