Files
boc/EOS/policy-registry.mjs
T
Bernt 05ed037fe8 pilot.landvex.com: HTTPS + Full Stack Verified
- DNS: pilot.landvex.com -> 16.170.83.169
- TLS: Let's Encrypt certificate (expires 2026-09-30)
- Nginx: reverse proxy with SSL termination
- API: https://pilot.landvex.com/api/v1/missions
- UI: https://pilot.landvex.com/
- Upload: POST /api/v1/missions/import (multipart/form-data)

Verified:
 https://pilot.landvex.com/health
 https://pilot.landvex.com/version
 https://pilot.landvex.com/api/v1/missions (list)
 https://pilot.landvex.com/api/v1/missions/:id (get)
 POST /api/v1/missions/import (video upload)
 UI loads with title 'LandveX Intelligence Lab'

Next: Pilot 001 — Break the system!
2026-07-02 17:34:19 +00:00

135 lines
3.9 KiB
JavaScript

#!/usr/bin/env node
// ═══════════════════════════════════════════════════════════════════════════
// Policy Registry — Varje policy är ett objekt med egen identitet
// ═══════════════════════════════════════════════════════════════════════════
/**
* Policy Registry
*
* Varje policy har:
* - Policy ID (t.ex. POL-INFRA-001)
* - Namn, kategori, version
* - Ägare, status
* - Acceptance Tests, Regression Tests
* - Evidens, senast verifierad
*/
const POLICIES = [
{
id: 'POL-SEC-001',
name: 'Production SSH Access Control',
category: 'Security',
version: '1.0.0',
owner: 'EOS Team',
status: 'Active',
acceptanceTests: ['S-001'],
regressionTests: true,
evidence: 'Runtime Trace',
lastVerified: '2026-07-01',
rule: 'no-ssh-prod',
description: 'SSH-åtkomst till produktion är förbjuden. Alla ändringar måste gå via godkänd pipeline.'
},
{
id: 'POL-SEC-002',
name: 'Hardcoded Secrets Prevention',
category: 'Security',
version: '1.0.0',
owner: 'EOS Team',
status: 'Active',
acceptanceTests: ['S-004'],
regressionTests: true,
evidence: 'Runtime Trace',
lastVerified: '2026-07-01',
rule: 'no-hardcoded-secrets',
description: 'Hemligheter får aldrig lagras i källkod. Använd AWS Secrets Manager eller motsvarande.'
},
{
id: 'POL-DEP-001',
name: 'Pipeline Required for Production Deployment',
category: 'Deployment',
version: '1.0.0',
owner: 'EOS Team',
status: 'Active',
acceptanceTests: ['S-003'],
regressionTests: true,
evidence: 'Runtime Trace',
lastVerified: '2026-07-01',
rule: 'pipeline-required',
description: 'Deployment till produktion kräver godkänd CI/CD-pipeline.'
},
{
id: 'POL-DAT-001',
name: 'Production Data Modification Control',
category: 'Data',
version: '1.0.0',
owner: 'EOS Team',
status: 'Active',
acceptanceTests: ['S-002'],
regressionTests: true,
evidence: 'Runtime Trace',
lastVerified: '2026-07-01',
rule: 'no-direct-production-db-write',
description: 'Okontrollerade förändringar av persistent data är förbjudna. Använd godkänd migreringsprocess.'
},
{
id: 'POL-INFRA-001',
name: 'Production Infrastructure Change Control',
category: 'Infrastructure',
version: '1.0.0',
owner: 'EOS Team',
status: 'Active',
acceptanceTests: ['S-005'],
regressionTests: true,
evidence: 'Runtime Trace',
lastVerified: '2026-07-01',
rule: 'no-unapproved-infra-change',
description: 'Förändring av produktionsinfrastruktur kräver godkänd Infrastructure-as-Code-process.'
}
];
/**
* Hämta policy efter ID
*/
function getPolicy(id) {
return POLICIES.find(p => p.id === id);
}
/**
* Hämta alla policyer i en kategori
*/
function getPoliciesByCategory(category) {
return POLICIES.filter(p => p.category === category);
}
/**
* Hämta alla aktiva policyer
*/
function getActivePolicies() {
return POLICIES.filter(p => p.status === 'Active');
}
/**
* Versionshantering — jämför två versioner
*/
function compareVersions(v1, v2) {
const parts1 = v1.split('.').map(Number);
const parts2 = v2.split('.').map(Number);
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
const p1 = parts1[i] || 0;
const p2 = parts2[i] || 0;
if (p1 > p2) return 1;
if (p1 < p2) return -1;
}
return 0;
}
/**
* Exportera policyer till JSON
*/
function exportPolicies() {
return JSON.stringify(POLICIES, null, 2);
}
export { POLICIES, getPolicy, getPoliciesByCategory, getActivePolicies, compareVersions, exportPolicies };