Skip to content

Commit 00f0fca

Browse files
authored
change decrypt credentials to only request your own creds (#112)
Changes "decrypt-credential" to only request credentials for app users you are the owner of. This preempts a coming change to c1 that forbids requesting credentials for other users.
1 parent 1ff7a7b commit 00f0fca

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cmd/cone/decrypt.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ func decryptCredentialRun(cmd *cobra.Command, args []string) error {
104104
}
105105
}
106106

107+
// Get the c1 user ID
108+
resp, err := c.AuthIntrospect(ctx)
109+
if err != nil {
110+
return err
111+
}
112+
userID := client.StringFromPtr(resp.UserID)
113+
107114
allCreds := make([]shared.AppUserCredential, 0)
108115

109116
for _, app := range apps {
@@ -115,6 +122,9 @@ func decryptCredentialRun(cmd *cobra.Command, args []string) error {
115122
return err
116123
}
117124
for _, appUser := range appUsers {
125+
if *appUser.GetIdentityUserID() != userID {
126+
continue
127+
}
118128
creds, err := c.ListAppUserCredentials(ctx, *app.ID, *appUser.ID)
119129
if err != nil {
120130
return err

0 commit comments

Comments
 (0)