Building a Zero-Leakage Client Portal on monday code: Server-Side Allowlists, AES-256-GCM Vaults & SHA-256 Sign-Offs
When you build a multi-tenant B2B app that exposes internal project boards to unauthenticated external clients via magic links, a single IDOR bug or client-side column filter can leak an agency's profit margins or anothe
When you build a multi-tenant B2B app that exposes internal project boards to unauthenticated external clients via magic links, a single IDOR bug or client-side column filter can leak an agency's profit margins or another client's deliverables.
While building PortalGateβa branded client portal, 2-way item updater, and 1-click external approval app hosted natively on monday codeβI ran into several real-world security and infrastructure gotchas worth sharing with fellow builders.
Why teams hit walls sharing monday.com boards with clients
- Column permissions are Enterprise-only: On Basic, Standard, and Pro plans, hiding columns in a view is cosmetic; external guests on a board can still risk seeing sensitive fields unless you duplicate boards.
- Standard 4:1 guest seat pricing: Past the first 3 guests, every 4 external guests count as a billed seat (often jumping into the next 5-seat block). If you want to model the math, I built a free no-signup monday.com Guest Seat & Enterprise Cost Calculator.
- WorkForms creates duplicate rows: Native forms insert new items instead of letting external clients edit existing deliverables or sign off on an item.
5 Engineering Lessons From Shipping on monday code
1. Default-Deny Server-Side Column Allowlist + Write Locks
Never send full board items to the frontend and hide columns with CSS. PortalGate computes an explicit server-side projection allowlist before JSON serialization so hidden columns (e.g., Internal Cost, Profit Margin) never leave the server.
Two subtle edge cases we also locked down server-side (HTTP 403 on PATCH):
-
Row-Scope Self-Ejection: If a portal filters rows by
Client Email, allowing the client to editClient Emaillets them accidentally eject their own item out of scope (404). Marking row-scope columns system-managed read-only prevents this. -
Approval Status Spoofing: Allowing clients to
PATCHtheApproval Statusdropdown directly would let them setApprovedwithout going through/approve(bypassing SHA-256 receipts and edit-locking). Locking the mapped approval column to the/approveworkflow closes that gap.
2. Hydrating monday code Secrets & Non-Blocking Firestore-MongoDB Indexes
Two real production surprises on monday code (Cloud Run + Google Cloud Firestore in MongoDB-compatible mode):
-
code:secretvalues are mounted under/secrets-v2rather thanprocess.env. Hydrate them once at boot usingEnvironmentVariablesManager({ updateProcessEnv: true })andSecretsManager().get(key). - Calling
await Promise.all([...18 createIndex()...])synchronously beforeapp.listen(8080)can stall Cloud Run's startup probe because Firestore index operations are long-running/IAM-scoped. Running best-effort index creation asynchronously in the background and keeping per-tenant queries single-field indexed ({ accountId }) dropped boot time to under 1 second.
3. Passing create_labels_if_missing: true & Normalizing Status Snapshots
When updating a Status column via change_multiple_column_values, boards with default labels (Working on it / Done / Stuck) reject "Approved" unless you pass create_labels_if_missing: true.
For tamper-evident approval receipts, monday.com stores dynamic metadata (changed_at, index, post_id) inside the raw Status value JSON. Normalizing status/color columns to { label: text } inside the canonical SHA-256 snapshot prevents false-positive tamper alerts while still catching any real status or field modification.
4. Claim-Isolated JWTs & AES-256-GCM OAuth Vault
- Separate signing keys and strict claim/audience validation across iframe
sessionTokens, lifecycle webhooks, OAuth CSRFstatetokens (with single-use replay nonces), and PIN session cookies. - OAuth access tokens are encrypted at rest with AES-256-GCM using a random 12-byte IV and tenant-bound AAD (
portalgate:oauth:v1:<accountId>:<userId>). - 256-bit magic link tokens are stored only as SHA-256 hashes; optional 6-digit PINs use
scryptwith a 5-attempt lockout (HTTP 429).
5. Sandboxed File Proxy & Zero Automation Burn
Transient monday.com S3 public_urls are never persisted to the database. Client downloads stream through an SSRF-validated allowlist proxy with Content-Security-Policy: sandbox and Content-Disposition: attachment. All edits, comments, file uploads, and approvals sync via direct GraphQL mutationsβconsuming 0 monday.com automation actions.
Live Links
- Live Zero-Login Client Portal Demo: Open interactive Acme portal
- Free Guest Seat & Enterprise Paywall Calculator: Calculate guest seat costs
- Security Architecture Docs: PortalGate Security Docs
- Install PortalGate on monday.com (14-day free trial): 1-Click OAuth Install
If you're building on monday code or wrestling with client-facing permissions in SaaS tools, happy to discuss the architecture in the comments!
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.