mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-05 08:57:46 +08:00
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.
66 lines
1.8 KiB
Rust
66 lines
1.8 KiB
Rust
use axum::http::Uri;
|
|
|
|
use crate::{AppState, GatewayError};
|
|
|
|
use super::{
|
|
resolve_control_route, route::resolve_control_route_with_trusted_auth, GatewayControlDecision,
|
|
};
|
|
|
|
pub(crate) type GatewayPublicRequestContext =
|
|
aether_gateway_control::PublicRequestContext<GatewayControlDecision>;
|
|
|
|
pub(crate) async fn resolve_public_request_context(
|
|
state: &AppState,
|
|
method: &http::Method,
|
|
uri: &Uri,
|
|
headers: &http::HeaderMap,
|
|
trace_id: &str,
|
|
) -> Result<GatewayPublicRequestContext, GatewayError> {
|
|
let control_decision = resolve_control_route(state, method, uri, headers, trace_id).await?;
|
|
Ok(GatewayPublicRequestContext::from_request_parts(
|
|
trace_id,
|
|
method,
|
|
uri,
|
|
headers,
|
|
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,
|
|
))
|
|
}
|