mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 18:37:46 +08:00
fix: restore security hardening compatibility and validation
Restore authorized rule reveal, explicit full HTTP capture and retention, video task business fields, and valid payment URLs. Add opt-in credential preservation for trusted recovery, fix frontend type contracts and async races, and eliminate PostgreSQL test fixture resource leaks. Document audit coverage and successful fmt and CI-scoped Clippy checks.
This commit is contained in:
@@ -496,6 +496,7 @@ fn access_for_route(method: &http::Method, decision: &GatewayControlDecision) ->
|
||||
Some("admin:endpoints_manage"),
|
||||
Some(
|
||||
"reveal_key"
|
||||
| "reveal_endpoint_rules"
|
||||
| "export_key"
|
||||
| "create_provider_key"
|
||||
| "update_key"
|
||||
@@ -1490,6 +1491,12 @@ mod tests {
|
||||
fn plaintext_credential_reads_require_admin_permission() {
|
||||
let read_only_permissions = read_only_management_token_permissions();
|
||||
let cases = [
|
||||
(
|
||||
"admin:endpoints_manage",
|
||||
"reveal_endpoint_rules",
|
||||
None,
|
||||
"admin:endpoints_manage:admin",
|
||||
),
|
||||
(
|
||||
"admin:endpoints_manage",
|
||||
"reveal_key",
|
||||
|
||||
@@ -302,6 +302,19 @@ pub(super) fn classify_admin_endpoints_family_route(
|
||||
"admin:endpoints_manage",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET
|
||||
&& normalized_path
|
||||
.strip_prefix("/api/admin/endpoints/")
|
||||
.and_then(|path| path.strip_suffix("/rules/reveal"))
|
||||
.is_some_and(|endpoint_id| !endpoint_id.is_empty() && !endpoint_id.contains('/'))
|
||||
{
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"endpoints_manage",
|
||||
"reveal_endpoint_rules",
|
||||
"admin:endpoints_manage",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET
|
||||
&& normalized_path.starts_with("/api/admin/endpoints/")
|
||||
&& !normalized_path.starts_with("/api/admin/endpoints/health/")
|
||||
|
||||
@@ -381,6 +381,28 @@ fn classifies_admin_get_endpoint_as_admin_proxy_route() {
|
||||
assert!(!decision.is_execution_runtime_candidate());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn classifies_admin_reveal_endpoint_rules_as_admin_proxy_route() {
|
||||
let headers = headers(&[]);
|
||||
let uri: Uri = "/api/admin/endpoints/endpoint-1/rules/reveal"
|
||||
.parse()
|
||||
.expect("uri should parse");
|
||||
let decision =
|
||||
classify_control_route(&http::Method::GET, &uri, &headers).expect("route should classify");
|
||||
|
||||
assert_eq!(decision.route_class.as_deref(), Some("admin_proxy"));
|
||||
assert_eq!(decision.route_family.as_deref(), Some("endpoints_manage"));
|
||||
assert_eq!(
|
||||
decision.route_kind.as_deref(),
|
||||
Some("reveal_endpoint_rules")
|
||||
);
|
||||
assert_eq!(
|
||||
decision.auth_endpoint_signature.as_deref(),
|
||||
Some("admin:endpoints_manage")
|
||||
);
|
||||
assert!(!decision.is_execution_runtime_candidate());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn classifies_admin_create_endpoint_as_admin_proxy_route() {
|
||||
let headers = http::HeaderMap::new();
|
||||
|
||||
Reference in New Issue
Block a user