Trust & security

The controls we actually run.

This page lists what the code does today, with the file to check it in. It is not a certification and does not claim one.

Tenant isolation

Queries are scoped to a company id taken from the signed session, never from anything the browser sends. Cache keys carry it too, so one brand’s figures are not served to another’s screen. A static sweep looks for missing company filters, and the API tests run a second tenant beside the first to check nothing crosses.

test/api/tenant-isolation.test.mjs · scripts/tenant-subquery-sweep.mjs

Signed sessions (RS256)

Access tokens are signed with an RSA key pair and last 15 minutes. Production refuses to serve if the key pair is missing, so there is no weaker fallback. The algorithm is fixed on our side; the token header cannot choose it. Refresh tokens can be revoked per session.

src/lib/jwt.ts · src/lib/security.ts

Password and second factor

Passwords are hashed with PBKDF2-HMAC-SHA256 and a per-record salt, at 100,000 iterations, the most the hosting platform allows. Sensitive actions (such as paying a supplier bill, approving payroll or closing a period) ask for a fresh authenticator code.

src/lib/crypto.ts · src/lib/totp.ts

Signed webhooks

Delivery-app and WhatsApp webhooks are verified by an HMAC over the raw request body before anything is parsed. A bad signature gets a bare refusal with no detail. Delivery-app webhooks that carry a timestamp more than five minutes off are also refused as replays.

src/routes/aggregators.ts · src/routes/whatsapp.ts

Rate limiting

Sign-in, token refresh and the demo form are counted exactly by a Durable Object, per address, and fail closed: if the counter cannot be reached, the attempt is refused. Till and screen traffic has its own, higher allowance.

src/lib/ratelimit.ts · docs/decisions/0010-rate-limiting.md

Corrections are reversals

One module writes the ledger. It inserts entries, and a mistake is corrected by a reversing entry that sits beside the original, which is marked reversed. The cash ledger is also protected by database triggers that refuse an UPDATE or a DELETE.

src/lib/accounting.ts:250-355 · migrations/0004_service_floor.sql

Money is calculated in whole fils

Amounts are held in dirhams, but a sale and its journal are worked out in whole fils, not floating point. A sale is split into net, VAT and total so the parts always add up to the whole, and an entry that does not balance is refused.

src/lib/money.ts · src/lib/sale-journal.ts

Roles and separation of duties

Access is role-based, with permissions checked per route. Some pairs of actions cannot be done by one person, such as raising and approving the same supplier bill.

src/lib/rbac.ts · migrations/0042_ap_bill_separation_of_duties.sql

Audit trail

Changes to records are written to an audit log with who, what and when. Sensitive fields, such as bank details and secrets, are masked by name before they are stored.

src/lib/audit.ts · src/lib/audit-redact.ts

Browser hardening

Responses carry a content security policy, HSTS in production, no-framing, no-sniffing and no-referrer headers. The access token is held in the page’s memory, not in browser storage.

src/lib/security.ts · src/lib/middleware.ts

Recovery

The database supports point-in-time restore through Cloudflare D1 Time Travel, and a restore has a written runbook. The restore window depends on the hosting plan.

docs/runbooks/backup-and-restore.md
UAE specifics

How UAE rules are handled, as built.

VAT at 5%

Prices are VAT-inclusive by default and the tax is extracted, not added. Output VAT posts with each sale, and a live VAT position is read from the ledger.

src/routes/finance.ts · /vat/live

Payroll

Overtime is computed from attendance and the run is exported as a WPS file. End-of-service gratuity is computed by the system.

src/lib/eosb.ts · src/routes/hr.ts

Where data lives

AgenX is hosted on Cloudflare: Pages for the application, a D1 database and R2 storage. The configuration sets no country or region restriction, so we make no claim about where data is held, and we do not claim UAE data residency.

wrangler.jsonc
Plainly

What we do not claim.

AgenX holds no third-party security certification today, makes no uptime guarantee on this page, and has not published a penetration-test report. If you need any of those for procurement, ask us and we will tell you where we stand.

Book a demoWe reply within 24 hours