mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 18:07:47 +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:
@@ -38,7 +38,7 @@ impl OAuthTimeouts {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub struct OAuthNetworkContext {
|
||||
pub policy: OAuthNetworkPolicy,
|
||||
pub requirement: NetworkRequirement,
|
||||
@@ -46,6 +46,18 @@ pub struct OAuthNetworkContext {
|
||||
pub timeouts: OAuthTimeouts,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for OAuthNetworkContext {
|
||||
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
formatter
|
||||
.debug_struct("OAuthNetworkContext")
|
||||
.field("policy", &self.policy)
|
||||
.field("requirement", &self.requirement)
|
||||
.field("has_proxy", &self.proxy.is_some())
|
||||
.field("timeouts", &self.timeouts)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl OAuthNetworkContext {
|
||||
pub fn direct_identity() -> Self {
|
||||
Self {
|
||||
@@ -70,3 +82,24 @@ impl OAuthNetworkContext {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::OAuthNetworkContext;
|
||||
use aether_contracts::ProxySnapshot;
|
||||
|
||||
#[test]
|
||||
fn network_context_debug_output_does_not_expose_proxy_credentials() {
|
||||
let context = OAuthNetworkContext::provider_operation(Some(ProxySnapshot {
|
||||
url: Some("http://proxy-user:[email protected]:8080".to_string()),
|
||||
extra: Some(serde_json::json!({"authorization": "proxy-extra-canary"})),
|
||||
..ProxySnapshot::default()
|
||||
}));
|
||||
|
||||
let debug = format!("{context:?}");
|
||||
assert!(!debug.contains("proxy-user"));
|
||||
assert!(!debug.contains("proxy-password"));
|
||||
assert!(!debug.contains("proxy-extra-canary"));
|
||||
assert!(debug.contains("has_proxy: true"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user