{"record":{"id":"5ce1f649e4e32a88","repo":"epi052/feroxbuster","slug":"empty-query-string-provided","errorCode":null,"errorMessage":"Empty query string provided","messagePattern":"Empty query string provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/utils.rs","lineNumber":269,"sourceCode":"/// malformed (e.g., empty or without a key), it returns an error.\n///\n/// # Arguments\n///\n/// * `query` - A string slice that holds the query string to be split.\n///\n/// # Returns\n///\n/// * `Result<(String, String)>` - A tuple containing the key and value as `String`s,\n///   or an error if the input is invalid.\n///\n/// # Errors\n///\n/// This function will return an error if:\n/// * The input string is empty or equal to `\"=\"`.\n/// * The key part of the query string is empty (i.e., if the string starts with `\"=\"`).\npub fn split_query(query: &str) -> Result<(String, String)> {\n    if query.is_empty() || query == \"=\" {\n        bail!(\"Empty query string provided\");\n    }\n\n    let mut split_val = query.split('=');\n\n    let name = split_val.next().unwrap().trim();\n\n    if name.is_empty() {\n        bail!(\"Empty key in query string\");\n    }\n\n    let value = split_val.collect::<Vec<&str>>().join(\"=\");\n\n    Ok((name.to_string(), value.to_string()))\n}\n\n/// Splits an HTTP header string into a key-value pair.\n///\n/// This function takes a header string in the format of `\"Key: Value\"` and splits it into","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/epi052/feroxbuster/blob/1f595dab5c76858d5a14fbc47dabf2563d729c62/src/config/utils.rs#L251-L287","documentation":"split_query parses a `key=value` query string into a tuple and rejects inputs that carry no key/value information at all. It throws when the input string is empty or is exactly `\"=\"`, because no query parameter can be derived from it. This is an eager argument-validation guard at the entry of the function.","triggerScenarios":"Calling split_query(\"\") or split_query(\"=\") directly; passing an empty or `=`-only `-q/--query` CLI argument; a request file containing an empty query line entry.","commonSituations":"Users quoting CLI args so an empty string reaches the parser (`-q \"\"`), shell variables that expand to nothing (`-q \"$QUERY\"` with QUERY unset), or scripts generating `=` placeholders for unfilled parameters.","solutions":["Remove the empty/`=`-only query argument from the CLI invocation or request file","Ensure shell variables used in `-q \"$VAR\"` are set and non-empty before running","Filter out empty query strings before collecting them into a list passed to the config parser"],"exampleFix":"// before\nlet queries: Vec<String> = raw_queries; // may contain \"\"\n// after\nlet queries: Vec<String> = raw_queries.into_iter().filter(|q| !q.is_empty() && *q != \"=\").collect();","handlingStrategy":"validation","validationCode":"let queries: Vec<&str> = raw.iter().map(|s| s.as_str()).filter(|q| !q.is_empty() && *q != \"=\").collect();","typeGuard":null,"tryCatchPattern":"match split_query(q) {\n    Ok((k, v)) => insert_query(k, v),\n    Err(e) => eprintln!(\"skipping invalid query '{q}': {e}\"),\n}","preventionTips":["Quote CLI arguments carefully so `-q` never receives an empty string","Check that shell variables interpolated into query args are non-empty","Filter empty and '=' placeholders out of dynamically built query lists"],"tags":["cli","query-string","validation","rust"],"backgroundTag":"empty-required-field","analyzedSha":"1f595dab5c76858d5a14fbc47dabf2563d729c62","analyzedAt":"2026-09-13T19:33:06.208Z","contentChangedAt":"2026-09-13T19:33:06.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}