Add masking shape classifier and guard tests for adversarial resistance

- Implemented tests for masking shape classifier resistance against threshold attacks, ensuring that blurring reduces accuracy and increases overlap between classes.
- Added tests for masking shape guard functionality, verifying that it maintains expected behavior under various conditions, including timeout paths and clean EOF scenarios.
- Introduced helper functions for calculating accuracy and handling timing samples to support the new tests.
- Ensured that the masking shape hardening configuration is properly utilized in tests to validate its effectiveness.
This commit is contained in:
David Osipov
2026-03-21 12:43:25 +04:00
parent f2335c211c
commit 8188fedf6a
7 changed files with 1170 additions and 38 deletions

View File

@@ -95,6 +95,7 @@ async fn capture_forwarded_len(body_sent: usize) -> usize {
cfg.censorship.mask_unix_sock = None;
cfg.censorship.mask_host = Some("127.0.0.1".to_string());
cfg.censorship.mask_port = backend_addr.port();
cfg.censorship.mask_shape_hardening = false;
cfg.timeouts.client_handshake = 1;
let accept_task = tokio::spawn(async move {