Files
pbakaus_impeccable/server/lib/validation.js
T
Paul BakausandClaude Opus 4.6 4ff4f4643a Add Kiro provider support, clean up legacy code and unused ZIPs
- Add Kiro transformer and build integration (.kiro/skills/ structure)
- Add Kiro to validation allowlists, API handlers, and homepage badge
- Replace legacy getFilePath in Vercel API with unified skills directory structure
- Remove individual provider ZIP creation (only universal ZIPs needed)
- Simplify bundle API allowlist to universal/universal-prefixed only

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 10:33:51 -08:00

28 lines
774 B
JavaScript

// Shared validation helpers for input sanitization
// Only allow alphanumeric, hyphens, and underscores in IDs
export const VALID_ID = /^[a-zA-Z0-9_-]+$/;
export const ALLOWED_PROVIDERS = [
'cursor', 'claude-code', 'gemini', 'codex', 'agents', 'kiro',
'universal', 'universal-prefixed',
];
export const ALLOWED_TYPES = ['skill', 'command'];
export function isValidId(id) {
return typeof id === 'string' && VALID_ID.test(id);
}
export function isAllowedProvider(provider) {
return ALLOWED_PROVIDERS.includes(provider);
}
export function isAllowedType(type) {
return ALLOWED_TYPES.includes(type);
}
// Sanitize a filename for use in Content-Disposition headers
export function sanitizeFilename(filename) {
return filename.replace(/[^a-zA-Z0-9._-]/g, '');
}