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

generate: check for existing public key in manifest #650

Merged
merged 2 commits into from
Jul 4, 2024

Conversation

davidweisse
Copy link
Contributor

If you call generate twice with the same seed share owner public key, the public key would just have been appended to the list instead of checking if the public key is already present in the manifest. Now, calling generate twice will result in the same manifest.

@davidweisse davidweisse requested a review from burgerdev June 27, 2024 14:19
@davidweisse davidweisse requested a review from katexochen as a code owner June 27, 2024 14:19
@davidweisse davidweisse added the no changelog PRs not listed in the release notes label Jun 27, 2024
Copy link
Contributor

@burgerdev burgerdev left a comment

Choose a reason for hiding this comment

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

I'm not sure about this. If I generate twice like this:

contrast generate --seedshare-owner-key=alice.pem deploy.yml
contrast generate --seedshare-owner-key=bob.pem deploy.yml

Would I really expect both alice and bob to be in the manifest? I think it might be less surprising if we cleared out the keys and then added what's given as flag.

@katexochen
Copy link
Member

I'm not sure about this. If I generate twice like this:

contrast generate --seedshare-owner-key=alice.pem deploy.yml
contrast generate --seedshare-owner-key=bob.pem deploy.yml

Would I really expect both alice and bob to be in the manifest? I think it might be less surprising if we cleared out the keys and then added what's given as flag.

We should match the behavior of workload owner keys (or update it, too).

@davidweisse
Copy link
Contributor Author

I'm not sure about this. If I generate twice like this:

contrast generate --seedshare-owner-key=alice.pem deploy.yml
contrast generate --seedshare-owner-key=bob.pem deploy.yml

Would I really expect both alice and bob to be in the manifest? I think it might be less surprising if we cleared out the keys and then added what's given as flag.

This is the current behavior for workload owner keys, as far as I can see.

@Freax13
Copy link
Contributor

Freax13 commented Jul 1, 2024

I'm not sure about this. If I generate twice like this:

contrast generate --seedshare-owner-key=alice.pem deploy.yml
contrast generate --seedshare-owner-key=bob.pem deploy.yml

Would I really expect both alice and bob to be in the manifest? I think it might be less surprising if we cleared out the keys and then added what's given as flag.

We could rename the flag to something like --add-seedshare-owner-key to make it more explicit to the user that we only add keys and don't clear them.

@katexochen
Copy link
Member

We could rename the flag to something like --add-seedshare-owner-key to make it more explicit to the user that we only add keys and don't clear them.

I say that's a good solution, wdyt @burgerdev ?

@burgerdev
Copy link
Contributor

Calling the flags --add-*-key should manage expectations, I agree, so if there's no concrete use-case for idempotency of generate runs I won't object. When we get to actually implement seed sharing, I wonder what the UX would look like for many keys, though - maybe users would rather modify the manifest directly?

davidweisse and others added 2 commits July 4, 2024 10:23
This makes it more obvious to the user that this flag only *adds* keys,
but never removes existing keys.
@Freax13 Freax13 force-pushed the dav/generate-duplicate-pubkeys branch from 29251ec to 6c5cb38 Compare July 4, 2024 08:23
@Freax13
Copy link
Contributor

Freax13 commented Jul 4, 2024

I also applied the change suggested in #670 (comment) to the add-seedshare-owner-key flag here.

@Freax13 Freax13 merged commit fcb5225 into main Jul 4, 2024
8 checks passed
@Freax13 Freax13 deleted the dav/generate-duplicate-pubkeys branch July 4, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PRs not listed in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants