-
Notifications
You must be signed in to change notification settings - Fork 31
Create rule S7612: Passwords should not be stored on device (SONARSEC-6836) #5136
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
base: master
Are you sure you want to change the base?
Conversation
43b5b76
to
e10bf3a
Compare
e10bf3a
to
cce9bd0
Compare
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.
Some small wording adjustments are necessary, and a fallback for CredentialManager should be given as it is still fairly recent.
|
||
[source,java,diff-id=11,diff-type=noncompliant] | ||
---- | ||
public class ExampleActivity extends AppCompatActivity { |
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 would suggest to reduce the example a bit by removing the lines that are unrelated (e.g. the EdgeToEdge
call)
savePasswordButton.setOnClickListener(v -> { | ||
String password = passwordEditText.getText().toString(); | ||
if (!password.isEmpty()) { | ||
CredentialManager credentialManager = CredentialManager.create(this); |
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.
The CredentialManager page states that:
Requires the PackageManager#FEATURE_CREDENTIALS feature which can be detected using PackageManager.hasSystemFeature(String).
I saw that it has been introduced in API 34. Perhaps it would be better to have a fallback in case CredentialManager does not exist (but in the example and in compliant.adoc)
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.
From what I understand, this is for android.credentials.CredentialManager.
androidx.credentials.CredentialManager is backward compatible.
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.
You're right. Maybe add an import to the example, as users may confuse these two like me :)
828265c
to
a33cbab
Compare
Co-authored-by: Egon Okerman <[email protected]>
a33cbab
to
b30bb75
Compare
|
|
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.
LGTM
You can preview this rule here (updated a few minutes after each push).
Review
A dedicated reviewer checked the rule description successfully for: