Skip to main content

Konsol — Security Architecture & Excel Online Integration

Last updated: 2026-06-06

Overview​

This document describes the security architecture for exposing Konsol to Excel Online and web users, using Frappe as the application layer and ClickHouse (cloud-hosted) as the analytical backend.

Design principles:

  • Frappe owns application concerns (users, config, workflows, write-back, audit)
  • ClickHouse owns analytical concerns (GL data, consolidation, reporting)
  • ClickHouse is never exposed to the internet — all access goes through Frappe or Cube
  • Excel users get =EPM(...) custom functions that work in Online, Desktop, and iPad

Architecture​

┌──────────────────────────────────────────────────────┐
│ Users │
│ ┌──────────┐ ┌──────────────┐ ┌────────────────┐ │
│ │ Excel │ │ Excel Online │ │ Frappe Desk │ │
│ │ Desktop │ │ / iPad │ │ (Web UI) │ │
│ │ (ODBC) │ │ (Add-in) │ │ │ │
│ └────┬─────┘ └──────┬───────┘ └───────┬────────┘ │
└───────┼───────────────┼──────────────────┼────────────┘
│ │ │
│ HTTPS + Frappe session │
▼ ▼ ▼
┌──────────────────────────────────────────────────────┐
│ Frappe (Application Layer) │
│ │
│ DocTypes: │
│ ├─ Budget Entry (write-back, workflow) │
│ ├─ Scenario (budget/forecast/whatif) │
│ ├─ Consolidation Group (entities, ownership %) │
│ ├─ IC Elimination Rule (debit/credit pairs) │
│ ├─ Allocation Rule (step, driver, accounts) │
│ └─ EPM Report (saved report definitions) │
│ │
│ Built-in: Auth, RBAC, Workflows, Audit, REST API │
│ DB: MariaDB/PostgreSQL (metadata + config only) │
└──────────────────┬───────────────────────────────────┘
│ clickhouse-connect (Python)
▼
┌──────────────────────────────────────────────────────┐
│ ClickHouse (Azure / AWS — managed or self-hosted) │
│ │
│ epm_bronze ← Airbyte (D365 OData extraction) │
│ epm_silver ← dbt (standardized) │
│ epm_gold ← dbt (consolidated TB, IC elim, CTA) │
│ epm_staging ← Frappe writes budget data here │
│ │
│ Cube SQL API (port 15432) → Excel ODBC / Add-in │
└──────────────────────────────────────────────────────┘

Security Layers​

1. Identity & Authentication​

The shipped implementation uses Frappe's native session authentication. Entra ID SSO is a roadmap target, not yet implemented.

MechanismDetailsStatus
Frappe session loginUsers sign in with username/password via POST /api/method/login; Frappe issues a session cookieShipped
Excel Add-in authThe add-in calls /api/method/login and reuses the session cookie on every request (fetch(..., credentials: "include")) — no tokens or Bearer headersShipped
API accessWhitelisted (@frappe.whitelist) methods read the caller from frappe.session.user; RBAC enforced from the sessionShipped
2FAFrappe built-in — configurable per roleAvailable
Entra ID SSOMicrosoft Entra ID (Azure AD), same tenant as D365 F&O, via Frappe Social LoginRoadmap

2. Authorization (Role-Based Access)​

RoleDesk UIExcel ReadExcel WriteConfig Edit
ReaderView reports, dashboards=EPM(...) queriesNoNo
PlannerView + submit budgetsFull read=EPMSAVE(...) budget write-backNo
ControllerFull accessFull readFull writeEdit consolidation groups, IC rules, allocations
AdminFull accessFull readFull writeAll config + user management

Frappe RBAC enforces this on every DocType and API endpoint automatically.

3. Transport & Network​

LayerImplementation
TLSCaddy reverse proxy with automatic Let's Encrypt certificates
CORSWhitelist *.officeapps.live.com + company tenant domain
Rate limiting100 requests/min per user (prevents runaway Excel refresh loops)
ClickHouse isolationPrivate network only — no public endpoint. All access via Frappe or Cube.
Cube SQL APIInternal network only, or VPN for desktop Excel ODBC users

4. Audit Trail​

