Loading…
Loading…
A health indicator that verifies Row-Level Security (RLS) is active for the application role in SaaS mode, reporting DOWN if RLS is inactive or
The AppRoleRlsHealthIndicator is a readiness contributor that verifies the status of Row-Level Security (RLS) for the Admin API's database connection pool. Its primary purpose is to ensure that in a multi-tenant SaaS deployment, an application instance does not become ready to serve traffic unless RLS is confirmed to be active.
This component implements a "fail-closed" strategy. If the initial check during startup determines that RLS is not active or if the check fails, the instance reports a DOWN health status. This prevents it from being added to the load balancer's active pool, mitigating the risk of data exposure between tenants.
The health check's behavior is conditional on the platform's operating mode:
DOWN status.UP status to maintain backward compatibility with previous appliance behavior, though it will log a warning if RLS is not active.The SaaS mode setting is evaluated on every health check, so a change to the platform license that enables SaaS mode will take effect on the next health check.
The AppRoleRlsHealthIndicator determines the health status through a sequence of probes and checks, primarily within its health() method, which is called by the Spring Boot Actuator framework.
Upon application startup (triggered by an ApplicationReadyEvent), the indicator performs an initial database probe via the probe() method. This one-time check determines the RLS status, and the outcome is cached. If this probe has not yet run, any health check request will return UP with a detail of probe: pending.
When the health endpoint is invoked, the indicator follows this logic:
flowchart TD
A[Health Check Request] --> B{Initial probe run?};
B -- No --> C[Return UP<br/>(detail: probe=pending)];
B -- Yes --> D{SaaS mode enabled?};
D -- No --> E[Return UP<br/>(detail: outcome=...)];
D -- Yes --> F{Last outcome is<br/>PROBE_FAILED?};
F -- No --> G[Use current outcome];
F -- Yes --> H{30s elapsed since<br/>last probe?};
H -- No --> G;
H -- Yes --> I[Execute new DB probe];
I --> J[Update last outcome];
J --> G;
G --> K{Outcome is<br/>RLS_ACTIVE?};
K -- Yes --> E;
K -- No --> L[Return DOWN<br/>(detail: outcome=...)];UP with a detail indicating the probe is pending.UP, regardless of the RLS probe outcome.PROBE_FAILED.
b. Retry Mechanism: If the outcome was PROBE_FAILED and at least 30 seconds (RETRY_INTERVAL) have passed since the last attempt, it triggers a new database probe. This allows the instance to recover from transient database issues at startup without requiring a restart. A definite outcome (e.g., RLS_ACTIVE or an owner bypass) is never re-probed.
c. Determine Final Status: The final health status is determined based on the probe outcome. If the outcome is anything other than RLS_ACTIVE, the indicator returns DOWN. Otherwise, it returns UP.The status of this component is exposed as part of the standard Spring Boot Actuator health endpoint (e.g., /actuator/health) under the name rlsRole.
The JSON response for this indicator includes a status field (UP or DOWN) and a details object containing the outcome of the RLS probe.
{
"status": "UP",
"components": {
"rlsRole": {
"status": "UP",
"details": {
"outcome": "RLS_ACTIVE"
}
},
"...": {}
}
}
The outcome field in the response details can have several values. The source explicitly defines the following:
| Outcome | Description |
|---|---|
RLS_ACTIVE | RLS is confirmed to be active for the application's database role. The health status will be UP. |
PROBE_FAILED | The attempt to check the RLS status failed, likely due to a database connectivity issue. In SaaS mode, this results in a DOWN status, but the check will be retried. |
(other) | The source implies other definite outcomes exist, such as an "owner bypass". In SaaS mode, any outcome that is not RLS_ACTIVE will result in a DOWN status. These definite outcomes are not retried; they require a restart to change. |
SaaS Mode: RLS Active
An instance operating correctly in SaaS mode will report UP.
{
"status": "UP",
"details": {
"outcome": "RLS_ACTIVE"
}
}
SaaS Mode: Probe Failed
If the database probe fails in SaaS mode, the instance reports DOWN.
{
"status": "DOWN",
"details": {
"outcome": "PROBE_FAILED"
}
}
Non-SaaS Mode
Outside of SaaS mode, the indicator always reports UP, but includes the actual probe outcome in the details.
{
"status": "UP",
"details": {
"outcome": "PROBE_FAILED"
}
}
A DOWN status from the rlsRole health indicator occurs only when the platform is in SaaS mode and the RLS probe could not confirm that RLS is active. Check the outcome field in the health endpoint's response details to diagnose the cause.
outcome: PROBE_FAILED
outcome: (Any value other than RLS_ACTIVE)
details: { "probe": "pending" }
In Non-SaaS Mode
UP when not in SaaS mode. However, if the outcome is not RLS_ACTIVE, it indicates a potential RLS misconfiguration that is being ignored. A WARN message is logged in this scenario.The component has one internal timing constant that governs its retry behavior.
| Name | Type | Value | Description |
|---|---|---|---|
RETRY_INTERVAL | Duration | 30 seconds | The minimum time that must pass before retrying a failed RLS database probe when operating in SaaS mode. |