Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

github-actions[bot]
Copy link
Contributor

You can preview this rule here (updated a few minutes after each push).

Review

A dedicated reviewer checked the rule description successfully for:

  • logical errors and incorrect information
  • information gaps and missing content
  • text style and tone
  • PR summary and labels follow the guidelines

@pierre-loup-tristant-sonarsource pierre-loup-tristant-sonarsource changed the title Create rule S7612 Create rule S7612: Passwords should not be stored on device (SONARSEC-6836) Jun 18, 2025
Copy link
Contributor

@egon-okerman-sonarsource egon-okerman-sonarsource left a 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 {
Copy link
Contributor

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);
Copy link
Contributor

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)

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.

Copy link
Contributor

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 :)

@pierre-loup-tristant-sonarsource pierre-loup-tristant-sonarsource marked this pull request as ready for review June 25, 2025 13:11
Copy link

Quality Gate passed Quality Gate passed for 'rspec-tools'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
0 Dependency risks
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Copy link

Quality Gate passed Quality Gate passed for 'rspec-frontend'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
0 Dependency risks
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Copy link
Contributor

@egon-okerman-sonarsource egon-okerman-sonarsource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants