Skip to content
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

KBS: Add a Delete method to /resource/{repository}/{type}/{tag} #382

Open
davidhadas opened this issue Apr 30, 2024 · 5 comments
Open

KBS: Add a Delete method to /resource/{repository}/{type}/{tag} #382

davidhadas opened this issue Apr 30, 2024 · 5 comments

Comments

@davidhadas
Copy link
Member

davidhadas commented Apr 30, 2024

KBS API supports the following resource manipulation:

 /resource/{repository}/{type}/{tag}:
    get:
      operationId: getResource
      summary: Get a secret resource from the Key Broker Service.
       ... 
    post:
      operationId: registerSecretResource
      summary: Register a secret resource into the Key Broker Service.
      ...

This API is missing the option to delete resources that were added.

It is suggested that we add:

delete:
      operationId: deleteSecretResource
      summary: Delete a secret resource from the Key Broker Service.
      parameters:
        - name: repository
          in: path
          description: A parent path of resource, can be empty to use the default repository.
          schema:
            type: string
          required: false
        - name: type
          in: path
          description: Resource type name
          schema:
            type: string
          required: true
        - name: tag
          in: path
          description: Resource instance tag
          schema:
            type: string
          required: true

Use Case:
Under Peer-Pods Secure Comms, Keys are added to the KBS for each Peer Pod created.
It is required to delete such keys once a Peer Pod is deleted.
Without delete support, KBS will explode over time as keys will continue to be added and never deleted.

@davidhadas
Copy link
Member Author

CC: @bpradipt, @fitzthum, @portersrc

@davidhadas davidhadas changed the title KBS: Add KBS: Add Delete API to /resource/{repository}/{type}/{tag} Apr 30, 2024
@davidhadas davidhadas changed the title KBS: Add Delete API to /resource/{repository}/{type}/{tag} KBS: Add a Delete method to /resource/{repository}/{type}/{tag} Apr 30, 2024
@Xynnn007
Copy link
Member

Xynnn007 commented May 1, 2024

comment: we should ensure that the delete operation is performed by the admin, which is a different persona of the one performing GET.

Also, I am not sure if anybody is deploying KBS resources as configmap, thus they are not deletable. cc @mkulke

@davidhadas
Copy link
Member Author

@Xynnn007, an entity having privileges to add a resource should also have the privilege to delete it.

It seems that there are two types of approaches that are now being served:

  • Clients authenticated using an attestation token can read keys
  • Clients authenticated using a key pair can add keys (I assume also read keys) and here it is suggested that these clients would also be able to remove keys. << I think this is the closest thing we have now to "Admins"

Keys are now stored in localFS, it is suggested here that the key files would be deleted when delete is performed.

@mkulke
Copy link
Contributor

mkulke commented May 2, 2024

If there's an endpoint that creates resources then I agree, it makes sense to add one that is able to delete resources for consistency's sake (and probably also PUT /resource to cover the whole CRUD) machinery.

But yeah, if the secrets are backed by some external CSI store (which I'd recommend, atm), it's likely that the resources will be read-only to KBS and those write calls will fail.

Maybe we should be able to disable the resource management endpoints via cli option to avoid confusion.

@larrydewey
Copy link
Contributor

I agree that if we are going to add in administrative permissions, we should definitely make it a complete story. That being said, I don't necessarily agree that we should be doing any hard-deletes of any data, though. Compliance laws definitely differ by country, so we should be careful about how we roll this out. Perhaps have it be configurable, or perform a soft-delete and require manual pruning of the records?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants