All posts

Non-Human Identities Best Practices for Reranking

A common misconception is that any service account can be reused across reranking jobs without risk. In reality, each automated reranking worker should be treated like a distinct identity, with its own scoped permissions and lifecycle. Reranking models typically run in batch jobs that query a vector store, score candidates, and write back rankings. Those jobs often need read access to feature tables, write access to result tables, and sometimes the ability to invoke external APIs. When a single

Free White Paper

Non-Human Identity Management + Managed Identities: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

A common misconception is that any service account can be reused across reranking jobs without risk. In reality, each automated reranking worker should be treated like a distinct identity, with its own scoped permissions and lifecycle.

Reranking models typically run in batch jobs that query a vector store, score candidates, and write back rankings. Those jobs often need read access to feature tables, write access to result tables, and sometimes the ability to invoke external APIs. When a single non-human identity is granted broad privileges, a bug or compromise can cascade across all downstream data, corrupting rankings and exposing sensitive signals.

Why non-human identity matters for reranking

Non-human identities are the credentials that machines use to act on behalf of a service. Because they lack a human’s contextual awareness, they cannot make on‑the‑fly decisions about when a request is appropriate. Therefore, the security model must enforce constraints outside the process that holds the credential. This is where a dedicated access gateway becomes essential.

First, provisioning should be automated through an identity provider that supports OIDC or SAML. Each reranking job receives a short‑lived token that maps to a specific role. The role defines exactly which tables can be read, which columns can be written, and which external endpoints can be called. By limiting the token’s scope, the attack surface shrinks dramatically.

Separate setup from enforcement

The setup phase creates the non-human identity, assigns it to a role, and stores the role definition in the identity provider. This step decides who the request is and whether it may start, but it does not enforce any policy on its own. The enforcement point must sit on the data path, where every request passes through a controllable gateway.

When a reranking job initiates a database connection, the request is intercepted by an access gateway. The gateway validates the token, checks the role’s permissions, and then applies runtime guardrails. Because the gateway sits between the job and the database, it can enforce policies such as:

  • Blocking write commands that target columns outside the approved schema.
  • Masking sensitive fields in query results, for example user identifiers that should never be logged.
  • Requiring a human approver for operations that exceed a predefined risk threshold, such as bulk updates to ranking tables.
  • Recording the entire session for replay, which provides a reliable audit record.

All of these enforcement outcomes exist only because the gateway is in the data path. Without that layer, the non-human identity would connect directly to the database and bypass every safeguard.

Continue reading? Get the full guide.

Non-Human Identity Management + Managed Identities: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Implementing just‑in‑time access for reranking jobs

Just‑in‑time (JIT) access means the credential is issued only for the duration of the job. The workflow looks like this:

  1. The orchestration system requests a token from the identity provider, specifying the job’s unique identifier.
  2. The identity provider returns a short‑lived token bound to a role that matches the job’s data requirements.
  3. The job presents the token to the gateway when establishing the database connection.
  4. The gateway validates the token, enforces the role’s policy, and then forwards the traffic.
  5. When the job finishes, the token expires and can no longer be used.

This pattern eliminates standing credentials and ensures that any compromised token quickly becomes useless.

Auditing and replay for compliance

Regulatory frameworks often require evidence that automated processes accessed data in a controlled manner. Because the gateway records each session, teams can retrieve a replay that shows exactly which queries were executed, which rows were returned, and which columns were masked. That replay becomes the primary artifact for audits, removing the need to trust logs generated by the job itself.

Moreover, the gateway’s audit records are tied to the non‑human identity that initiated the request. This linkage makes it straightforward to answer questions like “Which job updated the ranking table at 03:12 UTC?” without digging through application logs.

Practical steps to adopt the model

Begin by reviewing your identity provider’s support for OIDC or SAML. Define a role template for reranking jobs that includes only the necessary read and write permissions. Next, deploy an access gateway near your data stores. The gateway can be started with a single Docker Compose file, and the documentation walks you through the required configuration.

Once the gateway is running, register each reranking target (for example, a PostgreSQL instance) and associate it with the role template you created. Finally, update your orchestration scripts to request a short‑lived token before launching a job, and configure the job’s client to connect through the gateway.

For detailed instructions on getting started, see the getting‑started guide. The learn section provides deeper coverage of masking, approval workflows, and session replay.

By treating each reranking worker as a distinct non‑human identity, enforcing policies at the gateway, and leveraging just‑in‑time tokens, you gain fine‑grained control, comprehensive auditability, and reduced risk of accidental data exposure.

Visit the GitHub repository to get the code, contribute, or raise issues.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts