Your TaskActor is working beautifully. It persists conversation history, fires deadline reminders, and scales across your Kubernetes cluster. Then your security team asks the questions that keep production systems trustworthy: "Is the state encrypted at rest? How do we know actor-to-actor calls are secured? Who accessed which actor and when?"
These aren't theoretical concerns. In November 2024, a misconfigured Redis instance exposed 1.1 million customer records because state wasn't encrypted and access wasn't logged. The organization had built sophisticated business logic but overlooked fundamental security controls.
Dapr provides the building blocks for zero-trust actor security, but they require configuration and verification. This lesson transforms your development-ready actors into production-hardened systems that security teams can approve.
Before configuring security controls, you need to understand what you're protecting against. Actors have a specific threat surface that differs from traditional microservices.
Actors introduce unique considerations beyond typical microservice security:
Identity-Based Attacks: Each actor has a unique ID (e.g., TaskActor/task-123). An attacker who learns your ID scheme can attempt to invoke arbitrary actors.
State Poisoning: Unlike stateless services, actors persist state. Compromised state affects all future interactions with that actor.
Reminder/Timer Manipulation: If an attacker can register reminders, they can trigger actor methods at will.
Placement Service Trust: The placement service routes actor calls. A compromised placement service could redirect traffic.
Dapr doesn't encrypt state by default. Your actor state sits in Redis (or your configured store) in plaintext. Anyone with database access can read it.
Dapr implements client-side encryption using AES in Galois/Counter Mode (GCM). This means:
Supported key sizes: 128, 192, or 256 bits. Dapr documentation recommends 128-bit keys for optimal performance with strong security.
Create a 128-bit hex-encoded encryption key:
Output:
Store this key in a Kubernetes secret:
Update your state store component to enable encryption:
Key points:
Production systems need key rotation. Dapr supports primary and secondary keys for zero-downtime rotation.
Rotation process:
Important: Data encrypted with the old key is not automatically re-encrypted. If you need full re-encryption, your application must read and write each state item.
Check that state is actually encrypted in Redis:
Without encryption (BAD):
With encryption (GOOD):
The encrypted value includes a prefix identifying which key encrypted it, enabling the rotation strategy.
Dapr enables mTLS by default through the Sentry service. But "enabled by default" doesn't mean "working correctly." You need to verify.
Each sidecar gets a unique certificate from Sentry. Actor-to-actor calls (via ActorProxy) go through the sidecars with mutual TLS authentication.
Expected output:
If Sentry isn't running, mTLS is not functional.
Look for the mTLS section:
Key settings:
Check the Sentry logs for certificate operations:
Look for:
Warning signs (30 days before root certificate expiration):
Dapr self-signed certificates are valid for one year. Before expiration, rotate them:
Critical: Always sign new certificates with the same private root key to avoid service disruption.
For additional defense-in-depth, configure API token authentication for actor invocations.
Create a token secret:
Update your deployment annotations:
Clients must include the token in requests:
Security teams need to know: Who accessed which actor? When? What method did they call? What changed?
Implement audit logging in your actor methods:
Output (JSON log line):
For security monitoring tools (Splunk, Elastic SIEM, Azure Sentinel):
Certain operations warrant enhanced logging:
Before deploying actors to production, verify:
Production actor deployments without security controls create real business risk:
These aren't theoretical concerns. Implement security controls before your first production deployment, not after an incident.
Test your dapr-deployment skill with security scenarios:
Prompt 1: "Using my dapr-deployment skill, configure state encryption for my TaskActor with key rotation support."
Evaluate whether your skill:
Prompt 2: "How do I verify mTLS is working for actor-to-actor communication in my Kubernetes cluster?"
Evaluate whether your skill:
Prompt 3: "Generate audit logging code for my TaskActor that's suitable for SIEM integration."
Evaluate whether your skill:
Setup: Have your TaskActor implementation and Kubernetes cluster ready.
What you're learning: How to apply security thinking systematically to actor deployments, identifying threats before they become incidents.
What you're learning: The complete workflow from key generation through verification, not just isolated configuration snippets.
What you're learning: How to conduct security reviews of actor configurations, identifying gaps between development-ready and production-ready deployments.
Safety reminder: Never commit encryption keys, API tokens, or certificates to version control. Use Kubernetes secrets, external secrets management (Vault, AWS Secrets Manager), or sealed secrets for all sensitive configuration.
Sources: