Skip to content

fix: handle a missing default credential profile - #235

Open
yqia03 wants to merge 1 commit into
TencentCloud:masterfrom
yqia03:fix/profile-credential-missing-default
Open

yqia03 wants to merge 1 commit into
TencentCloud:masterfrom
yqia03:fix/profile-credential-missing-default

Conversation

@yqia03

@yqia03 yqia03 commented Nov 15, 2026 •

Copy link
Copy Markdown

Summary

When a credentials file exists without a [default] section, a fresh ProfileCredential raises AttributeError. Reusing a provider after removing that section returns credentials from the previous read. Read all three profile fields from the current section on each lookup, using an empty mapping when it is absent.

- existing file without [default] -> AttributeError or previous credentials
+ existing file without [default] -> None, allowing the next provider to run

Evidence

  • On the upstream baseline, both regression tests fail. One raises on secret_id; the other returns a credential after the default section was removed.

  • On the branch, the two regression tests and four existing credential concurrency tests pass on Python 3.12.15 with dummy credentials for the mocked STS test. Worker thread exceptions were treated as errors.

  • A local check through DefaultCredentialProvider also exercised empty, other-section-only, incomplete, and valid configurations using a stubbed role provider.

  • Rechecked the exact base and PR head on Python 3.12.14 in an isolated harness using temporary INI files and a stubbed fallback provider. Both regression cases fail on the base and pass on the PR head. Six additional controls passed: missing file, empty file, non-default profile, incomplete profile, empty key, and valid profile. No cloud credentials or network requests were used. This was a focused check, not a full SDK test run.

Merge Danger

Door: two-way. The change only affects how the file provider reads a profile and can be reverted independently.

Blast radius: credential lookup. Valid default profiles still return their configured credentials.

AI assistance was used to reproduce the problem, prepare the patch, and run the checks.

@yqia03
yqia03 marked this pull request as ready for review November 19, 2026 09:11
Copilot AI balanced review requested due to automatic review settings November 19, 2026 09:12

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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