-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added AWS Credentials Support for Scanning Private Registry #1062
Conversation
if aerr, ok := err.(awserr.Error); ok { | ||
switch aerr.Code() { | ||
case ecr.ErrCodeServerException: | ||
fmt.Println(ecr.ErrCodeServerException, aerr.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better pass logger and use it: log.V(1).Error(aerr,ecr.ErrCodeServerException,"error somthing")
case ecr.ErrCodeInvalidParameterException: | ||
fmt.Println(ecr.ErrCodeInvalidParameterException, aerr.Error()) | ||
default: | ||
fmt.Println(aerr.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here use logger
case ecr.ErrCodeServerException: | ||
fmt.Println(ecr.ErrCodeServerException, aerr.Error()) | ||
case ecr.ErrCodeInvalidParameterException: | ||
fmt.Println(ecr.ErrCodeInvalidParameterException, aerr.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here use logger
fmt.Println(aerr.Error()) | ||
} | ||
} else { | ||
fmt.Println(err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
|
||
var credentials = *result.AuthorizationData[0].AuthorizationToken | ||
|
||
sDec, _ := base64.StdEncoding.DecodeString(credentials) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
should not be ignored
registryPasswordKey := fmt.Sprintf("%s.password", c.Name) | ||
if config.UseECRCredentials() { | ||
var aws_creds = GetAuthorizationToken(c.Image) | ||
var creds (ecr_credentials) = ecr_credentials{aws_creds[0][1], aws_creds[0][2]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check matrix size both row and column to avoid index out of range
registryPasswordKey := fmt.Sprintf("%s.password", container.Name) | ||
if config.UseECRCredentials() { | ||
var aws_creds = GetAuthorizationToken(container.Image) | ||
var creds (ecr_credentials) = ecr_credentials{aws_creds[0][1], aws_creds[0][2]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check matrix size both row and column to avoid index out of range
@VF-mbrauer thank you for the contribution, added a few comments |
Due to the new Release 0.15.0 the PR needed to be rebased. For this, a new PR has been created #1103 |
Added support for scanning the private registry of AWS-ECR.
Feature still in Beta-mode but usable when prerequisites are met.
Prerequisite:
K8S-Kiam or any other method IRSA (Future) to be used to allow Assuming Instance Roles.
Configurations:
Annotate the Starboard Namespace to be allowed to use KIAM:
Annotations: iam.amazonaws.com/permitted: .*
Add the Role you want to Assume which has the proper right to create ECR-Credentials
Configuration in HELM value file to enable the feature
trivy.useEcrRoleCreds: false