Skip to main content

What are Query Parameters?

Query parameters are key-value pairs that appear after the ? in a URL. They send additional data to the server without being part of the main path.
MDN Web DocsRead more on URL query parameters.

Understanding Query Parameter Structure

Breaking this down:
  • category = shoes
  • size = 10
  • color = black

Common Query Parameter Uses

Search & Filtering

  • ?q=search+term - Search queries
  • ?sort=price - Sorting options
  • ?filter=available - Filtering results
  • ?page=2 - Pagination

Tracking & Analytics

  • ?utm_source=email - Marketing attribution
  • ?ref=homepage - Referral tracking
  • ?session=abc123 - Session tracking

API Parameters

  • ?api_key=xxx - Authentication (not recommended!)
  • ?format=json - Response format
  • ?limit=100 - Result limits
  • ?fields=id,name - Field selection

Application Control

  • ?debug=true - Debug mode (dangerous in production!)
  • ?redirect=/dashboard - Post-login redirects
  • ?action=delete - Action specification

Using Query Parameters in Policies

Basic Examples

Block debug parameters in production:
Monitor high-value searches:

Advanced Patterns

Detect SQL injection attempts:
Rate limit search API:
Security AlertNever put sensitive data like passwords or API keys in query parameters - they appear in logs, browser history, and can be leaked through referrer headers!

Query Parameter Operators

Security Considerations

Dangerous Query Parameters

Common Attack Patterns

Open Redirect Detection:
Path Traversal Prevention:

Best Practices

DO:

  • Validate parameter values - Check for expected formats and ranges
  • Monitor unusual parameters - Unknown parameters might indicate probing
  • Limit parameter sizes - Extremely long values can cause issues
  • Encode special characters - Prevent injection attacks
  • Track parameter combinations - Certain combos might indicate attacks

DON’T:

  • Trust user input - Always validate query parameters
  • Expose internal parameters - Hide debug/admin params in production
  • Use for sensitive data - Passwords, tokens shouldn’t be in URLs
  • Ignore encoding - URL encoding can hide malicious content
  • Allow unlimited values - Set reasonable limits

Working with Multiple Parameters

Often you need to check multiple parameters together:

URL Encoding Gotchas

Encoding AwarenessQuery parameters are URL encoded:
  • Space becomes + or %20
  • & becomes %26
  • = becomes %3D
Your policies should account for both encoded and decoded values.

Real-World Scenarios

E-commerce Protection

API Rate Limiting

Search Protection

Troubleshooting

“My query parameter policy isn’t matching”
  • Check URL encoding (spaces, special chars)
  • Verify parameter name exactly
  • Multiple values might use arrays (tag[]=a&tag[]=b)
  • Some frameworks modify parameter names
“False positives with legitimate traffic”
  • Your pattern might be too broad
  • Consider parameter context (same param, different endpoints)
  • URL encoding might cause unexpected matches
  • Use monitoring before blocking

Integration Examples

With Other Fields

  • Request Path - Parameters extend path functionality
  • Headers - Some apps send params in headers too
  • Body Data - POST requests might use body instead
  • Cookies - Session data alternative to URL params