rfc/20231107-registry-gpg-key-verification.md
Issue: https://github.com/opentofu/opentofu/issues/832
[!NOTE]
This RFC was originally written by @Yantrio and was ported from the old RFC process. It should not be used as a reference for current RFC best practices.
Building upon the foundations laid out in the Homebrew-like Registry RFC (issue #741) and related to the Stable Registry Repository Folder Structure (issue #827), this document proposes a secure method to handle GPG keys within our Registry. The use of GPG keys is critical for the validation of provider artifacts, as it enables users to verify the integrity and the origin of the content they rely on.
Provider authors will need to be able to upload their public GPG keys to a dedicated directory within the registry's GitHub repository. These keys will then be employed, or will have already been employed to sign the SHASUMS of the artifacts, providing a layer of trust and verification for clients consuming these resources.
To maintain the registry's integrity, it is essential that the process of uploading GPG keys is tightly controlled. We must enforce comprehensive validation steps to ascertain that individuals uploading GPG keys are authorized to do so and that the keys themselves are genuine. The goal of this validation process is to protect against a spectrum of security threats, including but not limited to impersonation and man-in-the-middle attacks.
In the development of the registry, an important consideration has been the balance between automation and human intervention in the verification of GPG key uploads. Our mission is to streamline the process, enhancing both efficiency and security. While an entirely automated system could significantly expedite operations, security is inherently strengthened when approached with a multitude of measures.
The recommended approach is a hybrid system where automation serves as the first line of defense, assisting in the preliminary verification of GPG keys and the identities of their submitters. This system is designed to facilitate rapid processing of GPG key submissions while establishing a rigorous security protocol.
For creating an automated suite of checks, a suite of individual github actions can be applied whenever a GPG key is uploaded. Small, individual checks allow us to extend the suite of checks in the future, and also quickly see at a glance, as humans, which of these checks has failed. It also means that the checks can be written in a multitude of languages/approaches (Bash for simple, golang for complicated).
In developing a secure and efficient workflow for the Opentofu registry, the following automated verification steps should be implemented for GPG key submissions:
Key Format Verification:
GitHub Organization Membership Validation:
Contributor Activity Check:
Key Expiry Assessment:
Key Usage Compatibility:
Identity Verification:
Artifact Signing Check:
Certificate Revocation Status (Stretch Goal):
This comprehensive automated verification workflow is designed to pre-screen submissions thoroughly before human review. While the goal is to automate rigorously, the system acknowledges the complexity of security and the need for a final human evaluation to ensure the utmost integrity of the Opentofu registry.
After the automated checks are completed, the role of human oversight becomes crucial. The process mandates that:
This level of human intervention serves as a robust safeguard against the exploitation of potential vulnerabilities in the automated system.
The primary trade-off of this hybrid approach is the introduction of additional latency in the GPG key approval process due to the requirement of human oversight. This extra step necessitates an allocation of human resources and could extend the time taken for keys to be integrated into the registry. However we hope that the improvement of the Automation as an aid to the human verification reduces this trade-off in the long-term.
Despite the trade-off, the hybrid model is essential to maintain the integrity of the Opentofu registry. By combining automated pre-checks with human validation, we create a dynamic defense system capable of adapting to new threats and anomalies. I advocate for this model as it establishes a robust verification mechanism while retaining the flexibility to evolve with the changing landscape of cybersecurity threats.
Could we ever switch thisti a fully automated process? Perhaps as we become more confident in the automation?