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:
elky
2026-09-04 03:45:52 +08:00
parent ddcbeb3ae9
commit 579f2c7cc1
1019 changed files with 190437 additions and 26080 deletions
+41 -1
View File
@@ -2,7 +2,9 @@ use axum::http::Uri;
use crate::{AppState, GatewayError};
use super::{resolve_control_route, GatewayControlDecision};
use super::{
resolve_control_route, route::resolve_control_route_with_trusted_auth, GatewayControlDecision,
};
pub(crate) type GatewayPublicRequestContext =
aether_gateway_control::PublicRequestContext<GatewayControlDecision>;
@@ -23,3 +25,41 @@ pub(crate) async fn resolve_public_request_context(
control_decision,
))
}
pub(crate) async fn resolve_public_request_context_with_trusted_auth(
state: &AppState,
method: &http::Method,
uri: &Uri,
headers: &http::HeaderMap,
trace_id: &str,
) -> Result<GatewayPublicRequestContext, GatewayError> {
let control_decision =
resolve_control_route_with_trusted_auth(state, method, uri, headers, trace_id, true)
.await?;
Ok(GatewayPublicRequestContext::from_request_parts(
trace_id,
method,
uri,
headers,
control_decision,
))
}
pub(crate) async fn resolve_public_request_context_without_trusted_auth(
state: &AppState,
method: &http::Method,
uri: &Uri,
headers: &http::HeaderMap,
trace_id: &str,
) -> Result<GatewayPublicRequestContext, GatewayError> {
let control_decision =
resolve_control_route_with_trusted_auth(state, method, uri, headers, trace_id, false)
.await?;
Ok(GatewayPublicRequestContext::from_request_parts(
trace_id,
method,
uri,
headers,
control_decision,
))
}