Skip to content

feat: send WAF bypass header when env var is set - #123

Merged
toufali merged 3 commits into
mainfrom
FXA-13608
May 1, 2026
Merged

toufali merged 3 commits into
mainfrom
FXA-13608

Conversation

@MagentaManifold

@MagentaManifold MagentaManifold commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Because:

  • we need a way to send WAF header to bypass rate limiting in CI environments.

This commit:

  • sends fxa-ci=CI_WAF_TOKEN in header

Closes FXA-13608

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for injecting a CI-specific WAF bypass header into all APIClient requests when CI_WAF_TOKEN is present in the environment, to help avoid rate-limiting in CI (FXA-13608).

Changes:

  • Injects fxa-ci: <CI_WAF_TOKEN> into the underlying requests.Session headers during APIClient initialization.
  • Adds unit tests validating that the header is present/absent depending on the environment variable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
fxa/_utils.py Injects the fxa-ci header into APIClient when CI_WAF_TOKEN is set.
fxa/tests/test_core.py Adds TestAPIClientWAFHeader to verify the env-var-driven header behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fxa/_utils.py Outdated
Comment thread fxa/tests/test_core.py Outdated
Because:

* we need a way to send WAF header to bypass rate limiting in CI environments.

This commit:

* sends fxa-ci=CI_WAF_TOKEN in header

Closes FXA-13608

@toufali toufali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good!

I read copilot's notes and actually preferred the other suggestion -- mutating the session if env var is present and var not already set. Majority of cases will want this, and we added safe-guards.

I also added a bypass for the unrelated failing live-server tests as discussed in mtg -- likely a result of feature drift or lack of maintenance on this repo.

@toufali
toufali merged commit 07292af into main May 1, 2026
6 checks passed
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.

3 participants