Skip to content

Commit

Permalink
Rollback privilege escalation
Browse files Browse the repository at this point in the history
Signed-off-by: Max Cao <[email protected]>
  • Loading branch information
maxcao13 committed Nov 5, 2024
1 parent 6c9e605 commit c5bd54f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
7 changes: 0 additions & 7 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ rules:
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- serviceaccounts/token
verbs:
- create
- get
- apiGroups:
- '*'
resources:
Expand Down
1 change: 0 additions & 1 deletion controllers/keda/scaledobject_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import (
// +kubebuilder:rbac:groups=autoscaling,resources=horizontalpodautoscalers,verbs=get;list;watch;update;patch;create;delete
// +kubebuilder:rbac:groups="",resources=configmaps;configmaps/status,verbs=get;list;watch
// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
// +kubebuilder:rbac:groups="",resources=serviceaccounts/token,verbs=create;get
// +kubebuilder:rbac:groups="",resources=pods;services;services;secrets;external,verbs=get;list;watch
// +kubebuilder:rbac:groups="*",resources="*/scale",verbs=get;list;watch;update;patch
// +kubebuilder:rbac:groups="",resources="serviceaccounts",verbs=list;watch
Expand Down
4 changes: 2 additions & 2 deletions pkg/scaling/resolver/scale_resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func resolveBoundServiceAccountToken(ctx context.Context, client client.Client,
return ""
}
var err error
expirySeconds := ptr.Int64(3600)
expirySeconds := ptr.Int64(3600) // default expiry is 1 hour
if expiry != "" {
duration, err := time.ParseDuration(expiry)
if err != nil {
Expand Down Expand Up @@ -651,7 +651,7 @@ func generateToken(ctx context.Context, serviceAccountName, namespace string, ex
log.Error(err, "error trying to create token for service account", "ServiceAccount.Name", serviceAccountName)
return ""
}
log.Info("Service account token created successfully", "ServiceAccount.Name", serviceAccountName, "Token", token.Status.Token)
log.Info("Service account token created successfully", "ServiceAccount.Name", serviceAccountName)
return token.Status.Token
}

Expand Down

0 comments on commit c5bd54f

Please sign in to comment.