Document HTTP maintenance scope and remediation
This commit is contained in:
@@ -6,7 +6,8 @@ This is the canonical public HTTP contract for Scriptorium.
|
|||||||
|
|
||||||
`POST /v1/runs` runs one prompt request and returns generated output,
|
`POST /v1/runs` runs one prompt request and returns generated output,
|
||||||
validation, and metadata. The service has no built-in authentication or
|
validation, and metadata. The service has no built-in authentication or
|
||||||
authorization; deploy it behind appropriate network and authentication controls.
|
authorization. Its maintenance scope is trusted hosts on a trusted network;
|
||||||
|
see [HTTP deployment](operations.md#http-deployment-and-shutdown).
|
||||||
|
|
||||||
The service address and HTTP limits are configured as described in the
|
The service address and HTTP limits are configured as described in the
|
||||||
[configuration reference](config.md). `serve` invocation is defined in the
|
[configuration reference](config.md). `serve` invocation is defined in the
|
||||||
@@ -62,6 +63,8 @@ it is rejected with `400 artifact_not_allowed`. This lexical check does not
|
|||||||
resolve symlinks: the operating system follows symlinks inside the root,
|
resolve symlinks: the operating system follows symlinks inside the root,
|
||||||
including ones that target outside it. Keep the root narrow and inaccessible to
|
including ones that target outside it. Keep the root narrow and inaccessible to
|
||||||
untrusted writers.
|
untrusted writers.
|
||||||
|
Pathname whitespace is significant. File inputs must resolve to regular files;
|
||||||
|
other file types are rejected as `400 artifact_read_failed`.
|
||||||
|
|
||||||
The optional `model` object accepts `endpoint`, `model`, `temperature`,
|
The optional `model` object accepts `endpoint`, `model`, `temperature`,
|
||||||
`max_tokens`, `top_p`, `timeout_seconds`, `service_tier`,
|
`max_tokens`, `top_p`, `timeout_seconds`, `service_tier`,
|
||||||
@@ -72,6 +75,9 @@ Explicit zero values for the numeric fields are overrides; zero
|
|||||||
`timeout_seconds` disables the per-attempt generation deadline only, retaining the
|
`timeout_seconds` disables the per-attempt generation deadline only, retaining the
|
||||||
request context and configured transport cap. The timeout layers are defined in
|
request context and configured transport cap. The timeout layers are defined in
|
||||||
the [PromptKit outbound integration contract](https://forge.maximumdirect.net/base-layer/promptkit/src/commit/207677e9948dc5699073a4d6620d21139033c72d/docs/integrations/openai-compatible-chat.md#timeout-and-cancellation).
|
the [PromptKit outbound integration contract](https://forge.maximumdirect.net/base-layer/promptkit/src/commit/207677e9948dc5699073a4d6620d21139033c72d/docs/integrations/openai-compatible-chat.md#timeout-and-cancellation).
|
||||||
|
JSON numbers in `extra_params`, including nested values, are passed without
|
||||||
|
the HTTP decoder rounding them through floating-point conversion; provider
|
||||||
|
parameter semantics remain owned by PromptKit and the provider.
|
||||||
|
|
||||||
Raw API-key values are not accepted. `api_key`, the removed `prompt_version`,
|
Raw API-key values are not accepted. `api_key`, the removed `prompt_version`,
|
||||||
and any other unknown field cause `400 invalid_json`. Prompt and profile IDs
|
and any other unknown field cause `400 invalid_json`. Prompt and profile IDs
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ owns preparation, credentials, admission, retries, repairs, and content validati
|
|||||||
outcomes, preserving causes while keeping provider payloads out of terminal
|
outcomes, preserving causes while keeping provider payloads out of terminal
|
||||||
explanations. A returned completed validation failure remains a domain outcome;
|
explanations. A returned completed validation failure remains a domain outcome;
|
||||||
an unexpected nil successful result is an integration failure.
|
an unexpected nil successful result is an integration failure.
|
||||||
|
Run and serve share application-configuration diagnostic adaptation. Listener
|
||||||
|
failures include the selected address and a safe typed category while retaining
|
||||||
|
the cause; framework capture explanations remain generic pending upstream support.
|
||||||
|
|
||||||
`delivery.go` submits the actual RunResult to the invocation reporter with a
|
`delivery.go` submits the actual RunResult to the invocation reporter with a
|
||||||
reusable artifact-byte text template. The optional file renders that same value
|
reusable artifact-byte text template. The optional file renders that same value
|
||||||
@@ -69,7 +72,7 @@ mapping to PromptKit requests. Its Runner interface is a consumer-side external
|
|||||||
boundary using native values. Request controls do not mutate shared engine
|
boundary using native values. Request controls do not mutate shared engine
|
||||||
defaults; shared backend capacity accounting remains in that engine.
|
defaults; shared backend capacity accounting remains in that engine.
|
||||||
|
|
||||||
HTTP optional reports use one per-request `internal/report.Collector`, attached
|
HTTP optional reports use one per-request adapter-local collector, attached
|
||||||
only for opted-in requests. It copies terminal aggregates, not event history,
|
only for opted-in requests. It copies terminal aggregates, not event history,
|
||||||
and is never the CLI result report. Success/error attachment and encoded-size
|
and is never the CLI result report. Success/error attachment and encoded-size
|
||||||
handling retain the [HTTP contract](../api.md#execution-report). Reader sentinel
|
handling retain the [HTTP contract](../api.md#execution-report). Reader sentinel
|
||||||
|
|||||||
@@ -8,10 +8,9 @@ public behavior belongs in the linked contracts.
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `cmd/scriptorium` | ReleaseKit version handoff to CommandKit, signal-aware context, native status-to-process exit. | [CLI](../cli.md), [adapters](adapters.md) |
|
| `cmd/scriptorium` | ReleaseKit version handoff to CommandKit, signal-aware context, native status-to-process exit. | [CLI](../cli.md), [adapters](adapters.md) |
|
||||||
| `internal/adapter/cli` | CommandKit composition, ckconfig/ckprompt acquisition, application loading, native request mapping, run/report effects, and HTTP process lifecycle. | [CLI](../cli.md), [adapters](adapters.md), [sources](sources.md) |
|
| `internal/adapter/cli` | CommandKit composition, ckconfig/ckprompt acquisition, application loading, native request mapping, run/report effects, and HTTP process lifecycle. | [CLI](../cli.md), [adapters](adapters.md), [sources](sources.md) |
|
||||||
| `internal/adapter/http` | Routes, strict DTO decoding, transport limits, public request/result/error mapping, and restricted artifact reader. | [HTTP API](../api.md), [adapters](adapters.md), [sources](sources.md) |
|
| `internal/adapter/http` | Routes, strict DTO decoding, transport limits, public request/result/error mapping, terminal report projection, and restricted artifact reader. | [HTTP API](../api.md), [adapters](adapters.md), [sources](sources.md) |
|
||||||
| `internal/config` | Shared ConfigKit schema, secrets bootstrap, discovery/selection, and application definition callbacks. | [Configuration](../config.md), [sources](sources.md) |
|
| `internal/config` | Shared ConfigKit schema, secrets bootstrap, discovery/selection, and application definition callbacks. | [Configuration](../config.md), [sources](sources.md) |
|
||||||
| `internal/defaults` | Application and HTTP default constants. | [Configuration](../config.md) |
|
| `internal/defaults` | Application and HTTP default constants. | [Configuration](../config.md) |
|
||||||
| `internal/report` | HTTP terminal-observation metadata projection. It is not used for CLI native result reports. | [HTTP execution report](../api.md#execution-report), [adapters](adapters.md) |
|
|
||||||
|
|
||||||
CommandKit, ckconfig, ckprompt, ConfigKit, PromptKit, and ReleaseKit are released upstream
|
CommandKit, ckconfig, ckprompt, ConfigKit, PromptKit, and ReleaseKit are released upstream
|
||||||
dependencies, not local framework packages. There is no custom CLI formatter
|
dependencies, not local framework packages. There is no custom CLI formatter
|
||||||
|
|||||||
@@ -39,8 +39,11 @@ upstream-owned.
|
|||||||
|
|
||||||
The reader accepts inline content without a root. File references need a root;
|
The reader accepts inline content without a root. File references need a root;
|
||||||
relative paths resolve below it and absolute paths must be lexically contained.
|
relative paths resolve below it and absolute paths must be lexically contained.
|
||||||
Traversal outside is rejected and the configured file byte limit applies, with
|
Traversal outside is rejected without trimming pathname whitespace. The reader
|
||||||
zero unlimited. Reads preserve native artifact metadata and honor cancellation.
|
checks for regular files before and after opening, and enforces the configured
|
||||||
|
byte limit while reading (zero means unlimited). It checks cancellation before
|
||||||
|
acquisition, around reads, and before returning success; synchronous filesystem
|
||||||
|
calls are not guaranteed to stop immediately. Reads retain artifact metadata.
|
||||||
|
|
||||||
Containment does not resolve symlinks. The OS may follow a symlink inside the
|
Containment does not resolve symlinks. The OS may follow a symlink inside the
|
||||||
root to an outside target; this is not a filesystem sandbox or a defense against
|
root to an outside target; this is not a filesystem sandbox or a defense against
|
||||||
|
|||||||
@@ -77,8 +77,9 @@ It increases encoded response size and remains subject to the configured limit.
|
|||||||
|
|
||||||
## HTTP Deployment And Shutdown
|
## HTTP Deployment And Shutdown
|
||||||
|
|
||||||
The service has no built-in authentication/authorization. Deploy on a trusted
|
The HTTP adapter is maintained for trusted hosts on a trusted network; it has
|
||||||
network or behind appropriate authenticated proxy/gateway controls. Use a narrow,
|
no built-in authentication/authorization. Broader exposure is outside the
|
||||||
|
current maintenance scope, even when a gateway is present. Use a narrow,
|
||||||
dedicated artifact root with controlled ownership and permissions when accepting
|
dedicated artifact root with controlled ownership and permissions when accepting
|
||||||
file inputs; this is lexical containment, not a symlink sandbox.
|
file inputs; this is lexical containment, not a symlink sandbox.
|
||||||
|
|
||||||
@@ -102,10 +103,14 @@ waiting; engine defaults and per-request overrides belong to
|
|||||||
[configuration](config.md) and the [CLI](cli.md)/[HTTP](api.md) contracts.
|
[configuration](config.md) and the [CLI](cli.md)/[HTTP](api.md) contracts.
|
||||||
Whole-operation budgets are distinct from per-attempt generation timeouts.
|
Whole-operation budgets are distinct from per-attempt generation timeouts.
|
||||||
They remain cooperative and do not include configuration/setup or delivery.
|
They remain cooperative and do not include configuration/setup or delivery.
|
||||||
|
The HTTP server has a header-read timeout, but no separate body-read, idle, or
|
||||||
|
response-delivery deadline. The engine operation budget is not a whole-request
|
||||||
|
deadline. Request-body, per-file, response, and backend limits do not constitute
|
||||||
|
an aggregate input or memory budget.
|
||||||
|
|
||||||
Before increasing HTTP byte limits, measure representative requests/artifacts/
|
Before increasing HTTP byte limits, measure representative requests/artifacts/
|
||||||
responses, confirm memory/network/provider capacity, retain authentication and
|
responses, confirm memory/network/provider capacity and existing deployment
|
||||||
upstream request controls, and test a representative workload. Do not widen the
|
controls, and test a representative workload. Do not widen the
|
||||||
artifact root just to make an arbitrary host path accessible.
|
artifact root just to make an arbitrary host path accessible.
|
||||||
|
|
||||||
For failures, capture diagnostics without publishing sensitive data. Verify
|
For failures, capture diagnostics without publishing sensitive data. Verify
|
||||||
|
|||||||
@@ -135,6 +135,9 @@ request after correcting inputs, configuration, or environment.
|
|||||||
conversation management, or multi-step workflow orchestration.
|
conversation management, or multi-step workflow orchestration.
|
||||||
## Trust Boundaries And Threat Scope
|
## Trust Boundaries And Threat Scope
|
||||||
|
|
||||||
|
The HTTP adapter is maintained for use by trusted hosts on a trusted network;
|
||||||
|
broader exposure is outside its current maintenance scope.
|
||||||
|
|
||||||
Ordinary CLI file loading belongs to Promptkit. For untrusted inbound HTTP
|
Ordinary CLI file loading belongs to Promptkit. For untrusted inbound HTTP
|
||||||
artifact references, Scriptorium injects a restricted
|
artifact references, Scriptorium injects a restricted
|
||||||
`promptkit.ArtifactReader`. It denies file references without an artifact
|
`promptkit.ArtifactReader`. It denies file references without an artifact
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
Prepared 2026-11-25 for a Luna coding agent.
|
Prepared 2026-11-25 for a Luna coding agent.
|
||||||
Baseline: `e67633b9f48b42c5b0d14782c6e8e1d4c78fcdd5`.
|
Baseline: `e67633b9f48b42c5b0d14782c6e8e1d4c78fcdd5`.
|
||||||
Status: implementation in progress.
|
Status: complete; upstream capture-diagnostic adoption and conditional HTTP
|
||||||
|
future work remain deferred as described below.
|
||||||
|
|
||||||
## Scope And Execution
|
## Scope And Execution
|
||||||
|
|
||||||
@@ -329,6 +330,15 @@ unsupported presentation improvement does not block other local completion.
|
|||||||
|
|
||||||
## Stage 9: Align Canonical Documentation And Validate The Sprint
|
## Stage 9: Align Canonical Documentation And Validate The Sprint
|
||||||
|
|
||||||
|
**Status: complete.** Canonical HTTP, operations, architecture, and internal
|
||||||
|
documentation reflects the delivered behavior and maintenance scope; future
|
||||||
|
HTTP work remains in `future.md`. The optional model-mapping simplification was
|
||||||
|
not taken. The upstream request was prepared, not implemented or submitted.
|
||||||
|
The full normal and race test suites, vet, formatting, local documentation link
|
||||||
|
targets, and diff checks passed. The build passed with a temporary output path
|
||||||
|
to preserve a pre-existing ignored root binary. The request's synthetic CLI
|
||||||
|
commands were exercised without a provider.
|
||||||
|
|
||||||
**Findings:** 5, 6, 14, and 17 dispositions, plus documentation for delivered work.
|
**Findings:** 5, 6, 14, and 17 dispositions, plus documentation for delivered work.
|
||||||
|
|
||||||
1. Update [operations](../operations.md) with trusted-host/trusted-network HTTP
|
1. Update [operations](../operations.md) with trusted-host/trusted-network HTTP
|
||||||
|
|||||||
@@ -71,6 +71,13 @@ func TestHandlerCancellationDuringRestrictedArtifactAcquisition(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestHandlerRejectsDirectoryArtifact(t *testing.T) {
|
||||||
|
h := newArtifactRootHandler(t, t.TempDir())
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
h.ServeHTTP(w, httptest.NewRequest(http.MethodPost, "/v1/runs", strings.NewReader(`{"prompt_id":"p","inputs":{"input":{"type":"file","uri":"."}}}`)))
|
||||||
|
assertHTTPErrorCode(t, w, http.StatusBadRequest, "artifact_read_failed")
|
||||||
|
}
|
||||||
|
|
||||||
func (run runnerFunc) Run(ctx context.Context, req promptkit.RunRequest) (*promptkit.RunResult, error) {
|
func (run runnerFunc) Run(ctx context.Context, req promptkit.RunRequest) (*promptkit.RunResult, error) {
|
||||||
return run(ctx, req)
|
return run(ctx, req)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user