Frappe provides automatic audit logging on every DocType:

  • Every create, update, delete is logged with user, timestamp, and field-level diff
  • Budget submissions tracked: who submitted, when, what values, approval chain
  • API access logged: which user queried which dimensions
  • Configuration changes tracked: who changed consolidation groups, IC rules, ownership %

No custom code needed — this is Frappe's built-in behavior.

5. Data Protection​

ConcernApproach
PII in GL dataClickHouse stores account-level aggregates, not transactional PII. Personal data stays in D365.
Budget confidentialityRole-based: planners see only their entity/cost center (Frappe user permissions)
Encryption at restClickHouse Cloud and Azure/AWS managed disks provide this by default
Encryption in transitTLS everywhere (Frappe ↔ browser, Frappe ↔ ClickHouse, Airbyte ↔ D365)
BackupClickHouse Cloud: automatic. Self-hosted: scheduled snapshots to blob storage.

Excel Online Integration: Custom Functions​

The HSGETVALUE Equivalent​

Konsol provides an Excel Custom Functions Add-in that registers cell formulas working in Excel Online, Desktop, and iPad. Read functions are debounced and batched into a single epm_batch POST on recalc:

FormulaPurposeAPI Endpoint
=EPM(entity, year, period, account, [measure], [scenario], [cost_center], [dept])Single cell value (HSGETVALUE equivalent, actuals by default)POST /api/method/konsol.api.epm_batch (batched)
=EPM_BUDGET(entity, year, period, account, [cost_center], [dept])Budget amountPOST /api/method/konsol.api.epm_batch (batched)
=EPM_VARIANCE(entity, year, period, account)Actual vs budget variancePOST /api/method/konsol.api.epm_batch (batched)
=EPM_DEBIT(entity, year, period, account)Period debitPOST /api/method/konsol.api.epm_batch (batched)
=EPM_CREDIT(entity, year, period, account)Period creditPOST /api/method/konsol.api.epm_batch (batched)
=EPMSAVE(amount, entity, year, period, account, scenario_id, layer)Write budget data back (planner role only)POST /api/method/konsol.api.budget_cell_save

A single-value GET /api/method/konsol.api.epm_value endpoint is also exposed for direct queries.

Example Usage in a Spreadsheet​

A B C D E
1 Entity Account Actuals Budget Variance
2 USMF 4000 =EPM( =EPM_BUDGET( =EPM_VARIANCE(
"USMF", "USMF", "USMF",
2026,1, 2026,1, 2026,1,
"4000") "4000") "4000")
3 GBMF 4000 125,340 130,000 (4,660)
4 DKMF 5100 45,200 42,000 3,200

How It Compares to Hyperion SmartView​

Hyperion SmartViewKonsol Add-in
Cell formula=HsGetValue(...)=EPM(...)
Bulk refreshAd hoc retrieveAuto-recalc or ribbon refresh button
Submit dataSmartView submit=EPMSAVE(amount, ...)
AuthEPM workspace loginFrappe session login (Entra ID SSO on roadmap)
InstallSmartView plugin (desktop only)Office Add-in (web + desktop + iPad)
Works in Excel OnlineNoYes
Works on iPadNoYes

Add-in Technical Details​

  • Technology: JavaScript, Office.js Custom Functions API
  • Auth: Frappe session login via /api/method/login; the session cookie is sent on every API call (fetch(..., credentials: "include")) — no MSAL/Bearer tokens (Entra ID SSO is a roadmap item)
  • Caching: Results cached per dimension combination during recalc
  • Batch optimization: Multiple =EPM(...) calls in a sheet are debounced and batched into a single /api/method/konsol.api.epm_batch POST during recalc
  • Deployment: Upload to Microsoft 365 admin center for org-wide availability
  • Scaffold: npx yo office --type excel-functions-shared generates the project skeleton

Frappe DocTypes (Replace CSV Seeds)​

Configuration that was previously managed as CSV seed files in dbt is now managed as Frappe DocTypes — web-editable, versioned, audited, and role-protected.

DocTypeReplacesKey FieldsWorkflow
Budget Entryepm_staging.budget_inputentity, year, period, account, cost_center, amount, scenario, submitted_byDraft → Submitted → Approved
Scenarioscenario_definitions.csvscenario_id, name, type (budget/forecast/whatif), base_scenario, statusNo
Consolidation Groupconsolidation_groups.csvgroup_name, entity, ownership_pct, reporting_currencyNo
IC Elimination Ruleic_elimination_rules.csvdebit_account, credit_account, descriptionNo
Allocation Ruleallocation_rules.csvstep_order, source_account, target_account, driver_type, source_cost_centerNo
Allocation Driverallocation_drivers_*.csvcost_center, fiscal_period, driver_value, driver_typeNo

Config Sync Flow​

Controller edits Consolidation Group in Frappe Desk
→ Frappe saves to MariaDB (audited)
→ Frappe server script writes to ClickHouse epm_staging.consolidation_groups
→ Dagster detects change → triggers dbt build
→ Gold layer regenerated with new ownership %
→ Excel users see updated consolidated numbers on next refresh

Budget Approval Workflow (Frappe Built-in)​

Planner submits budget in Excel
→ =EPMSAVE(amount, entity, year, period, account, "BUDGET_2026_Q2", layer) per cell
→ Frappe creates Budget Entry DocType records (status: Draft)
→ Planner clicks "Submit" in Frappe Desk (or auto-submits via API)
→ Workflow transitions to "Pending Approval"
→ Controller receives email notification
→ Controller reviews in Frappe Desk → Approves or Rejects
→ On Approve: data written to ClickHouse epm_staging.budget_input
→ dbt unions into gold_scenario_trial_balance
→ Variance analysis updates automatically

No custom workflow engine needed — this is Frappe's standard DocType workflow feature.


ClickHouse Hosting Options​

OptionServiceCost (~50GB GL data)Managed?
ClickHouse Cloudclickhouse.com (on Azure/AWS)~$200–400/moYes — auto-scaling, backups, monitoring
Azure VMD4s_v5 + managed disk~$150–250/moSelf-hosted — you manage ClickHouse
AWS EC2m6i.xlarge + EBS~$150–250/moSelf-hosted — you manage ClickHouse
Aiven for ClickHouseManaged on Azure/AWS~$300–500/moYes — managed, multi-cloud

For mid-market EPM workloads (a few GB of GL data, monthly refresh cycles), the smallest ClickHouse Cloud tier is sufficient.


What Frappe Closes vs. FastAPI​

GapFastAPI (current)Frappe
User management & SSOBuild from scratchBuilt-in — users, roles, 2FA, OAuth, LDAP
Role-based accessBuild from scratchBuilt-in — RBAC on every DocType
Workflow/approvalsNot implementedBuilt-in — multi-step with email notifications
Audit trailBuild from scratchBuilt-in — every change logged with field-level diff
Web UI for end usersStreamlit (admin only)Built-in — Desk UI, list views, forms, reports
REST APIManual endpoint codingBuilt-in — auto-generated for every DocType
Report builderNoneBuilt-in — query builder + chart views
Real-time updatesNoneBuilt-in — Socket.io
Config managementCSV seeds in gitBuilt-in — DocTypes (web-editable, versioned)

Remaining Gaps (dbt analytical layer — not Frappe's job)​

GapEffortOwner
Cash flow statement~2–3 days dbt workData engineer
Multi-GAAP / dual reporting~1 week dbt workData engineer
Rolling forecasts~2–3 days dbt workData engineer

Build Effort Summary​

ComponentEffortNotes
Frappe app scaffold + DocTypes2–3 daysbench new-app konsol, define 6 DocTypes
ClickHouse integration (server scripts)1–2 daysclickhouse-connect from Frappe to read/write
Entra ID SSO configuration (roadmap)1 dayFrappe Social Login + Entra app registration
Budget approval workflowHalf dayFrappe workflow builder (configuration, not code)
Caddy reverse proxy + TLSHalf day~20 lines of Caddyfile
CORS configuration2 hoursFrappe site_config.json
Excel Custom Functions Add-in2–3 daysJavaScript, Office.js scaffold, Frappe session login
Add-in deployment (org-wide)Half dayUpload to Microsoft 365 admin center
Migrate CSV seeds → DocTypes1 dayOne-time data migration
Total~10–12 days