How palaueb/pymesec-compliance-auditing-system works
Purpose and entry points
PymeSec is a modular SME compliance-auditing platform for security controls, risk, privacy, continuity, evidence, assessments, and regulatory frameworks. The main Laravel application is in core/; browser traffic enters through core/public/index.php, with product/workspace, administration, API, and console routes defined in core/routes/web.php, core/routes/api.php, and core/routes/console.php.
Runtime and deployment
The primary runtime is PHP 8.1+/Laravel 10, served locally through Dockerized Apache/PHP and MySQL. Docker composition and service configuration are rooted at docker-compose.yml, docker/php/Dockerfile, and docker/nginx/default.conf. Laravel uses configured database, filesystem, cache, queue, mail, plugin, and artifact adapters; local development defaults to file cache and synchronous queues. An optional LDAP service supports identity integration via docker/ldap/Dockerfile.
Core platform kernel
The core owns cross-domain platform concerns rather than most compliance business modules: plugin lifecycle, tenancy/scope context, authorization, identity-provider abstraction, navigation/UI registries, workflow, events, auditing, artifacts, notifications, and reference data. Dependency bindings and plugin bootstrapping are centralized in core/app/Providers/AppServiceProvider.php and core/app/Providers/PluginServiceProvider.php; application boot configuration is in core/bootstrap/app.php.
Request security and tenancy flow
HTTP requests resolve and canonicalize the authenticated principal, establish contextual membership/organization/scope, enforce permissions, then audit operations. The critical boundary middleware is core/app/Http/Middleware/ResolveApiPrincipal.php, core/app/Http/Middleware/CanonicalizeAuthenticatedPrincipal.php, and core/app/Http/Middleware/AuthorizePermission.php. Persistent organizations, scopes, memberships, and functional actors are introduced by migrations such as core/database/migrations/2026_03_12_000010_create_organizations_table.php and core/database/migrations/2026_03_12_000030_create_memberships_table.php.
Extensibility model
Plugins are independently packaged directories discovered from plugins/, declared through plugin.json, and enabled from environment configuration plus a private local state file. The core plugin manager validates manifests, dependencies, routes, menus, and lifecycle state through core/src/Plugins/PluginDiscovery.php, core/src/Plugins/PluginManager.php, and core/src/Plugins/PluginLifecycleManager.php. Plugins implement domain behavior and contribute routes/views/translation resources; examples include plugins/risk-management/src/RiskManagementPlugin.php, plugins/controls-catalog/src/ControlsCatalogPlugin.php, and plugins/evidence-management/src/EvidenceManagementPlugin.php.
Domain data, workflows, and traceability
Domain plugins generally expose repository-backed UI/API operations over shared MySQL tables. Core workflows persist instances and transitions through core/src/Workflows/DatabaseWorkflowService.php and migrations core/database/migrations/2026_03_12_000100_create_workflow_instances_table.php and core/database/migrations/2026_03_12_000110_create_workflow_transitions_table.php. Mutations can emit public events, create audit records, attach evidence artifacts, and notify users via core/src/Events/DatabaseEventBus.php, core/src/Audit/DatabaseAuditTrail.php, and core/src/Artifacts/DatabaseArtifactService.php.
Identity, external services, and integrations
Identity remains provider-agnostic in core and is supplied by plugins: local authentication is implemented by plugins/identity-local/src/IdentityLocalAuthService.php; LDAP synchronization/authentication by plugins/identity-ldap/src/IdentityLdapService.php and plugins/identity-ldap/src/PhpLdapDirectoryGateway.php. Outbound notifications use configured mail transport through core/src/Notifications/OutboundNotificationMailer.php. A separate Go MCP server exposes PymeSec to AI clients, with executable entry points at mcp/cmd/pymesec-mcp/main.go and smoke client at mcp/cmd/pymesec-mcp-smoke/main.go.
Main entry points: PluginManager.php Plugin lifecycle manager · RiskManagementPlugin.php Compliance domain plugins · index.php HTTP entry point · ResolveApiPrincipal.php Principal, scope, authorization
Components 18
Runtime
- Browser clients
- Docker services · Apache/PHP, MySQL, and optional LDAP run locally.
docker-compose.yml - MySQL · Stores organizations, memberships, domain data, workflows, and traceability records.
Laravel Core
- HTTP entry point
core/public/index.php - Product, admin, API routes
core/routes/web.php - Principal, scope, authorization · Resolves API principals and enforces permissions in contextual scope.
core/app/Http/Middleware/ResolveApiPrincipal.php - Platform kernel · Centralizes tenancy, authorization, UI registries, adapters, and plugin bootstrapping.
core/app/Providers/AppServiceProvider.php - Plugin bootstrap
core/app/Providers/PluginServiceProvider.php - Plugin lifecycle manager · Discovers manifests, validates dependencies, and manages enabled lifecycle state.
core/src/Plugins/PluginManager.php - Workflow service · Persists workflow instances and transitions.
core/src/Workflows/DatabaseWorkflowService.php - Audit, events, artifacts · Records mutations, publishes events, and manages evidence artifacts.
core/src/Audit/DatabaseAuditTrail.php - Outbound mail
core/src/Notifications/OutboundNotificationMailer.php
Plugin Domains
- Compliance domain plugins · Risk, controls catalog, evidence management, and other compliance modules.
plugins/risk-management/src/RiskManagementPlugin.php - Plugin manifests · Each package declares itself through plugin.json.
plugins/risk-management/plugin.json - Local identity provider
plugins/identity-local/src/IdentityLocalAuthService.php - LDAP identity provider · Provides LDAP authentication and synchronization.
plugins/identity-ldap/src/IdentityLdapService.php
Integrations
- LDAP service
docker/ldap/Dockerfile - PymeSec MCP server · Exposes PymeSec capabilities to AI clients.
mcp/cmd/pymesec-mcp/main.go
Connections 21
- Browser clients → HTTP entry point: HTTP requests
- Docker services → HTTP entry point: serves
- Docker services → MySQL: runs
- HTTP entry point → Product, admin, API routes: dispatches
- Product, admin, API routes → Principal, scope, authorization: middleware
- Principal, scope, authorization → Platform kernel: uses platform services
- Principal, scope, authorization → MySQL: loads membership and scope
- Platform kernel → Plugin bootstrap: boots
- Plugin bootstrap → Plugin lifecycle manager: initializes
- Plugin manifests → Plugin lifecycle manager: discovered and validated
- Plugin lifecycle manager → Compliance domain plugins: enables and boots
- Plugin lifecycle manager → Local identity provider: loads provider
- Plugin lifecycle manager → LDAP identity provider: loads provider
- Compliance domain plugins → Workflow service: runs workflows
- Compliance domain plugins → Audit, events, artifacts: emits evidence and audit activity
- Compliance domain plugins → MySQL: repository-backed data
- Workflow service → MySQL: instances and transitions
- Audit, events, artifacts → MySQL: persists records
- Audit, events, artifacts → Outbound mail: triggers
- LDAP identity provider → LDAP service: directory gateway
- PymeSec MCP server → HTTP entry point: accesses platform