Assert For Auth Control (ARCH9133)
Key swift.security.assert-for-auth-control · Severity warning · Category security · CWE CWE-617
Flags assert() / assertionFailure used for authorization checks - assertions are compiled out in release builds.
Incorrect
Section titled “Incorrect”assert(user.isAdmin)Correct
Section titled “Correct”guard user.isAdmin else { throw Abort(.forbidden) }Enforce with a guard that always runs.