fix(BA-4624): Validate cloud detection responses and harden metadata JSON parsing#9653
Merged
HyeockJinKim merged 5 commits intomainfrom Mar 6, 2026
Merged
fix(BA-4624): Validate cloud detection responses and harden metadata JSON parsing#9653HyeockJinKim merged 5 commits intomainfrom
HyeockJinKim merged 5 commits intomainfrom
Conversation
seedspirit
added a commit
that referenced
this pull request
Mar 5, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens cloud-provider detection and instance metadata parsing to avoid false positives when running on non-major cloud providers, and adds unit tests to cover the new validation behavior.
Changes:
- Validate AWS/Azure/GCP IMDS responses in
_detect_*functions and tightendetect_cloud()timeouts/logging. - Make instance metadata JSON parsing resilient to empty/invalid payloads across AWS/Azure/GCP helpers.
- Add unit tests for IMDS detection and JSON parsing fallbacks; add a towncrier fix fragment.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
tests/unit/common/test_identity.py |
Adds new unit tests for cloud detection validation and metadata parsing fallback paths. |
src/ai/backend/common/identity.py |
Implements IMDS response validation, tighter client timeouts, and safer JSON parsing for instance metadata helpers. |
changes/9653.fix.md |
Adds a release note fragment describing the fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
jopemachine
reviewed
Mar 5, 2026
jopemachine
reviewed
Mar 5, 2026
jopemachine
reviewed
Mar 5, 2026
| assert ret == "default" | ||
|
|
||
|
|
||
| _AWS_URL = "http://169.254.169.254/latest/meta-data/" |
Member
There was a problem hiding this comment.
This change is not part of this PR, but it would be better to extract 169.254.169.254 into a variable instead of repeating it.
HyeockJinKim
previously approved these changes
Mar 5, 2026
Collaborator
|
Please check the CI test. @seedspirit |
seedspirit
added a commit
that referenced
this pull request
Mar 6, 2026
… failures Replace ValueError with CloudDetectionError in IMDS detection functions, including HTTP status codes and response body snippets for diagnostics.
HyeockJinKim
approved these changes
Mar 6, 2026
lablup-octodog
pushed a commit
that referenced
this pull request
Mar 6, 2026
…JSON parsing (#9653) Backported-from: main (26.2) Backported-to: 26.2 Backport-of: 9653
lablup-octodog
pushed a commit
that referenced
this pull request
Mar 6, 2026
…JSON parsing (#9653) Backported-from: main (26.2) Backported-to: 25.15 Backport-of: 9653
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves BA-4624
Checklist: (if applicable)
ai.backend.testdocsdirectory