Current Status
The Runtime API currently does not implement authentication. All endpoints are publicly accessible without requiring API keys, tokens, or other credentials.Making API Requests
Since authentication is not currently required, you can make requests directly to any endpoint:Security Considerations
While the API lacks authentication, it implements several security measures:Docker Isolation
All code executes in isolated Docker containers, providing:- Process isolation - Code runs in a separate container environment
- Resource limits - Memory and CPU constraints prevent resource exhaustion
- Network isolation - Containers have restricted network access
- Automatic cleanup - Containers are destroyed after execution
Input Validation
The API validates all incoming requests to ensure:- Valid language specification
- Proper request format
- Non-empty code submissions
Recommended Security Measures
For production deployments, consider implementing:API Key Authentication
API Key Authentication
Implement API key-based authentication using Spring Security. Clients would include an API key in request headers:
JWT Token Authentication
JWT Token Authentication
Use JSON Web Tokens (JWT) for stateless authentication. Clients would obtain a token and include it in the Authorization header:
Rate Limiting
Rate Limiting
Implement rate limiting to prevent abuse:
- Limit requests per IP address
- Implement per-user quotas
- Use libraries like Bucket4j or Spring Cloud Gateway
Network Security
Network Security
Secure your deployment infrastructure:
- Use HTTPS/TLS for all communication
- Deploy behind a reverse proxy (nginx, Apache)
- Implement firewall rules
- Use VPC/private networks in cloud environments
Implementation Example
To add basic API key authentication to the Runtime API, you would:- Add Spring Security dependency to
pom.xml - Create a SecurityConfig class to configure authentication
- Implement an API key filter to validate keys
- Update the controller to require authentication
These are simplified examples for illustration. Production authentication should use proper key management, secure storage, and comprehensive error handling.
Best Practices
When implementing authentication for the Runtime API:Choose an authentication method
Select an approach based on your use case (API keys for service-to-service, JWT for user-facing applications)
Secure credential storage
Store API keys and secrets in environment variables or secure vaults (never in code)
Next Steps
API Overview
Return to the API overview
Execute Endpoint
Learn about the code execution endpoint