Conversation
| } | ||
|
|
||
| private AmazonS3 getAmazonS3Client() { | ||
| AWSCredentials awsCredentials = new BasicAWSCredentials(accessKeyId, secretAccessKey); |
There was a problem hiding this comment.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
If possible, use temporary security credentials (IAM roles) instead of long-term access keys.
Long-term access keys, such as those associated with IAM users and AWS account root users, remain valid until you manually revoke them. However, temporary security credentials obtained through IAM roles and other features of the AWS Security Token Service expire after a short period of time. Use temporary security credentials to help reduce your risk in case credentials are accidentally exposed.
Learn more about best practices for managing AWS access keys.
| public List<Customer> piiData(DataSource ds) { | ||
| List<Customer> customers = new ArrayList<Customer>(); | ||
| try { | ||
| Connection connection = ds.getConnection(); |
There was a problem hiding this comment.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.
Fix
Consider closing the following resource: connection. Currently, there are execution paths that do not contain closure statements. Either a) close connection in a try-finally block or b) close the resource by declaring connection in a try-with-resources block.
More info
View resource management guidelines at oracle.com (external link).
| try { | ||
| Connection connection = ds.getConnection(); | ||
| String sql="select name, address, ssn, phoneNumber, password from customer"; | ||
| ResultSet rs= connection.createStatement().executeQuery(sql); |
There was a problem hiding this comment.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.
Fix
Consider closing the following resource: rs. Currently, there are execution paths that do not contain closure statements. Either a) close rs in a try-finally block or b) close the resource by declaring rs in a try-with-resources block.
More info
View resource management guidelines at oracle.com (external link).
| public Map<String, String> sqlInjection(DataSource ds, HttpServletRequest request) { | ||
| Map<String, String> nameValueMAp = new HashMap<String, String>(); | ||
| try { | ||
| Connection connection = ds.getConnection(); |
There was a problem hiding this comment.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.
Fix
Consider closing the following resource: connection. Currently, there are execution paths that do not contain closure statements. Either a) close connection in a try-finally block or b) close the resource by declaring connection in a try-with-resources block.
More info
View resource management guidelines at oracle.com (external link).
| try { | ||
| Connection connection = ds.getConnection(); | ||
| String sql="select name, title from employee where empId="+request.getParameter("empID"); | ||
| ResultSet rs= connection.createStatement().executeQuery(sql); |
There was a problem hiding this comment.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.
Fix
Consider closing the following resource: rs. Currently, there are execution paths that do not contain closure statements. Either a) close rs in a try-finally block or b) close the resource by declaring rs in a try-with-resources block.
More info
View resource management guidelines at oracle.com (external link).
No description provided.