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

Confusion in the community around Secrets #32564

Open
dims opened this issue Mar 27, 2022 · 13 comments
Open

Confusion in the community around Secrets #32564

dims opened this issue Mar 27, 2022 · 13 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. language/en Issues or PRs related to English language needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@dims
Copy link
Member

dims commented Mar 27, 2022

We have a very decent page around Secret(s) here:
https://kubernetes.io/docs/concepts/configuration/secret/#information-security-for-secrets

Unfortunately we repeatedly see:

One recent question/observation i had internally was - Does anyone actually care about leaking k8s secrets to the console? I was working with some OSS code and they were explicitly redacting the k8s secrets data from API requests but its just base64 encoded by default so its like security by obfuscation. it is just really unintuitive at first sight when something is called a secret but its just base64 encoded and not encrypted by default. Its not clear what makes it a 'secret' in the simplest case

How do make this better? clearer? especially things like: ( hat tip to @cppforlife )

  • at rest, secrets might be encrypted or unencrypted (depends on k8s config used)
  • in flight, secrets go over TLS
  • in flight, secret access is controller via RBAC
  • API format uses base64 encoding to support binary and non-binary secret contents

While we are at it, could we write down guidance for logging secrets ... to say don't log the contents of it? :)

thanks!
-- Dims

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Mar 27, 2022
@dims
Copy link
Member Author

dims commented Mar 27, 2022

cc @nikhita @MadhavJivrajani @palnabarun (can one of you please see how we can update existing documentation?)

@johnSchnake
Copy link

FWIW I was the quoted person asking about the "leaking of secrets to the console"

After being pointed to a few resources my thoughts were this:

I think the most clear answer is the last comment on the stackoverflow issue; which also gives practical examples of a few workflows that would be awkward if k8s secrets didnt exist. Yes they could be configmaps or stored with other data, but then access control and encryption would apply to both equally. The separate data type just provides a means of singling them out when necessary.

It seems like its a case of the community:

  • identifying the need for secrets
  • splitting the implementation in two (k8s secret type vs actual secret encryption/storage)
  • it not being clear that the object (k8s.secret) is only half of the solution to 'keeping a secret'

It's still slightly unclear why leaking them to console would be bad; if users didn't encrypt them its assumed they aren't sensitive and if they do encrypt them it doesn't matter if you print them. However, I can understand the general design of secrets better by understanding that its necessary condition for "actual-secrets" but not a sufficient one. Being part of that chain of security makes sense why we should, by convention, not leak them in principle.

@dims
Copy link
Member Author

dims commented Mar 27, 2022

@johnSchnake let's use this issue to reflect what is currently the design/implementation.

Any future suggestions, we take it to sig-auth for debate and resolution. Let's keep the two separate please.

thanks!

@reylejano
Copy link
Member

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 28, 2022
@sftim
Copy link
Contributor

sftim commented Mar 28, 2022

/language en
/kind feature

/priority backlog
(but definitely nice-to-have)

@k8s-ci-robot k8s-ci-robot added language/en Issues or PRs related to English language kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. labels Mar 28, 2022
@sftim
Copy link
Contributor

sftim commented Mar 28, 2022

My take on this is that the problem is mostly not the Secret API itself; instead, it's the huge amount of effort you have to go to if you want to restrict reading it back (and still allow it to be useful to the Pod, or whatever, that needs to use it). Encryption at rest gets you nothing if too many people can ask the API server for the plaintext.

I'm not sure how far we can get at documenting that but we can at least point out how important access control measures are when you have valuable Secrets.

There's probably a KEP or similar that would cover a more complicated design using asymmetry, where the API server does not have direct access to the plaintext of a Secret at any point, or maybe not after initial encryption. The only part of that that I'd want to cover in docs would be to make it clear that access to read the metadata of Secret always also means access to all its fields, including the plaintext.

@dims
Copy link
Member Author

dims commented May 1, 2022

@sftim : +1 to documenting The only part of that that I'd want to cover in docs would be to make it clear that access to read the metadata of Secret always also means access to all its fields, including the plaintext.

@sftim
Copy link
Contributor

sftim commented Jul 14, 2022

We could document that you, a cluster operator, have the option of adding your own authz mechanism to restrict direct Secret readback, and that you can also use admission control to limit indirect readback by creating a Pod / Pod template.

Is that useful?

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 12, 2022
@reylejano
Copy link
Member

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 12, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 10, 2023
@divya-mohan0209
Copy link
Contributor

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 5, 2023
@k8s-triage-robot
Copy link

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

  • Confirm that this issue is still relevant with /triage accepted (org members only)
  • Close this issue with /close

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. and removed triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. language/en Issues or PRs related to English language needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

7 participants