Hardcoded Secret (ARCH9110)
Ce contenu n’est pas encore disponible dans votre langue.
Key swift.security.hardcoded-secret · Severity error · Category security · CWE CWE-798
Flags string literals assigned to secret-looking names (password, apiKey, token, secret, privateKey).
Incorrect
Section titled “Incorrect”let apiKey = "sk_live_4f9a1b2c3d4e5f6a7b8c"Correct
Section titled “Correct”let apiKey = try Keychain.read("payment.apiKey")Read secrets from the Keychain or the environment; never from source.