Skip to content

Feat/internal mtls - #602

Merged
thlpkee20-wq merged 4 commits into
Stellabill:mainfrom
onyemaechiezekiel9:feat/internal-mtls
Jul 30, 2026
Merged

thlpkee20-wq merged 4 commits into
Stellabill:mainfrom
onyemaechiezekiel9:feat/internal-mtls

Conversation

@onyemaechiezekiel9

Copy link
Copy Markdown
Contributor

closes #433

Overview

This PR introduces two critical security enhancements to Stellabill:

  1. Internal mTLS - Encrypted and authenticated communication between API and worker pods using SPIRE
  2. Cross-Tenant Isolation Testing - Comprehensive fuzz-driven testing to verify tenant isolation

Changes

1. mTLS Between API and Worker Pods (Fixes #433)

Implements mutual TLS using SPIRE for secure, authenticated service-to-service communication.

Key Changes:

  • Implement SVIDRotator for transparent certificate rotation
  • Add gRPC server credentials with client mTLS requirement
  • Add gRPC client credentials with SPIFFE ID verification
  • Integrate SPIFFE IDs into configuration
  • Removes shared-secret coupling between API and worker pods

Testing:

  • 11 unit tests covering certificate rotation and credential validation
  • 2 benchmarks for performance validation
  • Comprehensive deployment and troubleshooting documentation

2. Cross-Tenant Isolation Fuzz Test Suite (Fixes #456)

Systematic fuzz-driven integration test probing all tenant-scoped CRUD endpoints for cross-tenant access vulnerabilities.

Test Coverage:

  • 12 distinct tenant-scoped endpoints across /api/v1 and legacy /api routes
  • 3 fuzz strategies: known cross-tenant ID, malformed ID, non-existent ID
  • Bidirectional symmetric probing (tenant A ↔ tenant B)
  • ~72 total cross-tenant access probes

Findings:
✅ No cross-tenant isolation anomalies detected
✅ All unauthorized access attempts correctly return 404/403
✅ Isolation mechanisms verified across Statement, Subscription, and Plan services

Endpoints Tested:

  • Statements: GET /api/v1/statements/:id, GET /api/v1/statements
  • Subscriptions: GET /api/v1/subscriptions/:id, GET /api/v1/subscriptions
  • Legacy: GET /api/statements/:id, GET /api/subscriptions/:id
  • Exports: POST /api/v1/tenants/me/export, GET /api/v1/operations/:id
  • Plans: GET /api/v1/plans

Run Tests:

go test -tags=integration -run TestTenantIsolationFuzz ./tests/integration/...
Security Impact
✅ Eliminates shared-secret authentication between services
✅ Adds cryptographic proof of service identity
✅ Verifies no cross-tenant data leakage
✅ Provides foundation for zero-trust network policies
Checklist
 Unit tests pass
 Integration tests pass
 Security review ready
 Documentation included

Alu-card19 and others added 4 commits July 28, 2026 15:55
Add comprehensive fuzz-driven integration test that systematically probes
all tenant-scoped CRUD endpoints (subscriptions, statements, etc.) for
cross-tenant data access vulnerabilities.

Test Coverage:
- 12 distinct tenant-scoped endpoints across /api/v1 and legacy /api routes
- 3 fuzz strategies: known cross-tenant ID, malformed ID, non-existent ID
- Bidirectional symmetric probing (tenant A ↔ tenant B)
- ~72 total cross-tenant access probes

Findings: No cross-tenant isolation anomalies detected in current code.
All unauthorized cross-tenant access attempts correctly return 404/403.

Endpoints Tested:
- Statements: GET /api/v1/statements/:id, GET /api/v1/statements
- Subscriptions: GET /api/v1/subscriptions/:id, GET /api/v1/subscriptions
- Legacy: GET /api/statements/:id, GET /api/subscriptions/:id
- Exports: POST /api/v1/tenants/me/export, GET /api/v1/operations/:id
- Plans: GET /api/v1/plans

Isolation Mechanisms Verified:
- StatementService: RBAC checks (admin, merchant tenant-scoped, subscriber)
- SubscriptionService: FindByIDAndTenant scoping + ownership checks
- Handler layer: Soft 404 mapping (404 for both not-found and forbidden)

Test runs with: go test -tags=integration -run TestTenantIsolationFuzz ./tests/integration/...

Fixes Stellabill#456
- Implement SVIDRotator for transparent certificate rotation
- Add gRPC server credentials requiring client mTLS
- Add gRPC client credentials with SPIFFE ID verification
- Integrate SPIFFE IDs into configuration
- Add comprehensive test coverage (11 unit tests + 2 benchmarks)
- Add deployment and troubleshooting documentation
- Removes shared-secret coupling between API and worker pods

Fixes Stellabill#433
@thlpkee20-wq
thlpkee20-wq merged commit 3c00dbb into Stellabill:main Jul 30, 2026
5 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add multi-tenant isolation fuzz across cross-tenant read/write paths Add mTLS between API pods and worker pods for internal RPCs

3 participants