Assert For Auth Control (ARCH8133)
Ce contenu n’est pas encore disponible dans votre langue.
Key kotlin.security.assert-for-auth-control · Severity warning · Category security · CWE CWE-617
Flags assert(...) used for authorization checks - assertions are off unless the JVM runs with -ea.
Incorrect
Section titled “Incorrect”assert(user.isAdmin)Correct
Section titled “Correct”if (!user.isAdmin) throw AccessDeniedException()Enforce with an if / require that always runs.