Summary
CedarJava contains a logic error in the EntityIdentifier.equals() method where null and self-reference checks are inverted, causing incorrect equality results.
While core Cedar authorization decisions are not directly affected, integrators relying on Java-side equality checks for entity identifiers could make flawed access-control or data-handling decisions under certain conditions.
Affected context
This vulnerability appears in CedarJava deployments where the Java EntityIdentifier.equals() method is used to compare entity identifiers, especially in custom authorization or identity-mapping logic.
It becomes relevant when integrators build additional checks, caches, or routing decisions on top of CedarJava's identifier equality semantics.
The issue does not alter Cedar's core Rust-based authorization computation from JSON, but any Java-side equality assumptions can be subtly broken if nulls or self-comparisons are involved.
Exploit preconditions
- Attack surface: Application code paths that depend on EntityIdentifier.equals() for security-relevant decisions (access checks, caching, identity mapping).
- Required access: Ability to influence entity identifiers or inputs passed into equality checks, typically via API requests or integration layers.
- Trigger point: Invocation of EntityIdentifier.equals() where one or both operands may be null, or where self-comparison is expected to return true.
- Why exploitation is possible: The method's null/self branches are inverted, returning true for null comparisons and false for identical self-comparisons, which can mislead higher-level logic that trusts equality semantics.
Why this happens
The underlying bug is an incorrect implementation of a comparison routine, mapping to CWE-697 (Incorrect Comparison).
In the EntityIdentifier.equals() method, the control-flow for null and self-reference checks is inverted, violating the expected contract that x.equals(x) is true and x.equals(null) is false.
This flawed logic can undermine application-layer authorization or data consistency checks built around equality, even though the Cedar core engine remains correct.
The issue illustrates how subtle comparison errors at the library level can propagate into access-control decisions when integrators compose additional logic around identity equality.
Potential impact
- Authorization checks may incorrectly allow or deny access when relying on EntityIdentifier.equals().
- Caching layers or maps keyed by entity identifiers could behave inconsistently, leading to stale or incorrect policy evaluation results.
- Audit logging and correlation of actions to entities may misattribute events or fail to record relevant activity.
- Multi-tenant or role-based routing based on identifier equality could misroute requests or leak information between logical domains.
General mitigation guidance
Mitigation typically involves validating and hardening equality semantics around security-sensitive identifiers and avoiding reliance on subtly broken comparison methods.
Common defensive patterns include:
- Treating equality routines for identities as part of the security boundary and subject to rigorous tests and invariants (e.g., reflexivity, symmetry, null-handling).
- Centralizing entity identifier comparison logic behind well-reviewed abstractions rather than ad hoc calls scattered in application code.
- Building authorization logic to depend directly on canonical, validated identifiers and clear policy evaluations, instead of implicit equality shortcuts.
- Incorporating defensive checks and assertions in authorization-related code paths to detect unexpected equality behavior early in development.
How teams detect issues like this
Organizations can detect similar comparison logic risks through:
- Static analysis or linting rules focused on equals()/hashCode() implementations, particularly around null and self-reference handling.
- Code review practices that scrutinize identity and authorization-related helper methods, confirming they obey standard equality contracts.
- Unit and property-based tests that exercise equality functions under varied inputs (nulls, same-instance, equivalent instances, different instances).
- Policy enforcement in CI/CD to flag changes to core comparison routines for additional security review or automated verification.

