← Back to Pull requests

security: validate Firebase credential file before auth #13

Open
pquerna opened this pull request with 11851 lines diff across 113 files
View on GitHub
pquerna pquerna commented on Nov 19, 2026 19:27 UTC
Author

Summary

Replace Firebase's direct WithCredentialsFile loader with a bounded local file read and google-credential-guard v0.1.2. Only validated service-account JSON reaches the typed Google credential option. Pass an explicit Firebase config so FIREBASE_CONFIG cannot cause a second implicit file read. Credential parsing errors do not echo the path or key material.

The configured path is documented as a local CLI/environment setting. Hosted launchers must independently keep tenants from choosing server-local paths or move to uploaded bytes. Guard adoption refreshes vendored Google auth/API dependencies. Two scoped lint notes preserve the existing legacy user-trait profile and status behavior; a separate migration can change those consumers deliberately.

Verification

  • A generated Google Console-shaped key is accepted, including with a malformed FIREBASE_CONFIG path set.

  • Synthetic external-account file/URL/executable sources, hostile token endpoint, oversized input, and path-error leakage are rejected.

  • go test -mod=vendor ./... -count=1 passed in the direct checkout.

  • make lint passed with zero issues; git diff --check passed.
  • No live Firebase provider credential, hosted launcher, or deployed runtime was exercised.

    Credential format compatibility

    Guard v0.1.2 accepts the two exact service-account token URIs in Google's current key examples and RSA PKCS#8 or PKCS#1 keys. It canonicalizes both URI forms to the pinned oauth2.googleapis.com endpoint and PKCS#1 to PKCS#8 before SDK use. OAuth authorized_user, external-account federation, unknown fields and non-string values remain intentionally unsupported; their admission requires a separately reviewed auth mode. Ordinary unknown field names are reported without echoing values.

    Diff: 11851 lines (+7610 / -4241) across 113 files Reviewer: pquerna Review duration: 4333m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.96) × (1 − Review Confidence (0.73)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.96 · 11851 lines diff across 113 files
    0.96
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.63 · 5 substantive comment(s)
    0.63
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    72%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Self Review self_review
    0.140
    Sensitive Paths sensitive_paths
    0.096
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    14 items
    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 19:28 UTC
    Bot

    <!-- review-superseded: {"report_comment_id": 7019921907, "run_id": "44598575980", "run_attempt": "1"} -->
    <details>
    <summary>Superseded — see the <a href="https://github.com/ConductorOne/baton-google-identity-platform/pull/13#issuecomment-7019921907">current review report</a> for commit <code>6ce287dd9a4c</code></summary>

    Connector PR Review: security: validate Firebase credential file before auth

    Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base fba77b1f295f.
    _Review mode: full_
    View review run

    Review Summary


    New() no longer uses option.WithCredentialsFile. It now opens the configured path itself and reads at most MaxJSONBytes+1 bytes. The vendored google-credential-guard v0.1.1 (guard.go) parses those bytes with a field allowlist and duplicate-key and trailing-data rejection. It accepts only type=service_account with an RSA PKCS#8 key, a *.gserviceaccount.com email, and a pinned token_uri/universe_domain. It re-encodes the key as canonical JSON and passes it through the typed option.WithAuthCredentialsJSON(option.ServiceAccount, …).

    Firebase now gets &firebase.Config{} instead of nil. That skips getConfigDefaults, so FIREBASE_CONFIG is no longer read. The project ID still comes from the service-account credentials via getProjectID → transport.Creds, which supports AuthCredentialsJSON in the bumped google.golang.org/api v0.316.0.

    I scanned the full PR diff for security and correctness. The go.mod/go.sum changes match the new guard dependency and the refreshed Google auth/API modules it needs; go.sum only adds entries. vendor/modules.txt is consistent with go.mod. I did not review third-party vendored module contents line by line, apart from the guard package.

    Repo-local criteria applied: no resource-producing paths changed, so sections S/R7 don't apply. No Grants, actions, or spans changed. Error wrapping (B) is fine: %w is kept on the guard error, and the guard's messages carry no path or key data. The user.go change only adds //nolint:staticcheck notes and leaves trait output the same, so B6 doesn't apply.

    Rejecting authorized_user/external_account files and the ADC fallback is a deliberate narrowing. The README documents it, and docs/connector.mdx already says to use a JSON service-account key. credentials-json-file-path is WithRequired(true), so an empty path cannot rely on the old ADC fallback. The tests cover a valid key, external-account variants, a hostile token_uri, oversized input, and leakage of the path into errors.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


  • New (low confidence) pkg/connector/connector.go:85, :72: the sanitized errors drop their cause entirely. "open credentials file: failed" doesn't separate not-found, permission-denied, or is-a-directory, and the Firebase auth client error is fully discarded. That makes CLI misconfiguration hard to diagnose. You could classify the cause without the path, e.g. with fs.ErrNotExist / fs.ErrPermission.
  • <details>
    <summary>Prompt for AI agents</summary>

    Verify each finding against the current code and only fix it if needed.
    
    ## Suggestions
    
    In `pkg/connector/connector.go`:
    - Around line 83-86: `credentialsOption` replaces every os.Open error with "open credentials file: failed". Keep the path out of the message, but classify the cause: if errors.Is(err, fs.ErrNotExist) return "open credentials file: not found"; if errors.Is(err, fs.ErrPermission) return "open credentials file: permission denied"; otherwise keep the generic message.
    - Around line 70-73: the error from app.Auth(ctx) is discarded completely. If it can be done without exposing credential content, keep a non-sensitive classification of the cause so operators can diagnose initialization failures.
    

    </details>

    </details>

    github-actions[bot] github-actions[bot] commented on code on Nov 19, 2026 19:29 UTC
    Code Review
    pkg/connector/connector.go:1
    @@ -52,23 +56,47 @@ func (gip *GoogleIdentityPlatform) Validate(ctx context.Context) (annotations.An
     }
     
     // New returns the Google Identity Platform connector.
    -func New(ctx context.Context, credentialsJSON string) (*GoogleIdentityPlatform, error) {
    -	opt := option.WithCredentialsFile(credentialsJSON)
    -	app, err := firebase.NewApp(ctx, nil, opt)
    +func New(ctx context.Context, credentialsJSONFilePath string) (*GoogleIdentityPlatform, error) {
    +	opt, err := credentialsOption(credentialsJSONFilePath)
     	if err != nil {
     		return nil, err
     	}
    +	// An explicit config prevents Firebase from reading FIREBASE_CONFIG as a file.
    +	app, err := firebase.NewApp(ctx, &firebase.Config{}, opt)
    +	if err != nil {
    +		return nil, errors.New("initialize Firebase app: invalid configuration")
    +	}
     
     	client, err := app.Auth(ctx)
     	if err != nil {
    -		return nil, err
    +		return nil, errors.New("initialize Firebase auth client: failed")
     	}
     
     	return &GoogleIdentityPlatform{
     		client: client,
     	}, nil
     }
     
    +// credentialsOption reads an operator-configured local key with a strict size
    +// limit before handing validated service-account bytes to the Google SDK.
    +func credentialsOption(path string) (option.ClientOption, error) {
    +	file, err := os.Open(path)
    +	if err != nil {
    +		return nil, errors.New("open credentials file: failed")

    🟡 Suggestion (low confidence): this error drops the cause along with the path, so an operator can't tell a missing file from a permissions problem or a directory. You can keep the path out of the error and still name the class, e.g. errors.Is(err, fs.ErrNotExist) → "not found", fs.ErrPermission → "permission denied". The same applies to the bare "initialize Firebase auth client: failed" at line 72.

    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 19:29 UTC
    Bot

    <!-- review-superseded: {"report_comment_id": 7020279065, "run_id": "44601216077", "run_attempt": "1"} -->
    <details>
    <summary>Superseded — see the <a href="https://github.com/ConductorOne/baton-google-identity-platform/pull/13#issuecomment-7020279065">current review report</a> for commit <code>bb7787af9bdc</code></summary>

    Connector PR Review: security: validate Firebase credential file before auth

    Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base fba77b1f295f.
    _Review mode: full_
    View review run

    Review Summary


    New() no longer uses option.WithCredentialsFile. It now opens the configured path itself and reads at most MaxJSONBytes+1 bytes. The vendored google-credential-guard v0.1.1 (guard.go) parses those bytes with a field allowlist and duplicate-key and trailing-data rejection. It accepts only type=service_account with an RSA PKCS#8 key, a *.gserviceaccount.com email, and a pinned token_uri/universe_domain. It re-encodes the key as canonical JSON and passes it through the typed option.WithAuthCredentialsJSON(option.ServiceAccount, …).

    Firebase now gets &firebase.Config{} instead of nil. That skips getConfigDefaults, so FIREBASE_CONFIG is no longer read. The project ID still comes from the service-account credentials via getProjectID → transport.Creds, which supports AuthCredentialsJSON in the bumped google.golang.org/api v0.316.0.

    I scanned the full PR diff for security and correctness. The go.mod/go.sum changes match the new guard dependency and the refreshed Google auth/API modules it needs; go.sum only adds entries. vendor/modules.txt is consistent with go.mod. I did not review third-party vendored module contents line by line, apart from the guard package.

    Repo-local criteria applied: no resource-producing paths changed, so sections S/R7 don't apply. No Grants, actions, or spans changed. Error wrapping (B) is fine: %w is kept on the guard error, and the guard's messages carry no path or key data. The user.go change only adds //nolint:staticcheck notes and leaves trait output the same, so B6 doesn't apply.

    Rejecting authorized_user/external_account files and the ADC fallback is a deliberate narrowing. The README documents it, and docs/connector.mdx already says to use a JSON service-account key. credentials-json-file-path is WithRequired(true), so an empty path cannot rely on the old ADC fallback. The tests cover a valid key, external-account variants, a hostile token_uri, oversized input, and leakage of the path into errors.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


  • New (low confidence) pkg/connector/connector.go:85, :72: the sanitized errors drop their cause entirely. "open credentials file: failed" doesn't separate not-found, permission-denied, or is-a-directory, and the Firebase auth client error is fully discarded. That makes CLI misconfiguration hard to diagnose. You could classify the cause without the path, e.g. with fs.ErrNotExist / fs.ErrPermission.
  • <details>
    <summary>Prompt for AI agents</summary>

    Verify each finding against the current code and only fix it if needed.
    
    ## Suggestions
    
    In `pkg/connector/connector.go`:
    - Around line 83-86: `credentialsOption` replaces every os.Open error with "open credentials file: failed". Keep the path out of the message, but classify the cause: if errors.Is(err, fs.ErrNotExist) return "open credentials file: not found"; if errors.Is(err, fs.ErrPermission) return "open credentials file: permission denied"; otherwise keep the generic message.
    - Around line 70-73: the error from app.Auth(ctx) is discarded completely. If it can be done without exposing credential content, keep a non-sensitive classification of the cause so operators can diagnose initialization failures.
    

    </details>

    ---
    Reviewed commit: 6ce287dd9a4c
    <!-- review-state: {"last_reviewed_sha": "6ce287dd9a4c9e3e52fa538444980f7b492c70e5", "base_sha": "fba77b1f295fbdefa5d86ff99bfbd94d37839886", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/pr-review.yaml@refs/heads/main", "run_id": "44598575980", "run_attempt": "1", "summary_marker": "### Connector PR Review:", "verdict_mode": "baseline", "publication": "completed", "started_at": "2026-11-19T19:28:05Z", "working_comment_id": 7019874130, "working_comment_updated_at": "2026-11-19T19:29:42Z"} -->

    </details>

    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 19:29 UTC
    Reviewer

    No blocking issues found — see the full review report

    <!-- review-publication: {"run_id": "44598575980", "run_attempt": "1", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/pr-review.yaml@refs/heads/main", "summary_marker": "### Connector PR Review:", "verdict_mode": "baseline", "report_comment_id": 7019921907} -->

    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 19:43 UTC
    Bot

    <!-- review-superseded: {"report_comment_id": 7020279065, "run_id": "44601216077", "run_attempt": "1"} -->
    <details>
    <summary>Superseded — see the <a href="https://github.com/ConductorOne/baton-google-identity-platform/pull/13#issuecomment-7020279065">current review report</a> for commit <code>bb7787af9bdc</code></summary>

    Connector PR Review: security: validate Firebase credential file before auth

    Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base fba77b1f295f.
    _Review mode: incremental since 6ce287d_
    View review run

    Review Summary


    Since 6ce287d, three things changed. credentialsOption now reports not-found and permission-denied separately, without putting the path in the error. It also Stats the opened file and rejects anything that is not a regular file before the bounded read. And google-credential-guard moved from v0.1.1 to v0.1.2, which also accepts Google's current Console key variants (accounts.google.com/o/oauth2/token token URI, PKCS#1 RSA PRIVATE KEY). Either way, the guard always writes out canonical service-account JSON pinned to oauth2.googleapis.com/token. New tests cover the missing-file and directory cases.

    I scanned the full PR diff for security and correctness. That includes the vendored guard (guard.go, adapters.go) and vendor/modules.txt, which the incremental artifact had dropped. vendor/modules.txt matches go.mod at v0.1.2. The go.sum changes are tidy pruning of superseded Google auth/API hashes plus a few transitive /go.mod hashes. I applied the repo-local criteria: logging/error classification, sync data loss (S), JSON safety, breaking changes and dependency checks. None of them fire. This is init-only credential loading with no sync, provisioning, endpoint or resource-ID changes.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


  • Prior — still present (low confidence, partial): pkg/connector/connector.go:66-74. New still throws away the underlying Firebase errors ("initialize Firebase app: invalid configuration", "initialize Firebase auth client: failed"), so these init failures are hard to diagnose. The part of the earlier finding about os.Open cause classification is fixed (see below).
  • Resolved prior findings


  • os.Open errors collapsed into one generic message: fixed. pkg/connector/connector.go:86-91 now checks fs.ErrNotExist and fs.ErrPermission without putting the path in the error, and :94-100 adds a sanitized non-regular-file check. Tested in pkg/connector/credentials_test.go:102-108.
  • <details>
    <summary>Prompt for AI agents</summary>

    Verify each finding against the current code and only fix it if needed.
    
    ## Suggestions
    
    In `pkg/connector/connector.go`:
    - Around line 66-74: New() replaces errors from firebase.NewApp and app.Auth with fixed strings, so the underlying cause is lost. If those errors are confirmed not to contain credential material, wrap them with %w. Otherwise, map them to a coarse category (or log the cause at Debug) so operators can diagnose init failures without exposing key data.
    

    </details>

    </details>

    pquerna pquerna commented on code on Nov 19, 2026 19:43 UTC
    Code Review
    pkg/connector/connector.go:1
    @@ -52,23 +56,47 @@ func (gip *GoogleIdentityPlatform) Validate(ctx context.Context) (annotations.An
     }
     
     // New returns the Google Identity Platform connector.
    -func New(ctx context.Context, credentialsJSON string) (*GoogleIdentityPlatform, error) {
    -	opt := option.WithCredentialsFile(credentialsJSON)
    -	app, err := firebase.NewApp(ctx, nil, opt)
    +func New(ctx context.Context, credentialsJSONFilePath string) (*GoogleIdentityPlatform, error) {
    +	opt, err := credentialsOption(credentialsJSONFilePath)
     	if err != nil {
     		return nil, err
     	}
    +	// An explicit config prevents Firebase from reading FIREBASE_CONFIG as a file.
    +	app, err := firebase.NewApp(ctx, &firebase.Config{}, opt)
    +	if err != nil {
    +		return nil, errors.New("initialize Firebase app: invalid configuration")
    +	}
     
     	client, err := app.Auth(ctx)
     	if err != nil {
    -		return nil, err
    +		return nil, errors.New("initialize Firebase auth client: failed")
     	}
     
     	return &GoogleIdentityPlatform{
     		client: client,
     	}, nil
     }
     
    +// credentialsOption reads an operator-configured local key with a strict size
    +// limit before handing validated service-account bytes to the Google SDK.
    +func credentialsOption(path string) (option.ClientOption, error) {
    +	file, err := os.Open(path)
    +	if err != nil {
    +		return nil, errors.New("open credentials file: failed")

    I added path-free classifications for missing files, permission denial, and non-regular files at bb7787af, with regressions for missing path and directory. Firebase auth-client initialization still returns a generic class because its returned error may carry credential or environment details; we can narrow that further when we have a known safe error taxonomy. Full local tests and lint pass.

    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 19:44 UTC
    Bot

    <!-- review-superseded: {"report_comment_id": 7020999199, "run_id": "44606333099", "run_attempt": "1"} -->
    <details>
    <summary>Superseded — see the <a href="https://github.com/ConductorOne/baton-google-identity-platform/pull/13#issuecomment-7020999199">current review report</a> for commit <code>7915c52ef180</code></summary>

    Connector PR Review: security: validate Firebase credential file before auth

    Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base fba77b1f295f.
    _Review mode: incremental since 6ce287d_
    View review run

    Review Summary


    Since 6ce287d, three things changed. credentialsOption now reports not-found and permission-denied separately, without putting the path in the error. It also Stats the opened file and rejects anything that is not a regular file before the bounded read. And google-credential-guard moved from v0.1.1 to v0.1.2, which also accepts Google's current Console key variants (accounts.google.com/o/oauth2/token token URI, PKCS#1 RSA PRIVATE KEY). Either way, the guard always writes out canonical service-account JSON pinned to oauth2.googleapis.com/token. New tests cover the missing-file and directory cases.

    I scanned the full PR diff for security and correctness. That includes the vendored guard (guard.go, adapters.go) and vendor/modules.txt, which the incremental artifact had dropped. vendor/modules.txt matches go.mod at v0.1.2. The go.sum changes are tidy pruning of superseded Google auth/API hashes plus a few transitive /go.mod hashes. I applied the repo-local criteria: logging/error classification, sync data loss (S), JSON safety, breaking changes and dependency checks. None of them fire. This is init-only credential loading with no sync, provisioning, endpoint or resource-ID changes.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


  • Prior — still present (low confidence, partial): pkg/connector/connector.go:66-74. New still throws away the underlying Firebase errors ("initialize Firebase app: invalid configuration", "initialize Firebase auth client: failed"), so these init failures are hard to diagnose. The part of the earlier finding about os.Open cause classification is fixed (see below).
  • Resolved prior findings


  • os.Open errors collapsed into one generic message: fixed. pkg/connector/connector.go:86-91 now checks fs.ErrNotExist and fs.ErrPermission without putting the path in the error, and :94-100 adds a sanitized non-regular-file check. Tested in pkg/connector/credentials_test.go:102-108.
  • <details>
    <summary>Prompt for AI agents</summary>

    Verify each finding against the current code and only fix it if needed.
    
    ## Suggestions
    
    In `pkg/connector/connector.go`:
    - Around line 66-74: New() replaces errors from firebase.NewApp and app.Auth with fixed strings, so the underlying cause is lost. If those errors are confirmed not to contain credential material, wrap them with %w. Otherwise, map them to a coarse category (or log the cause at Debug) so operators can diagnose init failures without exposing key data.
    

    </details>

    ---
    Reviewed commit: bb7787af9bdc
    <!-- review-state: {"last_reviewed_sha": "bb7787af9bdc549e3c4445c4685bd5ad5558c226", "base_sha": "fba77b1f295fbdefa5d86ff99bfbd94d37839886", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/pr-review.yaml@refs/heads/main", "run_id": "44601216077", "run_attempt": "1", "summary_marker": "### Connector PR Review:", "verdict_mode": "baseline", "publication": "completed", "started_at": "2026-11-19T19:43:20Z", "working_comment_id": 7020246979, "working_comment_updated_at": "2026-11-19T19:44:35Z"} -->

    </details>

    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 19:44 UTC
    Reviewer

    No blocking issues found — see the full review report

    <!-- review-publication: {"run_id": "44601216077", "run_attempt": "1", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/pr-review.yaml@refs/heads/main", "summary_marker": "### Connector PR Review:", "verdict_mode": "baseline", "report_comment_id": 7020279065} -->

    pquerna pquerna commented on code on Nov 19, 2026 20:12 UTC
    Code Review
    pkg/connector/connector.go:1
    @@ -52,23 +56,47 @@ func (gip *GoogleIdentityPlatform) Validate(ctx context.Context) (annotations.An
     }
     
     // New returns the Google Identity Platform connector.
    -func New(ctx context.Context, credentialsJSON string) (*GoogleIdentityPlatform, error) {
    -	opt := option.WithCredentialsFile(credentialsJSON)
    -	app, err := firebase.NewApp(ctx, nil, opt)
    +func New(ctx context.Context, credentialsJSONFilePath string) (*GoogleIdentityPlatform, error) {
    +	opt, err := credentialsOption(credentialsJSONFilePath)
     	if err != nil {
     		return nil, err
     	}
    +	// An explicit config prevents Firebase from reading FIREBASE_CONFIG as a file.
    +	app, err := firebase.NewApp(ctx, &firebase.Config{}, opt)
    +	if err != nil {
    +		return nil, errors.New("initialize Firebase app: invalid configuration")
    +	}
     
     	client, err := app.Auth(ctx)
     	if err != nil {
    -		return nil, err
    +		return nil, errors.New("initialize Firebase auth client: failed")
     	}
     
     	return &GoogleIdentityPlatform{
     		client: client,
     	}, nil
     }
     
    +// credentialsOption reads an operator-configured local key with a strict size
    +// limit before handing validated service-account bytes to the Google SDK.
    +func credentialsOption(path string) (option.ClientOption, error) {
    +	file, err := os.Open(path)
    +	if err != nil {
    +		return nil, errors.New("open credentials file: failed")

    The file side now reports not-found, permission-denied, and non-regular-file classes without returning the path. For app.Auth, I kept the text generic deliberately: the vendored Firebase signer at vendor/firebase.google.com/go/auth/token_generator.go:115-124 can format the full private key into its raw error when parsing fails. Wrapping or logging that error would risk key disclosure if an SDK change or parser differential reaches it. I added this rationale in the code at 7915c52e; full Go tests and lint pass. A future safe provider-error taxonomy can add categories without forwarding raw Firebase text.

    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 20:13 UTC
    Bot

    <!-- review-superseded: {"report_comment_id": 7020999199, "run_id": "44606333099", "run_attempt": "1"} -->
    <details>
    <summary>Superseded — see the <a href="https://github.com/ConductorOne/baton-google-identity-platform/pull/13#issuecomment-7020999199">current review report</a> for commit <code>7915c52ef180</code></summary>

    Connector PR Review: security: validate Firebase credential file before auth

    Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base fba77b1f295f.
    _Review mode: incremental since bb7787a_
    View review run

    Review Summary


    The new commit changes no code. It adds a comment at pkg/connector/connector.go:73-74 saying the error from app.Auth is kept generic on purpose, because Firebase's signer error can print the full private key.

    I re-scanned all the non-vendor changes for security and correctness: README.md, go.mod/go.sum, connector.go, credentials_test.go and user.go. The old WithCredentialsFile loader is replaced by credentialsOption. It opens the file with error messages that never include the path, accepts only regular files, reads at most 64 KiB, validates the key with google-credential-guard, and passes an explicit firebase.Config{} so FIREBASE_CONFIG is never read. The new direct dependency (google-credential-guard v0.1.2) and the Google auth/API version bumps that come with it match this change.

    The vendored diffs were not reviewed line by line. I only checked that they line up with the go.mod bumps.

    How the repo-local criteria applied:

  • L/E (log levels, error wrapping): no logging is added, and the init errors are plain errors with no status code.

  • S (sync data loss): List/Grants are unchanged, so it does not apply.

  • C (spans), J (JSON types), BP/I (breaking changes, ID stability) and PR (provisioning): nothing in this change touches them.
  • One mismatch in the PR description: the summary says guard v0.1.1, but go.mod pins v0.1.2, which is also the version the compatibility section describes.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


    None.

    Resolved prior findings


  • The earlier low-confidence suggestion that New throws away the underlying Firebase init errors (connector.go:66-75) is obsolete as a defect. The new comment at connector.go:73-74 records why: Firebase's signer error can include the private key. Keeping the message generic is the right security choice, so this is no longer a finding.
  • </details>

    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 20:14 UTC
    Bot

    Connector PR Review: security: validate Firebase credential file before auth

    Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base fba77b1f295f.
    _Review mode: incremental since bb7787a_
    View review run

    Review Summary


    The new commit changes no code. It adds a comment at pkg/connector/connector.go:73-74 saying the error from app.Auth is kept generic on purpose, because Firebase's signer error can print the full private key.

    I re-scanned all the non-vendor changes for security and correctness: README.md, go.mod/go.sum, connector.go, credentials_test.go and user.go. The old WithCredentialsFile loader is replaced by credentialsOption. It opens the file with error messages that never include the path, accepts only regular files, reads at most 64 KiB, validates the key with google-credential-guard, and passes an explicit firebase.Config{} so FIREBASE_CONFIG is never read. The new direct dependency (google-credential-guard v0.1.2) and the Google auth/API version bumps that come with it match this change.

    The vendored diffs were not reviewed line by line. I only checked that they line up with the go.mod bumps.

    How the repo-local criteria applied:

  • L/E (log levels, error wrapping): no logging is added, and the init errors are plain errors with no status code.

  • S (sync data loss): List/Grants are unchanged, so it does not apply.

  • C (spans), J (JSON types), BP/I (breaking changes, ID stability) and PR (provisioning): nothing in this change touches them.
  • One mismatch in the PR description: the summary says guard v0.1.1, but go.mod pins v0.1.2, which is also the version the compatibility section describes.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


    None.

    Resolved prior findings


  • The earlier low-confidence suggestion that New throws away the underlying Firebase init errors (connector.go:66-75) is obsolete as a defect. The new comment at connector.go:73-74 records why: Firebase's signer error can include the private key. Keeping the message generic is the right security choice, so this is no longer a finding.
  • ---
    Reviewed commit: 7915c52ef180
    <!-- review-state: {"last_reviewed_sha": "7915c52ef180b7eb03b1eac47bac3b88ea7c2331", "base_sha": "fba77b1f295fbdefa5d86ff99bfbd94d37839886", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/pr-review.yaml@refs/heads/main", "run_id": "44606333099", "run_attempt": "1", "summary_marker": "### Connector PR Review:", "verdict_mode": "baseline", "publication": "completed", "started_at": "2026-11-19T20:13:02Z", "working_comment_id": 7020970998, "working_comment_updated_at": "2026-11-19T20:14:11Z"} -->

    github-actions[bot] github-actions[bot] commented on Nov 19, 2026 20:14 UTC
    Reviewer

    No blocking issues found — see the full review report

    <!-- review-publication: {"run_id": "44606333099", "run_attempt": "1", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/pr-review.yaml@refs/heads/main", "summary_marker": "### Connector PR Review:", "verdict_mode": "baseline", "report_comment_id": 7020999199} -->

    ggreer ggreer commented on code on Nov 19, 2026 23:43 UTC
    Code Review
    pkg/connector/connector.go:1
    @@ -52,23 +57,62 @@ func (gip *GoogleIdentityPlatform) Validate(ctx context.Context) (annotations.An
     }
     
     // New returns the Google Identity Platform connector.
    -func New(ctx context.Context, credentialsJSON string) (*GoogleIdentityPlatform, error) {
    -	opt := option.WithCredentialsFile(credentialsJSON)
    -	app, err := firebase.NewApp(ctx, nil, opt)
    +func New(ctx context.Context, credentialsJSONFilePath string) (*GoogleIdentityPlatform, error) {
    +	opt, err := credentialsOption(credentialsJSONFilePath)
     	if err != nil {
     		return nil, err
     	}
    +	// An explicit config prevents Firebase from reading FIREBASE_CONFIG as a file.
    +	app, err := firebase.NewApp(ctx, &firebase.Config{}, opt)
    +	if err != nil {
    +		return nil, errors.New("initialize Firebase app: invalid configuration")
    +	}
     
     	client, err := app.Auth(ctx)
     	if err != nil {
    -		return nil, err
    +		// Firebase's signer error can print the complete private key. Do not wrap
    +		// or log its raw error text; keep this failure class intentionally generic.
    +		return nil, errors.New("initialize Firebase auth client: failed")
     	}
     
     	return &GoogleIdentityPlatform{
     		client: client,
     	}, nil
     }
     
    +// credentialsOption reads an operator-configured local key with a strict size
    +// limit before handing validated service-account bytes to the Google SDK.
    +func credentialsOption(path string) (option.ClientOption, error) {
    +	file, err := os.Open(path)
    +	if err != nil {
    +		if errors.Is(err, fs.ErrNotExist) {
    +			return nil, errors.New("open credentials file: not found")
    +		}
    +		if errors.Is(err, fs.ErrPermission) {
    +			return nil, errors.New("open credentials file: permission denied")
    +		}
    +		return nil, errors.New("open credentials file: failed")
    +	}
    +	defer file.Close()
    +	info, err := file.Stat()
    +	if err != nil {
    +		return nil, errors.New("inspect credentials file: failed")
    +	}
    +	if !info.Mode().IsRegular() {

    This fails if the path is a symlink, which I think is too restrictive for anyone running the connector in one shot or service mode.

    Reviewers
    Assignees
    pquerna pquerna
    Labels
    risk: low confidence: 72.9% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 96% (HIGH) · Higher = larger blast radius
    96%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 72.9% · Lower = rushed or shallow review
    72.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26% · Safe to merge
    26%