Skip to content

Building a module ​

IDVIZE is a security orchestration layer. Identity is its first module; network security is its second. Any security domain can plug in through the same contract. This guide explains how.


What a module is ​

A module teaches IDVIZE about a security domain. It declares what it governs, what controls it evaluates, which platforms it connects to, and what actions it can take. Everything else — the risk register, the framework posture roll-up, the approval flow, the execution engine — is provided by the kernel.

The architectural spine that every module's objects inherit:

Object → Required Controls → Actual Controls → Gap → Remediation → Verification → Continuous Monitoring

A module that follows this contract gets all of the above for free. A module that does not follow it is not an IDVIZE module.


The module manifest ​

Every module registers a ModuleManifest with the kernel's module registry. This is the contract.

typescript
interface ModuleManifest {
  /** Unique module identifier. Lowercase, no spaces: 'identity', 'network', 'endpoint'. */
  moduleId: string;

  /** Security domain classification: identity, network, endpoint, cloud, data, ... */
  domain: string;

  /** Human-readable name shown in the UI and the module list. */
  name: string;

  /** Semantic version. The kernel does not enforce version constraints today
      but will when modules are loaded from packages. */
  version: string;

  /** The object types this module governs.
      Identity governs: application, identity, account, service_account, privileged_account, ai_agent.
      Network governs: firewall_rule, security_group, network_segment, exposed_service.
      Your module declares its own. */
  objectTypes: string[];

  /** Control IDs this module evaluates. Each control must have a unique ID
      (convention: PREFIX-NNN, e.g. NET-001, EP-003). */
  controls: string[];

  /** Connector/driver IDs it can read from. These correspond to platform
      adapters that ingest data (e.g. 'azure_nsg', 'entra', 'crowdstrike'). */
  drivers: string[];

  /** Remediation action types it can carry out. Namespaced:
      'azure_nsg.create_rule', 'entra.configure_saml_sso'. */
  actions: string[];

  /** Sub-areas within this module, for sidebar navigation and categorisation. */
  subAreas: ModuleSubArea[];

  /** Frontend integration hints — which routes and dashboard cards this module adds. */
  ui?: { routes: string[]; dashboardCards: string[] };
}

interface ModuleSubArea {
  subAreaId: string;   // Unique within the module: 'firewall', 'segmentation'
  name: string;        // Shown in the sidebar: 'Firewall Management'
  version: string;
  route: string;       // Frontend route: '/network/firewall'
  category: 'application' | 'intelligence' | 'data';
}

Registering the manifest ​

Registration happens at import time — a top-level call in your service file. The kernel discovers your module because your controller is imported in index.ts, which imports your service, which calls register().

typescript
// my-module.service.ts
import { moduleRegistryService } from '../module-registry/module-registry.service';
import type { ModuleManifest } from '../module-registry/module-registry.types';

const MY_MODULE: ModuleManifest = {
  moduleId: 'endpoint',
  domain: 'endpoint',
  name: 'Endpoint Security',
  version: '1.0.0',
  objectTypes: ['endpoint_device', 'endpoint_agent'],
  controls: ['EP-001', 'EP-002', 'EP-003'],
  drivers: ['crowdstrike', 'defender_for_endpoint', 'sentinelone'],
  actions: [
    'crowdstrike.isolate_host',
    'crowdstrike.lift_containment',
    'defender.run_av_scan',
  ],
  subAreas: [
    { subAreaId: 'devices', name: 'Device Inventory', version: '1.0.0',
      route: '/endpoint/devices', category: 'application' },
    { subAreaId: 'agents',  name: 'Agent Health',     version: '1.0.0',
      route: '/endpoint/agents',  category: 'intelligence' },
  ],
  ui: {
    routes: ['/endpoint', '/endpoint/devices', '/endpoint/agents'],
    dashboardCards: ['endpoint-coverage', 'unhealthy-agents'],
  },
};

moduleRegistryService.register(MY_MODULE);

Once registered, the OS kernel lists your module on GET /os/modules, framework posture aggregates your controls, and the module marketplace shows your domain.


The assessment contract ​

Every module must assess its objects using the same four-verdict model. This is non-negotiable — the kernel, the risk register, the framework posture, and the approval flow all depend on it.

Four verdicts, and exactly four ​

VerdictMeaning
satisfiedRequired, and there is evidence the control is in place
gapRequired, and there is evidence the control is NOT in place
unknownRequired, but there is no evidence either way
not_applicableA person has declared this control does not apply to this object

There is no partial. Every partial case seen so far was either a gap with detail, or two controls collapsed into one. If a genuine partial emerges, it gets added with a definition — not smuggled in.

Evidence basis ​

Every verdict must carry what it rests on. Ordered from strongest to weakest:

BasisMeaningExample
observedRead from the system that enforces the controlQuerying Azure NSG rules via the API
inferredDerived from a related signal, not the control itselfA boolean flag on an application record
declaredA person said so: an override, attestation, or exceptionAn architect marking a control not-applicable
noneNo evidence. The only verdict this supports is unknownA control that has never been evaluated

Invariants enforced by the contract ​

These invariants are enforced by makeAssessment() in assessment.contract.ts. Any violation throws AssessmentContractViolation:

  1. A determination needs evidence. satisfied or gap with basis none is rejected.
  2. No evidence permits only one verdict. Basis none can only support unknown.
  3. Not-applicable is a human decision. not_applicable must have basis declared with an actor.
  4. Declared evidence needs an actor. Who said so?
  5. Non-none basis needs a timestamp. When was the evidence captured?
  6. None basis cannot carry a timestamp. There is nothing to date.
typescript
import { makeAssessment } from '../assessment/assessment.contract';

// This succeeds:
const assessment = makeAssessment({
  tenantId: 'tenant-123',
  objectType: 'firewall_rule',
  objectId: 'fw-rule-456',
  controlId: 'NET-002',
  verdict: 'gap',
  evidence: {
    basis: 'observed',
    source: 'azure_nsg',
    observedAt: new Date().toISOString(),
    detail: 'Rule allows 0.0.0.0/0 on port 22',
  },
  method: 'network-evaluator@1',
});

// This throws AssessmentContractViolation — gap without evidence:
makeAssessment({
  tenantId: 'tenant-123',
  objectType: 'firewall_rule',
  objectId: 'fw-rule-456',
  controlId: 'NET-002',
  verdict: 'gap',
  evidence: { basis: 'none', source: '', observedAt: null },
  method: 'network-evaluator@1',
});

Coverage vs. compliance ​

The assessment summary reports two separate ratios:

  • Coverage = assessed / inScope — how much of the requirement the platform can see
  • Compliance = satisfied / assessed — of what we saw, how much is in place

Unknowns lower coverage (they are in scope but not assessed) but never count as failures (they are not in the compliance denominator). This is the rule from PR-0001-F2: "80 percent undetected undermines the promise" — unknowns must neither vanish from scores nor count as failures.


Controls catalog ​

Each module defines its own controls. A control has:

typescript
interface Control {
  controlId: string;              // Unique across all modules: 'NET-001', 'EP-003'
  name: string;                   // Human-readable: 'Network Segmentation'
  description: string;            // What it checks
  pillar: string;                 // Module prefix: 'NET', 'EP', 'IDV'
  objectTypes: string[];          // Which object types this control applies to
  requirement: string;            // The specific check, readable by an auditor
  remediationGuidance: string;    // What to do when the verdict is 'gap'
}

Control ID convention: PREFIX-NNN, where the prefix matches your module's security domain. Identity uses IDV-XX-NN (49 controls across AM, AC, SC, CM, SA pillars). Network uses NET-NNN (8 controls). Your module should pick a prefix that does not collide.


Compliance framework mappings ​

Modules can map their controls to compliance framework requirements. The registry carries 8 frameworks (NIST CSF 2.0, ISO 27001, SOC 2, CIS v8, PCI DSS 4.0, HIPAA, NIST AI RMF, ISO 42001). The mapping is a three-way join: your control → a framework → a specific requirement.

typescript
moduleRegistryService.mapControlToFramework({
  controlId: 'NET-001',
  frameworkId: 'nist-csf-2',
  requirementId: 'NIST-PR.PS',
  source: 'idvize',
  tenantId: null,
});

When the kernel computes framework posture (GET /frameworks/:id/posture), it aggregates verdicts across all modules' controls mapped to each requirement. Your module's controls contribute automatically.

Customers can add their own mappings at the tenant level (source: 'customer', tenantId: 'tenant-123').


Module file structure ​

Follow the same pattern as every IDVIZE module:

src/modules/<your-module>/
  <your-module>.controller.ts   — Express Router with route handlers
  <your-module>.service.ts      — Business logic + module registration
  <your-module>.repository.ts   — Data access (Map<tenantId, Map<objectId, Object>>)
  <your-module>.types.ts        — TypeScript interfaces and enums
  <your-module>.seed.ts         — Demo data (optional, loaded when SEED_MODE=demo)
  <your-module>.test.ts         — Tests (required)

Controller ​

Mount standard CRUD + assessment endpoints:

typescript
const router = Router();

// CRUD for your objects
router.get('/',           listObjects);       // GET /your-module
router.get('/:id',        getObject);         // GET /your-module/:id
router.post('/',          createObject);       // POST /your-module
router.put('/:id',        updateObject);       // PUT /your-module/:id
router.delete('/:id',     deleteObject);       // DELETE /your-module/:id

// Assessment
router.get('/:id/assess', assessObject);       // GET /your-module/:id/assess
router.get('/controls',   listControls);       // GET /your-module/controls
router.get('/dashboard',  getDashboard);       // GET /your-module/dashboard

export { router as yourModuleController };

Wiring into the app ​

In src/index.ts, import your controller and mount it:

typescript
import { yourModuleController } from './modules/your-module/your-module.controller';

app.use('/your-module', requireAuth, tenantContext, yourModuleController);

That is all. The import triggers your service's top-level register() call. The kernel discovers your module. Your controls appear in framework posture. Your objects appear in the risk register.


Repository pattern ​

All data is tenant-scoped. The repository uses an in-memory Map<tenantId, Map<objectId, Object>> (PostgreSQL migration is planned but not required for module development).

typescript
class YourModuleRepository {
  private store = new Map<string, Map<string, YourObject>>();

  private tenantStore(tenantId: string): Map<string, YourObject> {
    let m = this.store.get(tenantId);
    if (!m) { m = new Map(); this.store.set(tenantId, m); }
    return m;
  }

  list(tenantId: string): YourObject[] {
    return [...this.tenantStore(tenantId).values()];
  }

  get(tenantId: string, objectId: string): YourObject | undefined {
    return this.tenantStore(tenantId).get(objectId);
  }

  upsert(tenantId: string, obj: YourObject): void {
    this.tenantStore(tenantId).set(obj.objectId, obj);
  }

  delete(tenantId: string, objectId: string): boolean {
    return this.tenantStore(tenantId).delete(objectId);
  }
}

export const yourModuleRepository = new YourModuleRepository();

Critical rule: never return data without filtering by tenantId. Cross-tenant data access is a security finding (SD-0042).


Seed data ​

If your module supports demo mode, create a <your-module>.seed.ts that lazy-loads on first request:

typescript
import type { YourObject } from './your-module.types';

export function seedNetworkObjects(tenantId: string): YourObject[] {
  return [
    {
      objectId: `${tenantId}-fw-001`,
      tenantId,
      objectType: 'firewall_rule',
      name: 'Allow SSH from Corporate',
      // ... complete object
    },
    // More seed objects
  ];
}

Seed data is controlled by SEED_MODE:

  • production — starts empty, no seed data loaded
  • demo or development — loads seed data for ACME and Globex tenants

What the kernel provides ​

Once your module is registered, the kernel provides these capabilities at no additional code:

CapabilityHow it works
Module discoveryGET /os/modules lists your module with its manifest
Framework postureGET /frameworks/:id/posture aggregates your controls' verdicts across framework requirements
Risk registerYour objects' gaps appear in GET /os/risks alongside identity's
Baseline inheritanceIDVIZE recommended → customer/global → object-specific control requirements
Execution frameworkRemediation actions run through plan → approve → execute → verify
Audit trailEvery assessment, remediation, and approval is logged
Continuous monitoringPeriodic re-evaluation and drift detection
Dashboard aggregationModule health shown on GET /os/status

Reference: existing modules ​

Identity (first module) ​

FieldValue
moduleIdidentity
Object typesapplication, identity, account, service_account, privileged_account, ai_agent
Controls49 controls across AM, AC, SC, CM, SA pillars
Driversentra, sailpoint, cyberark, okta
Actions20+ across Entra, SailPoint, ServiceNow, generic app connectors

Network Security (second module) ​

FieldValue
moduleIdnetwork
Object typesfirewall_rule, security_group, network_segment, exposed_service
Controls8 controls: NET-001 through NET-008
Driversazure_nsg, aws_security_group, palo_alto, fortinet
Actions8 across Azure NSG, AWS SG, Palo Alto, Fortinet
Framework mappings23 across NIST CSF, PCI DSS, CIS, SOC 2, HIPAA

Checklist: is my module complete? ​

  • [ ] ModuleManifest registered at import time (top-level call in service)
  • [ ] Controller imported in index.ts and mounted with requireAuth + tenantContext
  • [ ] Controls catalog defined with unique IDs (PREFIX-NNN)
  • [ ] Assessment uses makeAssessment() from the assessment contract (four verdicts, evidence required)
  • [ ] Coverage and compliance computed separately (unknowns lower coverage, not compliance)
  • [ ] Repository is tenant-scoped (no cross-tenant data access)
  • [ ] Framework mappings registered for relevant compliance standards
  • [ ] Seed data loads only when SEED_MODE is demo or development
  • [ ] Tests cover controls, assessment, CRUD, and tenant isolation
  • [ ] OpenAPI paths added to the spec (idvize-api/openapi.yaml)