Improving metrics/logs when task credentials are expired - #5134
Draft
singholt wants to merge 1 commit into
Draft
Conversation
The IMDS info file reports a Code per credential. Success means the provider assumed the role and wrote a credential file; AssumeRoleUnauthorizedAccess means it was not authorized to assume it. Parse the Code so a scan returns unauthorized roles alongside retrieved credentials, and track those roles in the credentials manager keyed by credentials id. An unauthorized role leaves any credentials already held in place, and is cleared when credentials arrive for the id or the id is removed. An unrecognized Code is logged and its credential fetched anyway, so a usable credential is never discarded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The IMDS info file reports a
Codeper credential.Successmeans the provider assumed the role and wrote a credential file;AssumeRoleUnauthorizedAccessmeans it was not authorized to assume it. The latter could happen for cases such as customer misconfiguring a role during a task's lifecycle (that uses the role). Or the customer's account is suspended/closed but the task is still running due to delay in resource cleanup.This PR updates the scanner to parse the Code for each credential and keep a track of roles with
AssumeRoleUnauthorizedAccessissue in the credentials manager. It also updates the Docker-based agent in this repository to log this info for debugging, since there is no metrics wired for emission overall for the agent.Implementation details
Parse the
Codeso a scan returns unauthorized roles alongside retrieved credentials, and track those roles in the credentials manager keyed by credentials id. An unauthorized role leaves any credentials already held in place, and is cleared when credentials arrive for the id or the id is removed.An unrecognized
Codeis logged and its credential fetched anyway, so a usable credential is never discarded.Testing
New tests cover the changes: yes, added unit and integration tests
Description for the changelog
Enhancement - Track unauthorized roles from IMDS scans (currently disabled in production)
Additional Information
Does this PR include breaking model changes? No.
Does this PR include the addition of new environment variables in the README? No.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.