-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
navigator.userAgent in CognitoUser.js is raising a Chrome Audit notification #9957
Comments
Hi @jrobbins-LiveData 👋 thank you for raising this issue. We were able to consistently reproduce the issue as you mentioned and the team will be looking into how it can be addressed within our library. We've noted the mention of a User Agent Client Hints API, which according to Chromium, will help to solve the problems of browser fingerprinting and complex string parsing. |
Hi @chrisbonifacio. I worry about the apparent lack of cross-browser support for that API, at least as listed here. But if you restrict its use to only when running on Chrome, that would work. (Sorry if that is obvious!) |
@jrobbins-LiveData that's a good point. We could make it backwards compatible until browser support is better by checking for if (navigator.userAgentData) {
// use new hints
} else {
// fall back to user-agent string
} |
I'm also able to consistently reproduce the issue with a super simple implementation of I'll begin looking into solutions and will keep you updated along the way. Thanks for pointing this out, @jrobbins-LiveData! |
With the release of the latest major version of Amplify (aws-amplify@>6), this issue should now be resolved! Please refer to our release announcement, migration guide, and documentation for more information. |
Before opening, please confirm:
JavaScript Framework
Not applicable
Amplify APIs
Not applicable
Amplify Categories
No response
Environment information
Describe the bug
amplify-js/packages/amazon-cognito-identity-js/src/CognitoUser.js
Line 62 in 1b18862
Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform
from Chrome.Expected behavior
Following Chrome's suggestion "To fix this issue, replace the usage of navigator.userAgent, navigator.appVersion, and navigator.platform with feature detection, progressive enhancement, or migrate to navigator.userAgentData." should result in removing this flagged "Audit Issue", reducing concerns from security reviews and audits about
amazon-cognito-identity.js
.Reproduction steps
Any web app using
amazon-cognito-identity.js
should exhibit the Audit Issue.Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
While
amazon-cognito-identity.js
's use ofnavigator.userAgent
inCognitoUser.js
appears safe with respect to the announcing browser "reduction" (https://www.chromium.org/updates/ua-reduction/#reduced-navigatoruseragent-values), such Audit Issues cause concern for those of us using Cognito in secure environments with apps subject to security reviews and audits. Rather than having to give a lengthy explanation why this particular Audit Issue isn't really a concern, it is much much easier to not have to explain it to begin with!There is hopefully an alternative way for the code to determine the
DeviceName
rather than using this property.The text was updated successfully, but these errors were encountered: