Secrets, Sandboxes, and Safe Execution › Output Validation and Custody
Language AI HandbookAll chapters Hold output candidates for validation at the receiving boundary. Check format, producer binding, current recipient eligibility, and any required review. A schema match helps a consumer interpret the accepted shape. It cannot establish all confidentiality and authorization requirements by itself.
Keep the result in custody until it has an audience
An output candidate has a producer, task, version, and intended audience. These are separate from its visible text. Establish the producer and task binding from trusted runtime metadata. A string copied from inside the result is untrusted data and should not be treated as proof of origin. Decide what happens when a workflow combines inputs with different grants. A downstream artifact can expose a summary of protected data even if it omits every sensitive field name.
Hold a candidate until the collector establishes its format, content handling policy, and recipient eligibility. Format validation checks that fields have the allowed representation and size. It does not establish that those fields are suitable for the intended recipient. A report may use a permitted string field to include information not appropriate for the viewer. Use limited projections, well-defined renderer behavior, and a separate decision about the audience. See OWASP's agent guidance on output validation.
Use observable result states. “Held” means the collector can inspect the current candidate under policy. “Withheld” means no delivery was allowed under the evaluated decision. “Released” records a qualified outcome for a particular recipient and version. A subsequent decision should have its own reason and authorizing context. Preserve an opaque reference to the artifact and the exact policy used. Avoid copying contents into general-purpose telemetry when a versioned reference and outcome code will support review.
The producer's permission to read data and the consumer's permission to receive a result are distinct. A worker can be allowed to summarize a private document for a designated reviewer without being authorized to publish it. A legitimate viewer can still receive an artifact only when its producer, origin, and current delivery decision are valid under the workflow. Define checks at each stage. Result custody is especially important when a task may outlive an access change. Treat cancellation as a signal to update scheduling and examine the current release decision. Reconcile effects already handed to other components under their own protocol.
At deployment, test a synthetic instance where all fields are correct but the intended audience is disallowed. Test a correct audience with an artifact bound to the wrong task. Test a valid result held because the release review remains unfinished. Each case should have a distinct diagnostic in trusted telemetry, subject to the service's retention rules. Run the same cases at common boundaries after a policy upgrade. Prefer a controlled output state over a successful-looking production response when a trust check fails.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!