#!/usr/bin/env node // ═══════════════════════════════════════════════════════════════════════════ // Vertical Slice: ALL produktionsåtkomst blockeras (S-001) v3 // Inklusive SSH, SSM, shell, tunnel — alla vägar in // ═══════════════════════════════════════════════════════════════════════════ import { AgentRuntimeV3 } from './agent-runtime-v3.mjs'; /** * EOS Policy för ALL produktionsåtkomst * Blockerar: SSH, SSM, shell-script, tunnel, AWS Systems Manager, etc. */ function checkProductionAccessPolicy(task) { // Lista över alla kända åtkomstmetoder const accessMethods = ['ssh', 'ssm', 'shell', 'aws-ssm', 'tunnel', 'rdp', 'vnc', 'telnet']; const isProductionAccess = task.target === 'production' || task.description?.toLowerCase().includes('produktion'); const isAccessAttempt = accessMethods.includes(task.action) || accessMethods.some(method => task.description?.toLowerCase().includes(method) ); // Blockera även generella "åtkomstförsök" till produktion const isGenericAccess = task.type === 'infrastructure' && isProductionAccess && (task.action === 'access' || task.action === 'connect' || task.description?.toLowerCase().includes('anslut') || task.description?.toLowerCase().includes('koppla')); if (isProductionAccess && (isAccessAttempt || isGenericAccess)) { return { passed: false, policyId: 'POL-SEC-001', rule: 'no-production-access', reason: 'All direktåtkomst till produktion är förbjuden enligt EOS Policy POL-SEC-001. Använd godkänd pipeline.', severity: 'CRITICAL', action: 'STOP', evidence: { action: task.action, target: task.target, method: task.action || 'unknown' } }; } return { passed: true }; } class AgentRuntimeSSHSliceV3 extends AgentRuntimeV3 { constructor(task) { super(task); this.policies = [checkProductionAccessPolicy]; } } export { AgentRuntimeSSHSliceV3, checkProductionAccessPolicy };