MLA-C01 Question 341
Select 3You are a Machine Learning Engineer working on a collaborative project where multiple team members are contributing to a SageMaker notebook stored in a Git repository. During a code review, you notice that a teammate accidentally committed sensitive AWS credentials to the repository. What steps should you take to resolve this issue and ensure best practices are followed?
- A
Use Git to remove the sensitive credentials from the repository's history and force-push the changes.
- B
Revoke the compromised AWS credentials and generate new ones in the IAM console.
- C
Delete the Git repository entirely and create a new one to start fresh.
- D
Add the file containing the sensitive credentials to the
.gitignorefile to prevent future commits. - E
Educate the team on best practices for handling sensitive credentials, such as using AWS Secrets Manager.
Show answer and explanation
Correct answers: A, B, E
Explanation
When sensitive AWS credentials are accidentally committed to a Git repository, it is important to remove the credentials from the repository's history, revoke the compromised keys, and generate new ones. These steps protect your AWS environment from potential breaches. Additionally, educating the team on best practices, such as using services like AWS Secrets Manager, minimizes the likelihood of such incidents in the future.
- A. Correct.
Correct. Removing sensitive credentials from the repository history ensures that they are no longer accessible in any previous commits. A force-push is necessary to overwrite the repository's history on the remote server.
- B. Correct.
Correct. Revoking the compromised credentials and generating new ones is essential to protect your AWS environment from unauthorized access.
- C. Incorrect.
Incorrect. Deleting the entire repository is an extreme measure and not necessary to resolve this issue. Proper remediation steps can be taken without discarding the entire project history.
- D. Incorrect.
Incorrect. Adding the file to
.gitignoreprevents future commits but does not resolve the issue of sensitive credentials already being exposed in the repository's history. - E. Correct.
Correct. Educating the team on best practices, such as using AWS Secrets Manager or environment variables for credentials, helps prevent similar issues in the future.