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

Fix: confusing phrasing #639

Merged
merged 6 commits into from
Jan 12, 2024
Merged

Fix: confusing phrasing #639

merged 6 commits into from
Jan 12, 2024

Conversation

bruce-ricard
Copy link
Contributor

  • "generates" isn't the correct word here. CredHub doesn't generate a key. It calculates (or computes) it.

  • "deterministically" IMO can never be used with "generate", as "generate" implies "non deterministically", otherwise it's not generation, it's computation.

  • "site-specific": I don't understand this term, or how it helps make the documentation clearer.

  • "user-defined password": I think that "user-provided" is better.

  • "a key": was changed multiple times to "the key". We are talking about the key that will be used for encryption by CredHub, not any AES key.

  • "lifetime of the server": this precison feels superfluous, and confusing. The lifetime of the CredHub server is so far about 7 years. I understand that the author meant "until the server instance stops running". I thought about rephrasing it, but since IMO it is superfluous, as this is exactly how memory works, I decided to remove it.

  • I should have made multiple commits for this change. Apologies to micro-commit advocates.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

started in internal encryption mode, CredHub deterministically
generates a site-specific AES256 key on startup. CredHub concatenates
a user-defined password from its configuration file with a
started in internal encryption mode, CredHub recalculates
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "calculates" is better? It could be the first time it calculates it, if the user just provided a new encryption password. But it will recalculate it every time after that.

How can we phrase this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble understanding what key it's talking about here. I was assuming it's the key used to encrypt data at rest, but I see that it's changed on startup, which doesn't fit that idea. Is this key used to communicate with clients?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks for sharing that. That is pretty much exactly the confusion I'm trying to solve. Apparently my first attempt is a failure.

It is the key used to encrypt data at rest.

I see that it's changed on startup

Which part makes you say that? Because it's not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version of the docs says that it "generates a site-specific AES256 key on startup" which IMO is very confusing, as it appears that it creates a new key. But it doesn't. It's the same key every time that is computed. That's how it works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. So saying "recalculates" I think is just as confusing as "generates". I don't understand what you're distinguishing between the first startup and subsequent startups, if the action is the same and the resulting key is the same each time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the action is the same and the resulting key is the same each time

Yes

I don't understand what you're distinguishing between the first startup and subsequent startups

Fair enough. So would "calculates" be better then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What made me think it was changed at every startup was "recalculates" and the "randomly generated" part of the salt (as a naive reader). Now that I understand better, I agree that "generate" isn't a good way to explain it. So, yes, I like "calculates". And in the spirit of the "deterministically" part that you removed, maybe a brief explanation like "The key will be the same every time CredHub starts as long as the user-provided password has not changed."

a user-defined password from its configuration file with a
started in internal encryption mode, CredHub recalculates
the AES256 key on startup. To do this, CredHub concatenates
the user-provided encryption password from its configuration file with a
randomly-generated salt stored in its database and hashes the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear from this when CredHub is randomly generating the salt. Could be at every startup from what this says.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. To me, "stored in its database" was enough to explain that it is only generated the first time.

I'm going to rewrite the whole thing, and split it in 2 sections:

  1. what happens the first time
  2. what happens on the next restarts of the server

that should make everything clearer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, the other edits look fine.

@bruce-ricard
Copy link
Contributor Author

Something's wrong with my commit signatures. I have to fix that.


If CredHub is started in internal encryption mode:

* If a new encryption key is provided, CredHub will generate a new
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this say "If a new encryption password is provided"? Is it a password or a key? Same for the bullet below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I struggled to phrase this. It's a bit annoying, because the credhub-release spec talks about encryption keys. But what it expects, in the case of internal keys, is only the password.

So mathematically, an encryption key and the password used to generate it, are the same thing. There's a one to one mapping between keys and passwords.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. So the spec gives most of the details about the key, just not the salt. But we can talk about individual properties of that section of the spec, like encryption_password.

I'm not sure what happens if the user edits the encryption_key_name property.

This design allows CredHub to have access to the AES key at all times,
without ever having to store it on disk.

Passwords and salts cannot be rotated individually, and they are never
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably be simplified. What people most likely care about is the the salt that can't be rotated by itself. This already explains that the salt will be changed when the password is changed. Maybe -

The password and salt are never automatically rotated. Also, the salt cannot be rotated by itself without changing the password.

bruce-ricard and others added 6 commits January 12, 2024 16:32
* "generates" isn't the correct word here. CredHub doesn't generate a
  key. It calculates (or computes) it.

* "deterministically" IMO can never be used with "generate", as
  "generate" implies "non deterministically", otherwise it's not
  generation, it's computation.

* "site-specific": I don't understand this term, or how it helps make
  the documentation clearer.

* "user-defined password": I think that "user-provided" is better.

* "a key": was changed multiple times to "the key". We are talking
  about _the_ key that will be used for encryption by CredHub, not any
  AES key.

* "lifetime of the server": this precison feels superfluous, and
  confusing. The lifetime of the CredHub server is so far about 7
  years. I understand that the author meant "until the server instance
  stops running". I thought about rephrasing it, but since IMO it is
  superfluous, as this is exactly how memory works, I decided to
  remove it.

* I should have made multiple commits for this change. Apologies to
  micro-commit advocates.
* split first and subsequent key uses to explain how the salt is dealt with
* specify that the AES key is always the same, as people were confused about that
* The text after the line break was intended to be part of the heading, but they weren't rendered as part of the heading.
@bruce-ricard bruce-ricard merged commit 0ea898a into main Jan 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants