Skip to content

Security: princekumar-dev/THE-MYSTIC

Security

SECURITY.md

THE MYSTIC — SECURITY

1. Server Authority

Never trust client input for:

  • role
  • score
  • objective completion
  • elimination
  • vote result
  • evidence manipulation
  • qualification
  • winner calculation

2. Secret Roles

The Impostor ID must never be broadcast to all players.

Bad:

{
  players: [...],
  impostorId: "player-04"
}

Correct:

Server
 ↓
Check authenticated player
 ↓
Return only information authorized for that player

3. Objective Security

Do not allow:

POST /objective/complete

with:

{
  "completed": true
}

Instead, the server must verify the actual game condition.


4. Impostor Security

Every Impostor action checks:

  • player identity
  • player role
  • player alive status
  • game phase
  • target validity
  • ability availability
  • usage limit
  • cooldown
  • mansion membership

5. Vote Security

The server verifies:

  • player is alive
  • meeting is active
  • player belongs to the game
  • player has not already voted
  • target is eligible

6. Admin Security

Admin routes require separate authorization.

Admin actions such as:

  • role reveal
  • forced elimination
  • score adjustment
  • round reset

must require elevated permission.


7. Secrets

Never commit:

DATABASE_PASSWORD
JWT_SECRET
SESSION_SECRET
ADMIN_PASSWORD
API_KEYS

Use environment variables.


8. Rate Limiting

Rate limit:

  • login
  • registration
  • voting
  • game actions
  • WebSocket connections

9. Audit Logs

Record:

Admin login
Role assignment
Evidence changes
Elimination
Votes
Score changes
Round changes
Admin overrides

10. Client Security

Never place sensitive information in:

  • public environment variables
  • HTML
  • local storage
  • browser-visible configuration
  • global WebSocket events

11. Database Security

Use:

  • authentication
  • least-privilege database users
  • encrypted connections
  • backups
  • production/private network rules

12. Session Security

Use secure, HTTP-only cookies where appropriate.

Configure:

Secure
HttpOnly
SameSite
Expiration

13. Principle

Anything the player should not know must never be sent to the player's browser.

There aren't any published security advisories