Overview
Matcher’s security architecture is built on several layers. Every API request passes through multiple security checkpoints before reaching your data.
Then authentication verifies who you are:
- Tenant isolation ensures you only see your own data.
- RBAC checks whether you’re allowed to perform the action.
Layer protection
| Layer | Protection |
|---|---|
| Transport | TLS 1.2+ encryption |
| Authentication | JWT tokens via lib-auth |
| Tenant Isolation | Schema-per-tenant PostgreSQL |
| Authorization | Role-based access control |
| Audit | Immutable append-only logs |
| Storage | Encryption at rest |
Authentication
Matcher uses the shared
lib-auth library for authentication, supporting OAuth 2.0 and JWT-based access control.
Supported authentication methods
| Method | Use Case |
|---|---|
| OAuth 2.0 + JWT | User authentication via IdP |
| Client Credentials | Service-to-service auth |
| API Keys | Programmatic access |
JWT token structure
Required headers
All API requests must include authentication:Token validation
Matcher validates tokens on every request:- Signature verification: Validates JWT signature against public key
- Expiration check: Rejects expired tokens
- Issuer validation: Confirms token from trusted issuer
- Tenant extraction: Extracts tenant_id for schema isolation
Service-to-service authentication
For backend services integrating with Matcher:Response
Authorization (rbac)
Role-based access control protects all API endpoints. Permissions are granular and follow the pattern
domain:resource:action.
Permission structure
ingestion:import:create- Create importsmatching:job:run- Execute matching jobsexception:item:resolve- Resolve exceptions
Complete permission list
Ingestion
| Permission | Description |
|---|---|
ingestion:import:create | Upload transaction files |
ingestion:import:read | View import status |
ingestion:import:cancel | Cancel in-progress imports |
ingestion:source:create | Create data sources |
ingestion:source:read | View source configuration |
ingestion:source:update | Modify source settings |
ingestion:source:delete | Remove data sources |
Matching
| Permission | Description |
|---|---|
matching:job:run | Execute matching jobs |
matching:job:read | View job status |
matching:job:cancel | Cancel running jobs |
matching:match:read | View match results |
matching:match:confirm | Confirm proposed matches |
matching:match:reject | Reject proposed matches |
matching:rule:create | Create match rules |
matching:rule:update | Modify match rules |
matching:rule:delete | Delete match rules |
Exception
| Permission | Description |
|---|---|
exception:item:read | View exceptions |
exception:item:resolve | Resolve exceptions |
exception:item:assign | Assign exceptions |
exception:item:escalate | Escalate exceptions |
exception:routing:manage | Configure routing rules |
Governance
| Permission | Description |
|---|---|
governance:report:read | View reports |
governance:report:create | Generate reports |
governance:report:export | Export report data |
governance:audit:read | View audit logs |
governance:context:create | Create contexts |
governance:context:update | Modify contexts |
governance:context:delete | Delete contexts |
Administration
| Permission | Description |
|---|---|
admin:user:manage | Manage user access |
admin:role:manage | Manage roles |
admin:tenant:configure | Configure tenant settings |
admin:system:monitor | View system health |
Built-in roles
| Role | Permissions | Use Case |
|---|---|---|
reconciliation_viewer | Read-only access to matches and exceptions | Auditors |
reconciliation_analyst | View + resolve exceptions | Finance team |
reconciliation_admin | Full access except system admin | Team leads |
system_admin | All permissions | IT administrators |
Custom roles
Create custom roles combining specific permissions:cURL
Response
Assign roles to users
Tenant isolation
Matcher uses schema-per-tenant isolation in PostgreSQL, providing strong data separation between tenants.
How it works
When a request arrives, Matcher extracts the tenant ID from the JWT token (never from query parameters or headers you control). It then sets the database connection to use that tenant’s schema, so every query runs in complete isolation.Even if a bug existed in the application layer, the database enforces separation.
- Tenant ID from JWT only: Never accepted from request parameters
- Automatic schema selection: Applied via
auth.ApplyTenantSchema() - Query isolation: All queries scoped to tenant schema
- No cross-tenant access: Database enforces isolation
Database schema structure
Isolation guarantees
| Guarantee | Implementation |
|---|---|
| Data isolation | Separate PostgreSQL schemas |
| Query scoping | search_path set per connection |
| No tenant spoofing | Tenant from JWT only |
| Audit separation | Per-tenant audit tables |
Verify tenant isolation
Audit trail
All actions are recorded in an immutable, append-only audit log for compliance and forensics.
Audited events
| Category | Events |
|---|---|
| Authentication | Login, logout, token refresh, failed attempts |
| Data Access | View matches, view exceptions, export data |
| Data Modification | Create match, resolve exception, update rules |
| Configuration | Create context, modify source, change settings |
| Administration | User management, role changes, permission grants |
Audit log structure
Query audit logs
cURL
Response
Audit log retention
| Environment | Retention | Archive |
|---|---|---|
| Production | 7 years | Cold storage after 1 year |
| Staging | 90 days | No archive |
| Development | 30 days | No archive |
Export audit logs
For compliance reporting:Data encryption
Encryption in transit
All data transmitted to and from Matcher is encrypted using TLS.| Requirement | Configuration |
|---|---|
| Protocol | TLS 1.2 or higher |
| Cipher suites | Strong ciphers only |
| Certificate | Valid CA-signed certificate |
| HSTS | Enabled with 1-year max-age |
Encryption at rest
| Data Type | Encryption Method |
|---|---|
| Database | PostgreSQL TDE (Transparent Data Encryption) |
| File storage | AES-256 encryption |
| Backups | Encrypted before storage |
| Secrets | Vault with envelope encryption |
Sensitive field encryption
Specific sensitive fields are encrypted at the application level:Key management
| Practice | Implementation |
|---|---|
| Key rotation | Automatic 90-day rotation |
| Key storage | HashiCorp Vault or AWS KMS |
| Access control | Principle of least privilege |
| Audit | All key access logged |
SOX compliance
Matcher maintains records for SOX (Sarbanes-Oxley) audit requirements.
SOX control features
| Control | Matcher Feature |
|---|---|
| Segregation of duties | RBAC with granular permissions |
| Change management | Audit trail for all configuration changes |
| Access control | JWT authentication with role enforcement |
| Audit trail | Immutable logs with 7-year retention |
| Data integrity | Transaction checksums and validation |
SOX compliance report
Generate compliance-ready reports:Response
Four-eyes principle
Enforce dual approval for sensitive actions:API security
Rate limiting
Protect against abuse with rate limits:| Endpoint Type | Limit |
|---|---|
| Read operations | 1000/minute |
| Write operations | 100/minute |
| Report generation | 10/minute |
| File uploads | 20/minute |
Rate limit headers
Ip allowlisting
Restrict API access to known IP ranges:Request signing
For high-security environments, enable request signing:Security monitoring
Security events
Monitor security-relevant events:Response
Security alerts
Configure alerts for security events:Best practices
Use least privilege access
Use least privilege access
Grant users only the permissions they need. Start with minimal access and add permissions as needed.
Rotate credentials regularly
Rotate credentials regularly
Implement automatic rotation for API keys and service credentials. Use short-lived tokens where possible.
Enable audit logging
Enable audit logging
Keep audit logs enabled and review them regularly. Set up alerts for suspicious activity.
Implement IP allowlisting
Implement IP allowlisting
Restrict API access to known IP ranges, especially for production environments.
Use strong authentication
Use strong authentication
Require MFA for user accounts. Use certificate-based auth for service accounts when possible.
Review access regularly
Review access regularly
Conduct periodic access reviews. Remove access promptly when users change roles or leave.
Encrypt sensitive data
Encrypt sensitive data
Enable field-level encryption for sensitive transaction data beyond database encryption.
Monitor security events
Monitor security events
Set up real-time monitoring and alerting for security events. Investigate anomalies promptly.

