Skip to content

Commit 8280a5e

Browse files
authored
Merge pull request #241 from deploystackio/main
prod release
2 parents 75a373b + 05902c7 commit 8280a5e

29 files changed

+833
-470
lines changed
Binary file not shown.

docs/assets/images/deploystack/iac-lifecycle.drawio.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.
-13.4 KB
Binary file not shown.

docs/development/backend/api-security.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ requireOAuthScope('scope.name') // Enforce OAuth2 scope requiremen
238238
// Satellite authentication (API key-based)
239239
requireSatelliteAuth() // Validates satellite API keys using argon2
240240
requireUserOrSatelliteAuth() // Accept either user auth or satellite API key
241+
242+
// Registration token authentication (specialized)
243+
validateRegistrationToken() // Validates JWT registration tokens for satellite pairing
241244
```
242245

243246
### Dual Authentication Support
@@ -342,6 +345,44 @@ interface SatelliteContext {
342345
- **Key Rotation**: New API key generated on each satellite registration
343346
- **Scope Isolation**: Satellites can only access their own resources and endpoints
344347

348+
### Registration Token Authentication
349+
350+
For satellite registration security, the system uses specialized JWT-based registration tokens that follow a different security model than regular user authentication.
351+
352+
#### Registration Token Middleware
353+
354+
The `validateRegistrationToken()` middleware (located in `src/middleware/registrationTokenMiddleware.ts`) provides secure satellite registration through:
355+
356+
- **JWT Validation**: Cryptographically signed tokens with HMAC-SHA256
357+
- **Single-Use Enforcement**: Tokens consumed after successful registration
358+
- **Scope Validation**: Global vs team token verification
359+
- **Security Event Logging**: Failed attempts monitored and logged
360+
361+
#### Token Format and Usage
362+
363+
Registration tokens follow specific prefixes:
364+
- `deploystack_satellite_global_` for DeployStack-operated satellites
365+
- `deploystack_satellite_team_` for customer-deployed team satellites
366+
367+
Tokens are passed via standard Authorization header: `Bearer deploystack_satellite_*`
368+
369+
#### Error Response Pattern
370+
371+
Unlike regular authentication errors, registration token failures provide specific instructions:
372+
373+
```typescript
374+
{
375+
"success": false,
376+
"error": "registration_token_required",
377+
"message": "Registration token required in Authorization header",
378+
"instructions": "Set Authorization: Bearer <registration_token> header"
379+
}
380+
```
381+
382+
#### Usage Context
383+
384+
Registration token authentication is exclusively used for the `/api/satellites/register` endpoint. It should not be used for regular API endpoints, which use the standard authentication methods above.
385+
345386
### Team-Aware Permission System
346387

347388
For endpoints that operate within team contexts (e.g., `/teams/:teamId/resource`), use the team-aware permission middleware:

0 commit comments

Comments
 (0)