Skip to content

Security

OJS defines comprehensive security requirements covering transport encryption, authentication, authorization, input validation, and operational security practices.

  • TLS 1.2+ is required for all production deployments.
  • mTLS is recommended for worker-to-backend communication.
  • Certificate validation MUST NOT be disabled in production.

OJS supports multiple authentication mechanisms across three roles:

MethodDescription
API KeyBearer token with 256+ bits entropy
JWTSigned tokens with expiration and scope claims
OAuth 2.0Client credentials flow for service-to-service
Terminal window
curl -X POST http://localhost:8080/ojs/v1/jobs \
-H "Authorization: Bearer ojs_prod_abc123..." \
-H "Content-Type: application/openjobspec+json" \
-d '{"type":"email.send","args":["user@example.com"]}'
MethodDescription
Shared secretPre-shared key for worker registration
mTLSClient certificate authentication
TokenJWT or API key per worker

Admin operations require separate credentials with elevated privileges. Multi-factor authentication is recommended for admin access.

Access can be restricted per queue:

PermissionDescription
enqueueSubmit jobs to the queue
dequeueFetch and process jobs from the queue
cancelCancel jobs in the queue
inspectView job details and queue stats
adminPause, resume, purge, configure the queue
RolePermissions
Producerenqueue, inspect
Workerdequeue, inspect
Operatorenqueue, dequeue, cancel, inspect
AdminAll permissions

In multi-tenant deployments, authorization is scoped by tenant_id. A producer authenticated as tenant A cannot enqueue jobs to tenant B’s queues.

Backends MUST validate all input:

ValidationRule
Job typeAllowlist pattern (^[a-zA-Z0-9._-]{1,255}$)
Queue nameAllowlist pattern (^[a-zA-Z0-9._-]{1,255}$)
Payload sizeReject above limit (default: 1 MiB)
Meta keysPattern: ^[a-zA-Z0-9_.-]{1,128}$
Unknown attributesReject or ignore (configurable)
JSON depthLimit nesting depth to prevent stack overflow
  • Never store sensitive data (passwords, tokens, PII) directly in job args. Use references to secure storage.
  • Backends SHOULD support the Encryption extension for payload encryption at rest.
  • Job arguments MUST NOT be logged in full. Log job type and ID only.
ProtectionDefault
Rate limiting1,000 jobs/sec per client
Queue depth limitConfigurable per queue
Payload size limit1 MiB
Connection limit100 concurrent connections
Request timeout30 seconds

Security-relevant operations MUST be logged:

{
"timestamp": "2026-02-15T10:30:00Z",
"event_type": "queue.purged",
"principal": "admin@example.com",
"source_ip": "10.0.1.50",
"outcome": "success",
"detail": { "queue": "payments", "jobs_purged": 150 }
}

Audit logs MUST NOT include credentials, API keys, or sensitive job arguments.

  • Credentials MUST NOT be stored in source code.
  • Use environment variables, secrets managers, or mounted files.
  • API keys MUST be stored hashed in the database.
  • Support zero-downtime key rotation with grace periods.