Consider this method declaration:
A) “SET SESSION AUTHORIZATION “ + user
B) “SET SESSION AUTHORIZATION “ + stmt.enquoteIdentifier(user)
Is A or B the correct replacement for
Consider this method declaration:
A) “SET SESSION AUTHORIZATION “ + user
B) “SET SESSION AUTHORIZATION “ + stmt.enquoteIdentifier(user)
Is A or B the correct replacement for
B is the correct replacement because enquoting values provided by the calling code prevents SQL injection. SQL injection is a common web application vulnerability that occurs when an attacker is able to manipulate a query by injecting malicious input. Using stmt.enquoteIdentifier(user) ensures that the user input is appropriately treated as an identifier, preventing any malicious manipulation.
B is true