Identity Propagation in Microservices: Securing Non-Human Identities

microservices identity propagation non-human identity workload identity machine identity security
Lalit Choda
Lalit Choda

Founder & CEO @ Non-Human Identity Mgmt Group

 
June 26, 2025 8 min read

Introduction: The Challenge of Identity in Distributed Systems

Securing microservices starts with a strong foundation: understanding identity in distributed systems. But how do you ensure that each microservice knows who is accessing it, and what they are allowed to do?

In a microservices architecture, applications are built as suites of independent modules. Each microservice handles specific tasks, communicating with others via apis. This distributed nature introduces unique challenges for identity management:

  • Authentication: Verifying the identity of users, services, or devices requesting access. For example, an iot device trying to send data to a cloud service needs to prove it is what it claims to be.
  • Authorization: Determining what actions an authenticated entity is permitted to perform. Think of a healthcare application where a doctor has access to patient records, but a nurse might have limited access.
  • Identity Propagation: Passing identity information securely between microservices. Consider a retail application where the "Order Service" needs to know the user's identity to validate their payment with the "Payment Service".

Without proper identity propagation, you risk:

  • Security Breaches: Unauthorized access to sensitive data.
  • Compliance Violations: Failure to meet regulatory requirements (e.g., gdpr).
  • Operational Overhead: Increased complexity in managing and monitoring access controls.

Diagram 1

In the above diagram, the lack of identity propagation creates a blind spot, where microservices A and B don't know who initiated the request.

As we move forward, we'll explore the risks associated with improper identity propagation and delve into strategies for securing non-human identities, which can include things like service accounts, api keys, and iot devices, in your microservices.

Understanding the Risks of Improper Identity Propagation

Did you know that a data breach can cost a company an average of $4.45 million? (Cost of a Data Breach Report 2025) That's why understanding the risks of improper identity propagation is crucial in a microservices architecture. Let's dive into why this is so important.

Without proper identity propagation, microservices operate in isolation, unaware of the original request's source. This can lead to a cascade of security vulnerabilities:

  • Unauthorized Access: If a microservice doesn't know the identity of the requester, it can't properly enforce authorization policies. Imagine a scenario where a rogue script exploits this lack of awareness to access sensitive data in a healthcare application.
  • Privilege Escalation: A compromised service might be able to perform actions beyond its intended scope. Consider a financial application where a compromised reporting service gains the ability to initiate fund transfers due to missing identity context.
  • Data Corruption: Without knowing who is making changes, it's difficult to audit and prevent malicious modifications. In a retail setting, this could mean unauthorized changes to product pricing or inventory levels.

The consequences of these vulnerabilities can be severe. For instance, consider a supply chain management system where different microservices handle inventory, shipping, and billing. If identity isn't properly propagated, a vulnerability in the shipping service could be exploited to manipulate inventory data, leading to significant financial losses and operational disruptions.

Diagram 2

In this scenario, a lack of identity propagation between the Inventory, Shipping, and Billing services makes the system vulnerable to unauthorized modifications.

Furthermore, improper identity propagation can lead to compliance violations. Regulations like gdpr require organizations to track and control access to personal data. Without proper identity propagation, it becomes nearly impossible to demonstrate compliance and avoid hefty fines.

To address these risks, organizations must implement robust identity propagation strategies. As authentication in microservices can have three meanings for end-users, microservices connecting to other microservices, and external services connecting to your microservices via api, it's crucial to choose the right approach.

In the upcoming sections, we'll explore common identity propagation strategies for non-human identities and delve into best practices for securing your microservices.

Common Identity Propagation Strategies for NHIs

Securing non-human identities (NHIs) in microservices can feel like navigating a maze, but with the right strategies, you can ensure your system remains secure and compliant. Let's explore some common identity propagation strategies tailored for NHIs.

  • JSON Web Tokens (JWT): JWTs are a popular and effective way to propagate identity. They provide a secure mechanism for sharing claims between a client and a microservices application. For example, in a financial application, a JWT can carry the id of the calling microservice, the client id, or the system that initiated the request.

  • Bearer Tokens: These tokens act like digital cash. If a microservice possesses a valid bearer token, it's trusted without further verification at each step, streamlining internal communications. However, it's crucial to implement robust security measures to prevent token theft or misuse.

  • Access Tokens: Using access tokens received at the edge and transferring them to individual microservices allows for granular control over microservice authentication. These tokens can contain specific scopes or permissions, enabling fine-grained access to particular resources or operations within a microservice. For instance, an access token might grant a service permission to read customer data but not to modify it.

  • Mutual TLS (mTLS): mTLS provides strong authentication by requiring both the client and server to verify each other's identities using digital certificates. This approach is particularly useful for securing service-to-service communication within a microservices architecture. Imagine a healthcare system where the "Patient Records Service" needs to communicate with the "Billing Service." mTLS ensures that both services are who they claim to be, preventing unauthorized access to sensitive patient data.

    mermaid

graph TD
A[Start] --> B{Security Needs?};
B -- High --> C[mTLS or JWT];
B -- Low --> D[Bearer Tokens or Headers];
C --> E{Performance Impact?};
D --> E;
E -- High --> F[Headers];
E -- Low --> G[mTLS or JWT];
F --> H[Implement];
G --> H[Implement];
H --> I[Test and Monitor];


