Skip to main content

Security Architecture

Verified against konsol 3e220ba8 and konsolidat 54d072a on 2026-11-05. Items marked "not built" are not in the code; items marked "hosting" depend on where you run it.

Design​

  • konsol (Frappe v16) owns users, roles, declarations, approvals, the close and the audit trail.
  • ClickHouse owns the numbers. Nothing outside the stack reads it; konsol reads it over HTTP from inside the Compose network.
  • Excel reads and writes only through konsol's API.
  • Approvals are the control. A rate, journal, ownership change, deal or build is approved from the record's Actions menu by a role that may; an approval after sign-off voids the signature (konsol#338, #341).
┌──────────────────────────────────────────────────────────────┐
│ Clients: Excel add-in · close app /close · Desk /desk · CLI │
└──────────────┬───────────────────────────────────────────────┘
│ HTTPS (Caddy) — session cookie, or X-Konsolidat-Token
▼
┌──────────────────────────────────────────────────────────────┐
│ konsol: roles · User Permissions on Entity · workflows │
│ Close Event audit trail · track_changes on doctypes │
│ MariaDB (declarations, approvals) │
└──────────────┬───────────────────────────────────────────────┘
│ HTTP inside the Compose network (TLS optional)
▼
┌──────────────────────────────────────────────────────────────┐
│ ClickHouse: ports bound to 127.0.0.1 unless CLICKHOUSE_BIND │
└──────────────────────────────────────────────────────────────┘

1. Identity and authentication​

MechanismDetailsStatus
Frappe session loginUsername and password at /api/method/login; the session cookie is sent on every Desk, close-app and API callShipped
Excel add-in bearer tokenThe task pane posts to konsol.api.excel_addin_auth (credentials: "omit"), stores the token in localStorage (konsol_token); functions.js sends it as X-Konsolidat-Token; konsol.excel_addin_auth.apply_excel_token_auth runs before_request and signs the request in as the token's user. Token life 8 hours (_TOKEN_TTL). Cookies are also sent, forced SameSite=None; Secure; Partitioned as a fallback (excel_addin_cookies.py)Shipped
API keysFrappe API key and secret (User → API Access); used by konsol-cli --backend api and the MCP serverShipped (Frappe)
Guest methodsFive: health, excel_addin_auth, excel_addin_whoami, excel_addin_logout, airbyte_sync_complete (the last needs X-Webhook-Secret, compared in constant time, konsol#10)Shipped
2FAFrappe built-in, configurable per roleAvailable (Frappe)
Microsoft Entra ID SSONo OAuth or social-login code in konsol; the only OAuth client is the D365 connector's client-credentials flowNot built

2. Authorisation​

Roles​

Roles are defined on the doctypes (konsol/*/doctype/*/*.json) and in frappe.only_for gates on the API.

RoleUsed for
EPM AdminConfiguration: chart upload and publish, Dimension, Measure, Dataset, Connector, Build Approval, EPM Settings; Close Lead in the close app
EPM AnalystGroup Accountant in the close app: drafts rates, journals, IC balances, ownership changes; runs checks
Entity AccountantUploads and submits trial balances for the entities a User Permission grants; sees My work and Trial balances only
EPM UserViewer: read-only across the close app and K.EPM reads
Budget Submitter / Manager / Controller / ApproverThe budget doctypes (Budget Cycle, Sheet, Line, Annual Input, Spread Profile)
System ManagerFrappe administration; also passes every gate

The close app maps these to four personas (konsol/close/period_model.py): Close Lead, Group Accountant, Entity Accountant, Viewer. Which role may do what at each close step is listed in the Period Close Guide and the Period close API.

Entity scope​

konsol/entity_permissions.py: a Frappe User Permission on Entity restricts a user to that entity's sub-tree, in Desk lists (permission_query_conditions), in the close app and in epm_value / epm_batch (_assert_entity_access; a refused item is a 403, per item in a batch). As in every Frappe app, no permission means no restriction; EPM Settings.restrict_entities_by_default turns that into deny-by-default. Entity-scoped doctypes include Consolidation Group, Ownership Period, Budget Sheet and Historical Equity Rate; Consolidation Journal is deliberately group-level (decision on konsol#305, 2026-09-27).

Writes​

Every method that writes is @frappe.whitelist(methods=["POST"]); a GET rolls back (konsol/CLAUDE.md; tests/test_close_api_contract.py). Four orchestrator methods (start_run, retry_step, resume_run, cancel_run) and trigger_pipeline write without declaring POST-only (PRD-02 open question).

3. Transport and network​

LayerImplementationStatus
TLSCaddy issues a certificate when SITE_DOMAIN is a hostname; for an IP or localhost the site stays http (deploy.sh domain_scheme)Shipped
ClickHouse isolationPorts 8123, 9000 and the Postgres-wire 15432 bind to ${CLICKHOUSE_BIND:-127.0.0.1}; konsol reaches ClickHouse by service name inside the Compose networkShipped
ClickHouse TLSEPM Settings.clickhouse_secure switches the client to HTTPS; clickhouse_verify_tls controls certificate checks (konsol#11)Shipped; clickhouse_secure defaults to 0, clickhouse_verify_tls to 1
SQL transportQueries and write-through inserts go in the POST body with parameters, never in the URL (konsol#188, #194)Shipped
CORSNo allow_cors in hooks.py, the configurator or the Caddyfile. Excel on the web needs the add-in's functions.json served with a CORS header; this is a deployment setting, not shipped codeNot configured
Rate limitingNone configured in konsol or CaddyNot configured

4. Audit trail​

MechanismDetails
Field-level change trackingtrack_changes is on for 43 of the doctype definitions (Frappe Version documents record who changed which field, when)
Close EventEvery close action (sign-off, reject with reason, reminder, commentary saved, sent back, IC sent back) is a Close Event; the Audit trail screen filters and exports CSV (konsol#326, #345)
Assertion RunEach run records every test's result and its failing-row sample (group-only, konsol#165); signed runs carry a fingerprint of the numbers
ApprovalsSubmittable doctypes: the submit is the approval; a correction supersedes rather than edits (Group Exchange Rate); a reject records its reason (konsol#310)
Statement CommentaryVersioned, cannot be deleted
Build ApprovalWho approved which dbt build of which scope, and when

5. Data protection​

ConcernApproachStatus
PIIThe warehouse holds trial balances: account, entity, period, amounts, declared dimensions. No personal data unless a dimension carries itDesign
Budget confidentialityUser Permissions on Entity scope budget reads and writesShipped
Encryption at restWhatever the host or cloud disk providesHosting
Encryption in transitBrowser and Excel to Caddy over TLS; konsol to ClickHouse inside Compose, HTTPS optionalShipped / optional
Backup./deploy.sh backup (docker/backup/backup.sh): MariaDB, Frappe files, ClickHouse epm, epm_staging, epm_bronze, epm_silver, epm_gold; not epm_raw, which is rebuilt from Trial Balance Submissions (konsol PR #381). Retention BACKUP_RETENTION_DAYS. No restore smoke test yet (konsolidat#241)Shipped, partial
Secretsdeploy.sh generates .env secrets; ERP credentials live on the Connector doctype (Frappe Password fields), not in .envShipped

Excel add-in​

Eight K. custom functions in a shared Office.js runtime. Reads are batched into POST /api/method/konsol.api.epm_batch (at most 2,000 items), K.EPMSAVE calls POST /api/method/konsol.api.budget_cell_save. Every call carries the bearer token; the server applies the caller's roles and entity scope. The manifest's SourceLocation and the functions.json URL must be served from the konsol site over HTTPS for Excel on the web. See Excel Custom Functions.

Hyperion SmartViewkonsol add-in
Cell formula=HsGetValue(...)=K.EPM(...)
Submit dataSmartView submit=K.EPMSAVE(...)
AuthEPM workspace loginFrappe login; bearer token, 8 hours
InstallDesktop pluginOffice add-in: desktop and web

Known gaps​

GapIssue
Entra ID SSORoadmap (Phase 4 in repo/docs/prd/README.md); not built
CORS and rate limitingNot configured; document the deployment's reverse-proxy settings when you add them
cli_api.export_config_api, diff_config_api, apply_config_api have no role gate beyond loginPRD-02 open question; apply_config_api writes configuration
Orchestrator start_run, retry_step, resume_run, cancel_run and trigger_pipeline write without methods=["POST"]PRD-02 open question
Backup restore is unproven; epm_raw not in the backupkonsolidat#241; konsol#283 closed by PR #381
The Frappe image is not built in CIkonsolidat#244