-
Notifications
You must be signed in to change notification settings - Fork 730
fix(amazonq): isAmazonLinux2() function incorrectly identifies regular Linux/Ubuntu in web/container env as AL2 #8073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
|
✅ I finished the code review, and didn't find any security or code quality issues. |
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
|
✅ I finished the code review, and didn't find any security or code quality issues. |
murkvin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a few comments and questions.
murkvin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we can still strip away more.
Problem
PR: #7270 introduced a bug where the
isAmazonLinux2()function incorrectly identifies regular Linux/Ubuntu systems in web/container environments as Amazon Linux 2. This happens because:os.release()for.amzn2.or.amzn2int.patternsos.release()returns the host's kernel version, not the container's OStrueSolution
Skip AL2 detection for web environments - Returns
falseimmediately since web mode runs in a browserCheck
/etc/os-releasefirst - In containerized environments, this file contains the actual container OS, not the host OSTrust container OS over kernel version - If
/etc/os-releaseshows it's not AL2 (e.g., Ubuntu), returnfalseregardless of kernel versionFall back to kernel check only when necessary - Only use
os.release()if we can't read/etc/os-releaseor if it confirms AL2Prioritized container OS detection over kernel version detection
Maintained backward compatibility for actual AL2 systems
Added comprehensive test coverage for the new scenarios
feature/xbranches will not be squash-merged at release time.