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

Validate uploaded GPG keys against providers #356

Open
cam72cam opened this issue Apr 3, 2024 · 5 comments · May be fixed by #1423
Open

Validate uploaded GPG keys against providers #356

cam72cam opened this issue Apr 3, 2024 · 5 comments · May be fixed by #1423
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@cam72cam
Copy link
Member

cam72cam commented Apr 3, 2024

Description of the feature you are looking for.

As we've seen in #352, providers can upload the wrong key for providers. We should validate that they key matches the already existing providers in the add key workflow.

@cam72cam cam72cam added enhancement New feature or request help wanted Extra attention is needed labels Apr 3, 2024
@diofeher
Copy link
Member

diofeher commented Jan 2, 2025

From what I understood, the provider name is optional when submitting the provider key:
example: #1408

So the steps for validating would be:

1 - Download the provider file by name, if existing, if not, list the providers in the namespace;
2 - Try to match the GPG Public key to signing of one of these providers
3 - If matches, validates, if not, we display an error to the user asking to match the uploaded key

Is this understanding correct? If not, what should be taken in consideration?

@ollevche
Copy link
Member

ollevche commented Jan 2, 2025

Hey @diofeher!

It sounds reasonable, I would add that we already have the code to download and validate the signature in the tofu itself so it is a good idea to reuse this part.

We might want to check the signatures of all the provider binaries (for different architectures), however, I am not sure if it makes practical sense.

For the third bullet point, I would still check all the providers in the namespace even if some of them are already failed the check. This way we would have a full report of what providers passed and what didn't.

As far as I remember @cam72cam already has some draft code for this one.

@cam72cam
Copy link
Member Author

cam72cam commented Jan 3, 2025

Here is my terrible code main...provider_key_checker, feel free to use parts of that or start from scratch

@diofeher
Copy link
Member

diofeher commented Jan 4, 2025

The GPG Key pull request is usually added after the provider? That's why we can check these provider files (e.g. provider/o/opentofu/aws.json), right?

Thanks for the code @cam72cam and @ollevche for the detailed instructions :)

@diofeher
Copy link
Member

diofeher commented Jan 4, 2025

Hey team, I have a quick question:

How do you verify manually if the key is valid for the provider? I just want to double-check that my code is doing what's expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants