mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 18:59:50 +08:00
feat(security): harden gateway boundaries and usage policies
Consolidate subscription usage policy enforcement, privacy-safe persistence, and gateway security hardening into one reviewable change. Includes bounded HTTP and execution envelopes, header and protocol guards, DNS and relay validation, authentication and secret projection hardening, secure backup/install paths, and regression coverage.
This commit is contained in:
@@ -57,8 +57,8 @@ fn rust_authoritative_service_projects_openai_status_into_local_read_response()
|
||||
"progress": 100,
|
||||
"completed_at": 1712345688u64,
|
||||
"error": {
|
||||
"code": "upstream_failed",
|
||||
"message": "provider failed"
|
||||
"code": "Bearer code-secret",
|
||||
"message": "request failed at https://internal.test/result?token=message-secret"
|
||||
}
|
||||
})
|
||||
.as_object()
|
||||
@@ -79,8 +79,14 @@ fn rust_authoritative_service_projects_openai_status_into_local_read_response()
|
||||
.get("error")
|
||||
.and_then(Value::as_object)
|
||||
.and_then(|value| value.get("code")),
|
||||
Some(&json!("upstream_failed"))
|
||||
Some(&json!("provider_error"))
|
||||
);
|
||||
assert_eq!(
|
||||
failed.body_json["error"]["message"],
|
||||
"Video generation failed"
|
||||
);
|
||||
assert!(!failed.body_json.to_string().contains("code-secret"));
|
||||
assert!(!failed.body_json.to_string().contains("message-secret"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -125,6 +131,28 @@ fn rust_authoritative_service_builds_openai_content_stream_plan_from_direct_vide
|
||||
"https://cdn.example.com/ext-video-task-123.mp4"
|
||||
);
|
||||
assert!(plan.headers.is_empty());
|
||||
|
||||
assert!(service
|
||||
.prepare_openai_content_stream_action_for_user(
|
||||
"/v1/videos/task-local-123/content",
|
||||
Some("variant=video"),
|
||||
"trace-foreign-content-123",
|
||||
"user-foreign",
|
||||
)
|
||||
.is_none());
|
||||
|
||||
let owner_action = service
|
||||
.prepare_openai_content_stream_action_for_user(
|
||||
"/v1/videos/task-local-123/content",
|
||||
Some("variant=video"),
|
||||
"trace-owner-content-123",
|
||||
"user-123",
|
||||
)
|
||||
.expect("owner content action should exist");
|
||||
assert!(matches!(
|
||||
owner_action,
|
||||
LocalVideoTaskContentAction::StreamPlan(_)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -197,7 +225,9 @@ fn rust_authoritative_service_projects_gemini_status_into_local_read_response()
|
||||
json!({
|
||||
"done": false,
|
||||
"metadata": {
|
||||
"state": "PROCESSING"
|
||||
"state": "PROCESSING",
|
||||
"authorization": "Bearer metadata-secret",
|
||||
"debug_url": "https://internal.test/status?token=query-secret"
|
||||
}
|
||||
})
|
||||
.as_object()
|
||||
@@ -211,10 +241,9 @@ fn rust_authoritative_service_projects_gemini_status_into_local_read_response()
|
||||
.expect("processing read response should exist");
|
||||
assert_eq!(processing.status_code, 200);
|
||||
assert_eq!(processing.body_json.get("done"), Some(&json!(false)));
|
||||
assert_eq!(
|
||||
processing.body_json.get("metadata"),
|
||||
Some(&json!({"state": "PROCESSING"}))
|
||||
);
|
||||
assert_eq!(processing.body_json.get("metadata"), Some(&json!({})));
|
||||
assert!(!processing.body_json.to_string().contains("metadata-secret"));
|
||||
assert!(!processing.body_json.to_string().contains("query-secret"));
|
||||
|
||||
assert!(service.project_gemini_task_response(
|
||||
"localshort123",
|
||||
|
||||
Reference in New Issue
Block a user