pub fn encode_query_param(value: &str) -> StringExpand description
Encodes a query parameter value for safe use in URLs.
This function prevents query parameter injection attacks by properly URL-encoding special characters that could be used to inject additional parameters or manipulate the query string.
§Security
This function prevents injection attacks like:
"foo&admin=true"→"foo%26admin%3Dtrue""test;rm -rf /"→"test%3Brm%20-rf%20%2F"
§Examples
use veracode_platform::validation::encode_query_param;
// Normal values pass through unchanged
assert_eq!(encode_query_param("MyApp"), "MyApp");
// Special characters are encoded
assert_eq!(encode_query_param("foo&bar"), "foo%26bar");
assert_eq!(encode_query_param("key=value"), "key%3Dvalue");
assert_eq!(encode_query_param("test;command"), "test%3Bcommand");