For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/static_analysis/static_analysis_rules/dart-security/sensitive-data-in-url.md. A documentation index is available at /llms.txt.

Avoid sensitive data in URL query parameters

This product is not supported for your selected Datadog site. ().

Metadata

ID: dart-security/sensitive-data-in-url

Language: Dart

Severity: Warning

Category: Security

CWE: 598

Description

Placing credentials such as passwords, API keys, or client secrets in URL query parameters exposes them in server logs, browser history, referrer headers, and network monitoring. Pass credentials in a POST body or an Authorization header instead of the query string.

Non-Compliant Code Examples

void main() {
  final login = 'https://api.example.com/login?password=hunter2';
  final upper = 'https://api.example.com/login?PASSWORD=hunter2';
  final apiKey = 'https://example.com/v1?api_key=secretkey';
  final clientSecret = 'https://example.com/oauth?client_secret=s3cr3t';
}

Compliant Code Examples

void main() {
  // No sensitive parameter
  final url = 'https://api.example.com/users?page=1&sort=name';
  final resetPath = 'https://example.com/account/reset-password';
  final search = 'https://example.com/search?q=token';

  // Token parameters are intentionally out of scope (magic links, OAuth)
  final magic = 'https://app.example.com/login?token=abc123';
  final oauth = 'https://app.example.com/oauth?access_token=xyz&state=1';

  // Interpolated / templated values are not hardcoded secrets
  final template = 'https://api.example.com/v1?api_key={apiKey}';
  final interpolated = 'https://api.example.com/v1?password=$password';
}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Security