Skip to content

engine: add per-message authorization to ModelPipeline.transform #2310

Closed

Description

@jfallows

Describe the desired outcome from the user's perspective

As a Zilla operator, I want a model transform to see the authorization in effect for the message it is processing, so that per-field access decisions reflect the consumer's grant at that moment rather than a snapshot taken when the stream opened.

Acceptance criteria

  • Add long authorization to ModelPipeline.transform(...), positioned beside traceId where per-operation authorization already sits throughout the engine (doBegin, doData, …):

    ModelPipelineResult transform(long traceId, long bindingId, long authorization, int flags,
        DirectBufferEx src, int srcIndex, int srcLimit,
        MutableDirectBufferEx dst, int dstIndex, int dstLimit);
  • ModelController gains a matching read accessor, long authorization(). Without it, the value reaching ModelPipeline.transform(...) has nowhere to go once the pipeline drives its ModelTransform chain — neither ModelController nor ModelTransform.transform(...) carries any authorization channel today, so a per-field stage composed into a model's transform chain by an installed extension has no way to read it:

    public interface ModelController
    {
        long authorization();
    
        void reject(String diagnostic);
    }

    The concrete pipeline implementation stores whatever authorization its own transform(...) call receives and exposes it through the same ModelController instance it already passes to every stage in the chain — mirroring the existing reject(String diagnostic), just read instead of write, and following the same "a signal reaches every stage unless a mediating stage overrides it" principle ModelController's own Javadoc already documents for that method. A mediating ModelTransform (one that supplies its own ModelController to its downstream) may override authorization(), e.g. to scope it further for a nested composition; the default path is a straight pass-through.

  • Update every ModelPipeline and ModelController implementation and every call site — KafkaCacheModel and equivalents across bindings

  • The value is per message, not per stream. A pipeline may read it into a field before pumping, since pipelines are per-stream and worker-confined, so no allocation is required on the hot path

  • Javadoc stays protocol-neutral per runtime/engine/AGENTS.md — describe the contract, not encryption or Kafka

  • Unit coverage: authorization threading through a test model; a test asserting a changed value between two transform(...) calls on the same pipeline is observed by the transform; a ModelTransform stage reading control.authorization() observing the same value the pipeline received on that call

Additional context

Split out of #1680, which had grown to cover four separable engine changes.

Why a parameter rather than a supplier. Capturing a LongSupplier at supplyDecoder time looks narrower — no signature change, existing callers untouched — but it is a side-channel: the grant arrives out-of-band from the bytes it applies to, and a binding that fails to refresh it silently authorizes against an expired grant. Guards expire and reauthorize mid-stream, and Kafka consume streams are long-lived, so that failure mode is reachable in normal operation. As a parameter, every call site that has not been considered is a compile error rather than a silent authorization bug.

This is the widest change in the epic — it touches Apache-licensed engine, every model implementation, and every binding that uses a model. Mechanical but broad, which is why it is its own issue.

Consumers: #1689 (consume-path per-consumer field authorization) and the equivalent proxy-side produce path — both read it via ModelController.authorization() from within a ModelTransform stage, not from ModelPipeline.transform(...) directly, since per-field access-control logic lives inside the transform chain, not the pipeline entry point.

Activity

  1. added theissue type on Aug 4, 2026
  2. self-assigned this
    on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions