mirror of
https://github.com/sol1/rustguac.git
synced 2026-09-11 13:50:14 +00:00
54c1d5be17
- Fix open redirect via protocol-relative URLs (//evil.com) in OIDC next parameter - Add Secure flag to all cookie-clearing Set-Cookie headers - Add single-quote escaping to html_escape() (defence-in-depth) - Cross-check OIDC state cookie against state query parameter in callback - Switch API key and user token validation to constant-time hash comparison (subtle) - Add 3 new fuzz targets: api_input, vault_response, websocket_message - Bump version to 0.3.3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
103 lines
2.6 KiB
Rust
103 lines
2.6 KiB
Rust
#![no_main]
|
|
#![allow(dead_code)]
|
|
use libfuzzer_sys::fuzz_target;
|
|
use serde::Deserialize;
|
|
|
|
/// Mirror of session::CreateSessionRequest for fuzz testing.
|
|
#[derive(Deserialize)]
|
|
struct CreateSessionRequest {
|
|
#[serde(default)]
|
|
session_type: Option<String>,
|
|
hostname: Option<String>,
|
|
port: Option<u16>,
|
|
username: Option<String>,
|
|
password: Option<String>,
|
|
private_key: Option<String>,
|
|
generate_keypair: Option<bool>,
|
|
url: Option<String>,
|
|
domain: Option<String>,
|
|
security: Option<String>,
|
|
ignore_cert: Option<bool>,
|
|
auth_pkg: Option<String>,
|
|
kdc_url: Option<String>,
|
|
kerberos_cache: Option<String>,
|
|
color_depth: Option<u8>,
|
|
jump_hosts: Option<Vec<JumpHost>>,
|
|
jump_host: Option<String>,
|
|
jump_port: Option<u16>,
|
|
jump_username: Option<String>,
|
|
jump_password: Option<String>,
|
|
jump_private_key: Option<String>,
|
|
width: Option<u32>,
|
|
height: Option<u32>,
|
|
dpi: Option<u32>,
|
|
banner: Option<String>,
|
|
enable_drive: Option<bool>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
struct JumpHost {
|
|
hostname: String,
|
|
#[serde(default)]
|
|
port: u16,
|
|
username: String,
|
|
password: Option<String>,
|
|
private_key: Option<String>,
|
|
}
|
|
|
|
/// Mirror of api::ConnectRequest.
|
|
#[derive(Deserialize)]
|
|
struct ConnectRequest {
|
|
#[serde(default)]
|
|
width: Option<u32>,
|
|
#[serde(default)]
|
|
height: Option<u32>,
|
|
#[serde(default)]
|
|
dpi: Option<u32>,
|
|
#[serde(default)]
|
|
banner: Option<String>,
|
|
#[serde(default)]
|
|
username: Option<String>,
|
|
#[serde(default)]
|
|
password: Option<String>,
|
|
#[serde(default)]
|
|
domain: Option<String>,
|
|
}
|
|
|
|
/// Mirror of api::CreateEntryRequest.
|
|
#[derive(Deserialize)]
|
|
struct CreateEntryRequest {
|
|
name: String,
|
|
#[serde(flatten)]
|
|
entry: AddressBookEntry,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
struct AddressBookEntry {
|
|
#[serde(rename = "type")]
|
|
session_type: String,
|
|
hostname: Option<String>,
|
|
port: Option<u16>,
|
|
username: Option<String>,
|
|
password: Option<String>,
|
|
private_key: Option<String>,
|
|
url: Option<String>,
|
|
domain: Option<String>,
|
|
security: Option<String>,
|
|
ignore_cert: Option<bool>,
|
|
display_name: Option<String>,
|
|
enable_drive: Option<bool>,
|
|
auth_pkg: Option<String>,
|
|
kdc_url: Option<String>,
|
|
prompt_credentials: Option<bool>,
|
|
color_depth: Option<u8>,
|
|
jump_hosts: Option<Vec<JumpHost>>,
|
|
}
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
// Fuzz JSON deserialization of all API request types
|
|
let _ = serde_json::from_slice::<CreateSessionRequest>(data);
|
|
let _ = serde_json::from_slice::<ConnectRequest>(data);
|
|
let _ = serde_json::from_slice::<CreateEntryRequest>(data);
|
|
});
|