JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
A Web API method is not annotated for authentication.
This checker identifies security issues related to authentication procedures, such as using no password for LDAP authentication or using the host name in conditions.
| Class Name | Missing Authentication Annotation (Java) | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | security | ||||||||||||||||||
| Mnemonic | JAVA.INSEC.MAA | ||||||||||||||||||
| Categories |
|
||||||||||||||||||
| Availability | Available for Java and Kotlin. |
||||||||||||||||||
| Enabling | Checks for this warning class are enabled by
default. To disable them, add the following WARNING_FILTER rule to the
project configuration file.
WARNING_FILTER += discard class="Missing Authentication Annotation (Java)" |
This code contains several methods, 11 annotated with Web API annotations (e.g., @GET) and 10 of them with authentication annotations (e.g., @RolesAllowed). Therefore, more than 80% (that is, more than the percentage indicated in parameter authenticatedWebAPIPercentage) of Web API methods are annotated with authentication information. So the following warning is produced by this checker:
public class WebAPIAuthentication {
@RolesAllowed(value = { "admin" })
class AuthenticatedWebAPI {
/* AuthenticatedWebAPI methods do not trigger "Missing Authentication Annotation (Java)"
* warnings - even if not individually annotated - because the class itself is annotated.
*/
@GET
public String Get() {...}
@PUT
public String Put() {...}
@POST
public String Post() {...}
@HEAD
public String Head() {...}
@DELETE
public String Delete() {...}
public String foo() {...}
public String foo2() {...}
public String foo3() {...}
}
@PermitAll
@GET
public String authenticatedGet() {...}
@PermitAll
@PUT
public String authenticatedPut() {...}
@DenyAll
@DELETE
public String authenticatedDelete() {...}
@RolesAllowed(value = { "admin" })
@HEAD
public String authenticatedHead() {...}
@PermitAll
@POST
public String authenticatedPost() {...}
@GET
public String unauthenticatedGet() {...} /* "Missing Authentication Annotation (Java)"
* warning issued here: more than 80% of methods with
* Web API annotations also have authentication
* annotations, but this method does not.
*/
public String foo() {...}
@PermitAll
public String foo2() {...}
public String foo3() {...}
}
Check if the warning actually corresponds to a real security issue related to authentication and, if that is the case, use a more secure authentication procedure.
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.