-
Notifications
You must be signed in to change notification settings - Fork 56
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
Readonly access keys #870
Readonly access keys #870
Conversation
c22a79e
to
4f9773a
Compare
Permissions: strings.Join(v.Permissions, " "), | ||
ExpiresAt: time.Now().Add(time.Hour * 876000), | ||
ExpiresAt: time.Now().Add(math.MaxInt64), |
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.
root tokens shouldn't expire since it's a last resort. it'll be devastating if the backup access method fails because it expired. leaving ExpiresAt
empty will cause it to expire very quickly so setting this to the max allowed value for time.Add()
@@ -487,42 +488,48 @@ func (r *Registry) importAPITokens() error { | |||
} | |||
|
|||
for k, v := range keys { | |||
if v.Secret == "" { | |||
logging.S.Debugf("%s: unset secret", k) |
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.
if either reference or value is empty, the token won't be created
@@ -17,6 +20,7 @@ type APIToken struct { | |||
// TODO: remove me with machine identities | |||
Permissions string | |||
|
|||
Key string |
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.
this is necessary otherwise deleting and recreating API tokens will fail since the ID is the primary key
internal/registry/data/group_test.go
Outdated
var ( | ||
everyone = models.Group{Name: "Everyone", ProviderID: providerID} | ||
) | ||
everyone := models.Group{Name: "Everyone", ProviderID: providerID} |
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.
Thanks for cleaning this up
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.
Looks good, my only concern is around the case of changing a specified token secret.
From the rename PR (to simplify find and replace in your change):
rootAPIToken
->systemAccessKey
root-api-token
->system-access-key
engineAPIToken
->engineAccessKey
api-token
->access-key
6de0511
to
ccc9dd6
Compare
ccc9dd6
to
73cd452
Compare
73cd452
to
b10933e
Compare
if err != nil { | ||
return fmt.Errorf("import access keys: %w", err) | ||
} | ||
parts := strings.Split(raw, ".") |
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.
should this be ":"
?
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.
this is the value of the key which is <id>.<secret>
- check error instead of check non-error
1773559
to
aa90494
Compare
Revert parts of #860 which moved access key creation to inside infra. This change made it impossible for users to back up and restore keys or migrate tokens between installs.
envFrom
orvolumes
andvolumeMounts
options or through integrations like vaultResolves #