Skip to content

fix(security): 2 improvements across 1 files - #9658

Open
tomaioo wants to merge 1 commit into
mozilla:mainfrom
tomaioo:fix/security/sql-injection-via-string-formatting-in-b
Open

fix(security): 2 improvements across 1 files#9658
tomaioo wants to merge 1 commit into
mozilla:mainfrom
tomaioo:fix/security/sql-injection-via-string-formatting-in-b

Conversation

@tomaioo

@tomaioo tomaioo commented Jun 30, 2026

Copy link
Copy Markdown

Summary

fix(security): 2 improvements across 1 files

Problem

Severity: High | File: sql/moz-fx-data-marketing-prod/iprospect/adspend_v1/query.py:L42

Multiple files construct SQL queries using Python f-strings with user-provided or variable inputs, creating SQL injection vulnerabilities. In sql/moz-fx-data-marketing-prod/iprospect/adspend_v1/query.py, the args.date parameter is directly interpolated into SQL. In bigquery_etl/public_data/publish_public_data_views.py, table names are split and used in view SQL. In bigquery_etl/glam/client_side_sampled_metrics.py, metric_types, app_name, channel, and os are interpolated into SQL without parameterization.

Solution

Use BigQuery query parameters (ScalarQueryParameter) instead of string interpolation. For table names/identifiers that cannot be parameterized, implement strict validation against allowed patterns before interpolation.

Changes

  • sql/moz-fx-data-marketing-prod/iprospect/adspend_v1/query.py (modified)

- Security: SQL Injection via String Formatting in BigQuery Queries
- Security: SQL Injection via String Formatting in BigQuery Query (adspend_v1)

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant