Skip to content

feat(firestore): add Settings.headers to attach custom request headers - #307

Open
demolaf wants to merge 10 commits into
mainfrom
firestore/settings-headers
Open

feat(firestore): add Settings.headers to attach custom request headers#307
demolaf wants to merge 10 commits into
mainfrom
firestore/settings-headers

Conversation

@demolaf

@demolaf demolaf commented Jul 23, 2026

Copy link
Copy Markdown
Member

Adds Settings.headers so callers can attach custom HTTP headers (usage-tracking, tracing, etc.) to every outgoing Firestore request without supplying a full custom HTTP client. FirestoreHttpClient wraps its authenticated client in a new FirestoreRequestClient whenever headers are set.

Needed by #308, which uses this to tag Admin-SDK-originated Firestore traffic.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Settings.headers configuration option to allow users to attach custom HTTP headers to outgoing Firestore requests. This is implemented via a new FirestoreRequestClient wrapper that appends these headers to each request. The reviewer recommended updating the operator == and hashCode overrides in the Settings class to include the new headers and existing environmentOverride fields. Additionally, it was suggested to wrap the headers in Map.unmodifiable when initializing FirestoreRequestClient to prevent external modifications.

Comment thread packages/google_cloud_firestore/lib/src/firestore.dart
Comment thread packages/google_cloud_firestore/lib/src/firestore_http_client.dart Outdated
@demolaf
demolaf changed the base branch from main to fix/ci-codecov-action-allowlist July 23, 2026 22:45
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Coverage Report

✅ Coverage 75.53% meets 40% threshold

Total Coverage: 75.53%
Lines Covered: 5228/6922

Package Breakdown

Package Coverage
firebase_admin_sdk 72.72%
google_cloud_firestore 78.69%

Minimum threshold: 40%

@demolaf
demolaf marked this pull request as ready for review July 24, 2026 12:03
@demolaf
demolaf requested a review from brianquinlan July 24, 2026 12:06
@demolaf
demolaf changed the base branch from fix/ci-codecov-action-allowlist to main July 24, 2026 12:06
@demolaf
demolaf requested a review from Lyokone July 27, 2026 11:55
* fix(admin): attach usage-tracking headers to Firestore requests

* refactor(admin): share usage-tracking header values between FirebaseUserAgentClient and Firestore

* fix(admin): avoid duplicate gl-dart tag when tagging Firestore requests

* fix(admin): address review feedback, merge rather than replace user headers

* docs(admin): wrap CHANGELOG entry to match surrounding style

* refactor(admin): extract shared identity strings to avoid duplicating them across the two header maps
@wiz-9635d3485b

wiz-9635d3485b Bot commented Jul 27, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations 1 Low
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total 1 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

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.

2 participants