Add explanatory comments to empty certificate validation methods#6
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Add explanatory comments to empty certificate validation methods#6sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZ6wRBaXQw83x_y7ZeLG for java:S1186 rule - AZ6wRBaXQw83x_y7ZeLI for java:S1186 rule - AZ6wRBaXQw83x_y7ZeLF for java:S1186 rule - AZ6wRBaXQw83x_y7ZeLH for java:S1186 rule - AZ6wRBaXQw83x_y7ZeLJ for java:S1186 rule Generated by SonarQube Agent (task: e319ab0e-9115-4524-b10d-f2f6d89cf1b3)
|
|
|
||
| @Override | ||
| public void checkServerTrusted(X509Certificate[] chain, String authType) {} | ||
| public void checkServerTrusted(X509Certificate[] chain, String authType) { |
|
|
||
| @Override | ||
| public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) {} | ||
| public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) { |
|
|
||
| @Override | ||
| public void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine) {} | ||
| public void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine) { |
|
|
||
| @Override | ||
| public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) {} | ||
| public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) { |
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.




This change adds nested comments to five intentionally empty certificate validation methods in the HttpClient class, explaining that they are part of an insecure trust manager that accepts all certificates. These comments resolve critical SonarQube violations (java:S1186) that flag empty method bodies as potential code smells.
View Project in SonarCloud
Fixed Issues
java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
src/main/java/land/oras/auth/HttpClient.java:808Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a comment to the empty
checkClientTrusted(X509Certificate[], String)method at line 808, explaining that it is intentionally empty because this is an insecure trust manager that accepts all client certificates. This resolves the static analysis warning about an empty method body by providing the required nested comment.java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
src/main/java/land/oras/auth/HttpClient.java:811Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a comment to the empty
checkServerTrusted(X509Certificate[], String)method at line 811, explaining that it is intentionally empty because this is an insecure trust manager that accepts all server certificates. This resolves the static analysis warning about an empty method body by providing the required nested comment.java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
src/main/java/land/oras/auth/HttpClient.java:814Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a comment to the empty
checkClientTrusted(X509Certificate[], String, Socket)method at line 814, explaining that it is intentionally empty because this is an insecure trust manager that accepts all client certificates. This resolves the static analysis warning about an empty method body by providing the required nested comment.java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
src/main/java/land/oras/auth/HttpClient.java:817Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a comment to the empty
checkServerTrusted(X509Certificate[], String, Socket)method at line 817, explaining that it is intentionally empty because this is an insecure trust manager that accepts all server certificates. This resolves the static analysis warning about an empty method body by providing the required nested comment.java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue
Location:
src/main/java/land/oras/auth/HttpClient.java:820Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Adds a comment to the empty
checkClientTrusted(X509Certificate[], String, SSLEngine)method at line 820, explaining that it is intentionally empty because this is an insecure trust manager that accepts all client certificates. This resolves the static analysis warning about an empty method body by providing the required nested comment.SonarQube Remediation Agent uses AI. Check for mistakes.