CI / Rust Checks (pull_request) Failing after 13m41s
CI / UI Checks (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Deploy (pull_request) Skipped
Community Release / release (push) Failing after 13m33s
Recovery delivery of the accumulated, TL-accepted Epic 3 work that had never been
committed to Git (stories 3.6-3.17, see the crank board). Story 3.18 is not accepted
yet and is deliberately excluded: its logging surface, its capability registration,
its oracle projections and its tests are not part of this tree.
Accepted scope
- 3.6 typed static Resource Drafts; 3.7 publication and exact binding of static
Resource Versions; 3.8 MCP discovery/read and revocation of static Resources;
- 3.9 Resource import/export in API and UI plus TLS dependency maintenance;
3.10 REST-backed Resource templates; 3.11 shared REST read runtime and the MCP
revision/capability foundation;
- 3.12 parameterised Prompt Drafts with preview; 3.13 Prompt publication and exact
version binding to Agents; 3.14 MCP prompts; 3.15 Prompt import/export;
- 3.16 composite Prompts with published Resources (dependency content scan plus
dynamic read through the accepted 3.11 runtime, admin preview and MCP prompts/get);
- 3.17 bounded MCP completion suggestions from typed published schemas and the
resources/list admission fix for bound template publications.
Accepted evidence being reused (unchanged code paths)
- 3.16 candidate: core 7, admin-api 22, registry 4, mcp-server 4, UI 6; one final
`just verify` run 1651 passed / 0 failed / 2 ignored.
- 3.17 candidate: full run 1672 passed / 0 failed / 2 ignored, QA targeted reruns and
a real MCP Inspector 2.12.0 client smoke.
Delivery engineering in this commit
- CI: one event per change (feature branches are gated by their pull request, push
runs only on main), story events run the changed packages, the full workspace suite
stays the feature/release gate; no cache/sharding without a measured runner check.
- Release: the packaged archives, checksums and SBOM are now uploaded to the Gitea
release entry of the tag instead of dying with the runner workspace.
Not included on purpose: Story 3.18 work, build caches, runtime databases, local
credentials and scratch evidence.
Refs: crank kanban t_e39d7263; baseline 1b6db09bd1.
158 lines
6.0 KiB
Rust
158 lines
6.0 KiB
Rust
//! Story 3.8 / AT-3.8-05: a revoked Resource is denied on both supported revisions, and the
|
|
//! denial telemetry carries the correlation identity but never the Resource URI/name/MIME/digest
|
|
//! or any content. The positive control proves the capture sink really records an allowed read.
|
|
//!
|
|
//! The tombstone is written with SQL into the same real schema the endpoint reads (the Admin revoke
|
|
//! path is exercised by `admin-api`); everything else here is the unchanged production MCP path.
|
|
|
|
use serde_json::json;
|
|
|
|
use super::fixtures::*;
|
|
|
|
async fn seed_tombstone(endpoint: &ResourceEndpoint) {
|
|
sqlx::query(
|
|
"insert into resource_security_revocations (
|
|
workspace_id, resource_id, revoked_at, actor_user_id, request_id, trace_id
|
|
) values ('ws_default', $1, now(), 'user_default_owner', 'story38-fixture', 'story38-fixture')",
|
|
)
|
|
.bind(endpoint.text.id.as_str())
|
|
.execute(endpoint.registry.pool())
|
|
.await
|
|
.expect("the fixture tombstone must be written into the live schema");
|
|
}
|
|
|
|
/// The revoked read is denied on both revisions; the captured telemetry keeps the Request ID and
|
|
/// the safe outcome only, while the allowed read is captured as a successful outcome.
|
|
#[tokio::test]
|
|
async fn story38_revoked_read_and_list_telemetry_are_content_free_on_both_revisions() {
|
|
let endpoint = standard_endpoint("revocation_telemetry").await;
|
|
let canary = String::from_utf8(endpoint.text.bytes.clone()).expect("text fixture is UTF-8");
|
|
seed_tombstone(&endpoint).await;
|
|
|
|
let denied_logs = CapturedLogs::default();
|
|
let mut denied_bodies = Vec::new();
|
|
{
|
|
let _capture = denied_logs.install();
|
|
for revision in supported_revisions() {
|
|
let response = read_resource(
|
|
&endpoint,
|
|
&revision,
|
|
&endpoint.text.uri,
|
|
Some("story38-denied-corr"),
|
|
)
|
|
.await;
|
|
denied_bodies.push((revision.clone(), json_body(response).await));
|
|
}
|
|
// The page must keep the other bound Resources while omitting the revoked one.
|
|
for revision in supported_revisions() {
|
|
let listed = json_body(list_resources(&endpoint, &revision, json!({})).await).await;
|
|
let uris = listed["result"]["resources"]
|
|
.as_array()
|
|
.expect("resources/list must still return a page")
|
|
.iter()
|
|
.map(|resource| resource["uri"].as_str().unwrap_or_default().to_owned())
|
|
.collect::<Vec<_>>();
|
|
assert!(
|
|
!uris.contains(&endpoint.text.uri),
|
|
"{revision}: a revoked Resource must disappear from list: {uris:?}"
|
|
);
|
|
assert!(
|
|
uris.contains(&endpoint.json.uri),
|
|
"{revision}: the control Resource must stay listed: {uris:?}"
|
|
);
|
|
let text = listed.to_string();
|
|
assert!(
|
|
!text.contains(&endpoint.text.name),
|
|
"{revision}: no revoked metadata may be listed: {text}"
|
|
);
|
|
}
|
|
}
|
|
|
|
for (revision, body) in denied_bodies {
|
|
assert!(
|
|
body.get("result").is_none(),
|
|
"{revision}: a revoked read must not return content: {body}"
|
|
);
|
|
assert_eq!(
|
|
body["error"]["code"].as_i64(),
|
|
Some(-32602),
|
|
"{revision}: the pinned safe NotAvailable code must be reused: {body}"
|
|
);
|
|
assert_eq!(
|
|
body["error"]["message"].as_str(),
|
|
Some("the requested resource is not available"),
|
|
"{revision}: the pinned safe NotAvailable message must be reused: {body}"
|
|
);
|
|
let text = body.to_string();
|
|
for leak in [
|
|
canary.trim(),
|
|
&endpoint.text.name,
|
|
&endpoint.text.uri,
|
|
"text/plain",
|
|
] {
|
|
assert!(
|
|
!text.contains(leak),
|
|
"{revision}: the denial must not disclose Resource data ({leak}): {body}"
|
|
);
|
|
}
|
|
}
|
|
|
|
let captured = denied_logs.output();
|
|
assert!(
|
|
captured.contains("story38-denied-corr"),
|
|
"the denied read telemetry must keep the Request ID, captured: {captured}"
|
|
);
|
|
assert!(
|
|
captured.contains("resource read outcome") && captured.contains("outcome=\"denied\""),
|
|
"the denied read must record a safe denied outcome, captured: {captured}"
|
|
);
|
|
assert!(
|
|
captured.contains("resource list page omitted revoked resources")
|
|
&& captured.contains("outcome=\"filtered\"")
|
|
&& captured.contains("revoked_omitted=1"),
|
|
"the list page must record that one revoked entry was omitted, captured: {captured}"
|
|
);
|
|
for leak in [
|
|
canary.trim(),
|
|
endpoint.text.name.as_str(),
|
|
endpoint.text.uri.as_str(),
|
|
"text/plain",
|
|
] {
|
|
assert!(
|
|
!captured.contains(leak),
|
|
"the denial telemetry must not capture Resource data ({leak}), captured: {captured}"
|
|
);
|
|
}
|
|
|
|
// Positive control: the same sink records an allowed read as a successful outcome.
|
|
let allowed_logs = CapturedLogs::default();
|
|
let allowed = {
|
|
let _capture = allowed_logs.install();
|
|
json_body(
|
|
read_resource(
|
|
&endpoint,
|
|
MODERN_REVISION,
|
|
&endpoint.json.uri,
|
|
Some("story38-allowed-corr"),
|
|
)
|
|
.await,
|
|
)
|
|
.await
|
|
};
|
|
assert!(
|
|
allowed.get("result").is_some(),
|
|
"the control Resource must stay readable: {allowed}"
|
|
);
|
|
let allowed_captured = allowed_logs.output();
|
|
assert!(
|
|
allowed_captured.contains("story38-allowed-corr")
|
|
&& allowed_captured.contains("outcome=\"ok\"")
|
|
&& allowed_captured.contains("content_bytes="),
|
|
"the same sink must capture an allowed read outcome, captured: {allowed_captured}"
|
|
);
|
|
assert!(
|
|
!allowed_captured.contains(endpoint.text.uri.as_str()),
|
|
"an allowed read telemetry must not capture the URI either, captured: {allowed_captured}"
|
|
);
|
|
}
|