Skip to content

[P0] Add authentication/authorization to REST API #311

@sfloess

Description

@sfloess

Problem

The REST API (jplatform-rest-api) has no authentication or authorization, allowing anyone to deploy, start, stop, and undeploy applications.

Security Risk

CRITICAL: An unauthenticated attacker could:

  • Deploy malicious applications
  • Stop production applications (DoS)
  • Undeploy all applications
  • Access application metrics (information disclosure)

Impact

  • Severity: CRITICAL
  • Category: Security
  • Cannot be deployed in production without authentication
  • Violates principle of least privilege

Current State

All REST endpoints are open:

  • POST /api/applications - Deploy (anyone can deploy)
  • POST /api/applications/{id}/start - Start (unauthenticated)
  • POST /api/applications/{id}/stop - Stop (unauthenticated)
  • DELETE /api/applications/{id} - Undeploy (unauthenticated)

Required Implementation

Option 1: API Key Authentication (Simple)

api:
  enabled: true
  port: 8080
  apiKey: ${API_KEY}  # From environment variable

Option 2: JWT Authentication (Recommended)

api:
  enabled: true
  port: 8080
  auth:
    type: jwt
    issuer: platform-java
    audience: api-clients

Option 3: mTLS (Enterprise)

Client certificate authentication for high-security environments.

Authorization

After authentication, implement RBAC:

  • Admin role: Full access (deploy, start, stop, undeploy)
  • Operator role: Start/stop only
  • Viewer role: Read-only (list, status, metrics)

Priority

P0 - CRITICAL - MUST be implemented before ANY production deployment.

Workaround

Until fixed, restrict REST API access via firewall:

# Allow only from localhost
iptables -A INPUT -p tcp --dport 8080 -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j DROP

Related

  • SECURITY.md (doesn't mention REST API security)
  • REST API module: jplatform-rest-api

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions