Skip to content

Commit d62d7ec

Browse files
authored
fix(oidc): no trailing colon on non-action events in claim (#1355)
1 parent 61c9d09 commit d62d7ec

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/token/mint.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,19 @@ func (tm *Manager) MintIDToken(ctx context.Context, mto *MintTokenOpts, db datab
157157
return "", errors.New("missing build sender for ID token")
158158
}
159159

160+
event := mto.Build.GetEvent()
161+
if len(mto.Build.GetEventAction()) > 0 {
162+
event = fmt.Sprintf("%s:%s", mto.Build.GetEvent(), mto.Build.GetEventAction())
163+
}
164+
160165
// set claims based on input
161166
claims.Actor = mto.Build.GetSender()
162167
claims.ActorSCMID = mto.Build.GetSenderSCMID()
163168
claims.Branch = mto.Build.GetBranch()
164169
claims.BuildNumber = strconv.FormatInt(mto.Build.GetNumber(), 10)
165170
claims.BuildID = strconv.FormatInt(mto.Build.GetID(), 10)
166171
claims.Repo = mto.Repo
167-
claims.Event = fmt.Sprintf("%s:%s", mto.Build.GetEvent(), mto.Build.GetEventAction())
172+
claims.Event = event
168173
claims.PullFork = strconv.FormatBool(mto.Build.GetFork())
169174
claims.SHA = mto.Build.GetCommit()
170175
claims.Ref = mto.Build.GetRef()

0 commit comments

Comments
 (0)