Skip to content

Non-admin client cannot fetch another user's public key #66

@limitusus

Description

@limitusus

Is your feature request related to a problem? Please describe.
I'm writing a test of my project using goiardi, where a client (c1) fetches the public key of another client (c2).
Endpoint: clients/c2/keys/default
In real chef-server, the test passes when c1 is non-admin, whereas in goiardi the test cannot pass, because one (non-admin) client cannot fetch another client's public key (returned 403) by this code.
I have not yet understand chef-server's code, but I guess there might be an implementation difference between chef-server and goiardi.

Describe the solution you'd like
It should be correct behaviour that non-admin client c1 can fetch c2's public key.

Describe alternatives you've considered
For now, I'm testing with c1 admin in the test.

Additional context
With chef-server, c1 can fetch c2's public key like following:

$ knife client show c1
admin:     false
chef_type: client
name:      c1
validator: false

$ knife client key show c2 default
client:          c2
expiration_date: infinity
name:            default
public_key:      -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyY7Acmtj1Y68QBPz5RoV
(snip)
-----END PUBLIC KEY-----

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions