Skip to content

add secret access key and secret key length check#30

Open
kheina wants to merge 4 commits into
mainfrom
dmiu_sb-cred-checks
Open

add secret access key and secret key length check#30
kheina wants to merge 4 commits into
mainfrom
dmiu_sb-cred-checks

Conversation

@kheina
Copy link
Copy Markdown
Contributor

@kheina kheina commented Jul 6, 2023

validates that secrets.access_key_id is always between 16 and 128 characters long and matches the \w+ pattern per https://docs.aws.amazon.com/IAM/latest/APIReference/API_AccessKey.html
validates that secrets.secret_access_key is always 40 characters long

Copy link
Copy Markdown
Contributor

@ddebko ddebko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a strong need or use case for the validation checks on the access and secret key?

if err != nil {
badFields[fmt.Sprintf("secrets.%s", ConstAccessKeyId)] = err.Error()
} else if len(accessKey) < 16 || len(accessKey) > 128 {
badFields[fmt.Sprintf("secrets.%s", ConstAccessKeyId)] = "value must be between 16 and 128 characters"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should enforce any strict checks on the given values of the access or secret key. I think it would be safer for AWS to return an error to the plugin and the plugin could bubble up the error to the user.

The reason why I think it would be safer to bubble up an error like this from AWS is because the user would be able to search AWS documentation by matching the error message. Otherwise the user could get stuck with our unique error message that may not be helpful with searching AWS documentation.

Also, AWS can change their behavior and this check becomes invalid, which would enable an edge case bug in the plugin that we would then need to patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants