Current Authentication Status
Security Considerations
Current Implementation
The API server is built with FastAPI but does not include:- API key authentication
- OAuth2 or JWT tokens
- User authentication
- Role-based access control (RBAC)
- Rate limiting
- Request signing
Recommended Deployment Practices
If you need to deploy the HeartMAP API in a production or shared environment, consider implementing the following security measures:Network-Level Security
Network-Level Security
Deploy the API behind a firewall or within a private network:
- Use VPN access for remote users
- Restrict IP addresses using firewall rules
- Deploy in a private subnet with no direct internet access
- Use a bastion host or jump server for access
Reverse Proxy with Authentication
Reverse Proxy with Authentication
Use a reverse proxy like Nginx or Apache with authentication:Example Nginx Configuration:Create password file:Access with basic auth:
API Gateway
API Gateway
Deploy behind an API gateway that handles authentication:
- AWS API Gateway: Supports IAM, Cognito, Lambda authorizers
- Kong: Open-source API gateway with authentication plugins
- Traefik: Modern reverse proxy with middleware support
- Azure API Management: Enterprise API management service
SSH Tunneling
SSH Tunneling
For development access to remote servers:
Future Authentication Plans
Future versions of HeartMAP may include built-in authentication options:API Keys
Simple API key-based authentication for service-to-service communication
JWT Tokens
JSON Web Token support for stateless authentication
OAuth2
OAuth2 integration for third-party authentication providers
RBAC
Role-based access control for multi-user environments
Implementing Custom Authentication
If you need to add authentication to your HeartMAP deployment, you can extend the API with FastAPI’s security utilities:Example: API Key Authentication
Example: JWT Bearer Token
HTTPS/TLS
Development
For local development, HTTP is sufficient:Production
For production deployments, always use HTTPS. You can configure Uvicorn with SSL certificates:Data Security
File Upload Security
The API accepts uploaded .h5ad files. Consider:Configuration Security
The/config endpoints allow runtime configuration changes. Consider:
- Restricting which parameters can be modified
- Validating parameter values and ranges
- Requiring authentication for configuration changes
- Logging all configuration modifications
Security Checklist
Before deploying HeartMAP API to production:Security Checklist
Security Checklist
- Deploy behind firewall or in private network
- Implement authentication (API key, JWT, OAuth2)
- Enable HTTPS/TLS
- Configure reverse proxy with security headers
- Set up rate limiting
- Implement request size limits
- Validate all file uploads
- Enable audit logging
- Restrict
/configendpoint access - Use environment variables for secrets
- Regular security updates for dependencies
- Monitor for suspicious activity
Related Resources
FastAPI Security
Official FastAPI security documentation
API Endpoints
View all available API endpoints