google-auth: gracefully handle leading whitespace in identity pool PEM parsing

Open Beginner friendly
#17,623 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python

Research direction

Start in google/auth/identity_pool.py at _read_trust_chain and inspect how the PEM content is split before cryptography loads the certificates. Done means valid PEM files with leading comments or blank lines are parsed without a ValueError or crash, while the existing certificate chain behavior remains intact.

Written by the indexing model from the issue text.

Description

Summary of the issue

_read_trust_chain currently splits the PEM file on the literal -----BEGIN CERTIFICATE----- string.

If a perfectly valid PEM file happens to have some comments or blank lines at the top, that garbage ends up in the first split element. This causes cryptography to throw a ValueError and crash when it tries to load the chain.

Proposed fix

Instead of a brittle string split, we should use cryptography's native multi-PEM parser so it handles the noise gracefully.

Affected Files
  • google/auth/identity_pool.py
Dominant language
Python
Stars
5.4k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
93

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from googleapis/google-cloud-python

All issues in googleapis/google-cloud-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.