Selecting the right strategy is an iterative process. Start with a pilot implementation, monitor its performance and security, and adjust as needed. Don't be afraid to combine strategies to achieve the right balance of security, performance, and maintainability.

For implementation, this might involve configuring your api gateway to issue JWTs, setting up mTLS certificates between services, or adding custom headers to requests. When testing and monitoring, look for metrics like request latency, error rates related to authentication, and audit logs for suspicious activity.

Now that we've explored how to choose the right strategy, let's delve into the tools and technologies available for identity propagation.

Tools and Technologies for Identity Propagation

Selecting the right tools can make or break your identity propagation strategy. Let's explore some of the technologies that can help you secure your microservices.

IAM systems play a crucial role in managing and authenticating identities across your microservices architecture. These systems provide a centralized way to manage user access and permissions, ensuring that only authorized entities can access sensitive resources. Many organizations leverage existing IAM systems like Keycloak to extend their identity management capabilities to non-human identities. Keycloak, for instance, can issue tokens for service accounts and manage their lifecycle, simplifying the process of propagating their identities.

API gateways act as a single entry point for all requests to your microservices. They can handle authentication and authorization at the edge, ensuring that only authenticated requests are routed to the appropriate microservices. This approach simplifies identity propagation by centralizing the authentication process and reducing the complexity of individual microservices. According to a post on dev.to, using an api gateway for global authentication and authorization per service is an effective strategy. An api gateway can validate incoming tokens, enrich requests with identity information, and forward them to downstream services.

Service meshes provide a dedicated infrastructure layer for handling service-to-service communication. They can enforce security policies, including authentication and authorization, at the network level. Service meshes like Istio and Linkerd support mutual TLS (mTLS) and can automatically inject identity information into requests, simplifying identity propagation and enhancing security. They manage certificate issuance and rotation for mTLS, making it easier to secure inter-service communication.

Diagram 3

JSON Web Tokens (JWTs) are a popular way to propagate identity information between microservices. JWT libraries simplify the process of creating, signing, and verifying JWTs. Popular libraries include java-jwt for Java, PyJWT for Python, and jsonwebtoken for Node.js. These libraries are available in various programming languages, making it easy to integrate JWT-based authentication into your microservices.

Choosing the right tools and technologies is essential for implementing a robust and secure identity propagation strategy. With the right tools in place, you can ensure that your microservices are protected against unauthorized access and data breaches.

Next, we'll conclude by summarizing the key concepts and best practices for securing your microservices with robust identity propagation.

Conclusion: Securing Your Microservices with Robust Identity Propagation

Securing your microservices with robust identity propagation is not just good practice; it's essential for maintaining trust and compliance. Let's recap the key steps to ensure your microservices are secure.

  • Understand the risks: As we've covered, improper identity propagation can lead to unauthorized access, privilege escalation, and data corruption.
  • Choose the right strategy: Select a strategy that aligns with your security requirements, performance needs, and existing infrastructure. For instance, if you need granular control over microservice authentication, consider using access tokens, which can contain specific scopes or permissions to limit access to particular resources or operations.
  • Implement best practices: Enforce the principle of least privilege, implement robust token management, and establish comprehensive auditing mechanisms.

Employ the right tools, such as api gateways and service meshes, to streamline identity propagation. Api gateways can centralize authentication, reducing the complexity of individual microservices. (The Role of API Gateway in Microservices Architecture)

Diagram 4

By focusing on these key areas, you can create a secure and resilient microservices architecture that protects your data and maintains the trust of your users.

Lalit Choda
Lalit Choda

Founder & CEO @ Non-Human Identity Mgmt Group

 

NHI Evangelist : with 25+ years of experience, Lalit Choda is a pioneering figure in Non-Human Identity (NHI) Risk Management and the Founder & CEO of NHI Mgmt Group. His expertise in identity security, risk mitigation, and strategic consulting has helped global financial institutions to build resilient and scalable systems.

Related Articles

MAUI workloads

Troubleshooting MAUI App Build Issues Related to Workloads

Troubleshoot .NET MAUI app build failures caused by workload problems. Learn to fix common errors with SDKs, CLI, and Visual Studio configurations.

By Lalit Choda September 30, 2025 8 min read
Read full article
Non Human Identity

Reflections on Switching Virtualization Platforms

Explore the ins and outs of switching virtualization platforms, focusing on machine identity, workload identity implications, and security strategies. Get expert insights for a seamless and secure transition.

By Lalit Choda September 28, 2025 16 min read
Read full article
Non Human Identity

Reflections on Switching Virtualization Platforms

Explore the challenges and security implications of switching virtualization platforms, with a focus on managing Non-Human Identities (NHIs) like machine identities and workload identities.

By Lalit Choda September 28, 2025 69 min read
Read full article
Non Human Identity

Latest Updates for Identity Library Versions

Stay updated on the latest identity library versions for Non-Human Identities, machine identities, and workload identities. Learn about compatibility, troubleshooting, and security best practices.

By Lalit Choda September 26, 2025 11 min read
Read full article