
Security News
pnpm 10.12 Introduces Global Virtual Store and Expanded Version Catalogs
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
github.com/immutablet/k8s-secrets-and-gitops
GitOps (or operations by git commits), in the context of k8s, is the approach where a Git repository provides a source of truth for clusters’ configuration. Thus enabling facilities such as version control, history, peer review, and rollback of clusters’ configuration to happen through Git. The inclusion of K8S Secrets (and other security sensitive K8S resources) into GitOps workflows poses some challenges - we should not store secrets in clear text in Git (even if Git repo is private). This document outlines a strategy of how to securely store K8S Secrets in version control repositories such as Git.
There are three personas involved in the below described workflows (though depending on the environment all of these personas may be manifested by a single user):
This approach mimics the encrypted email workflow where senders encrypt messages using the public key of the recipient. Secure exchange of messages hinges on the use of a common standard for the serialization of encrypted/signed messages, so that the process is independent of email client/provider.
Three standards were reviewed and JSON Web Encryption (JWE) appears to be the best fit for this scenario. For the analysis of reviewed standards and the rationale for the selection of JWE see appendix 3.
The responsibility of decrypting confidential fields within incoming requests for creating secrets will be delegated to a mutating webhook. Such a webhook will expect that incoming secrets (specifically the confidential part) may have been encrypted outside Kubernetes (see example below).
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
Data:
# encrypted value supplied by a Secret's Custodian
dba-pwd: YWRt...snip...W4==
When the mutating webhook encounters a resource where confidential sections (values of a secret) are enveloped using JSON Web Encryption (JWE) serialization format, it will perform the following steps before passing it back to kube-apiserver:
At this point, the mutating webhook will have a “regular” secret object (no ciphertext values), which it returns to kube-apiserver. Assuming that the kube-apiserver is configured with a KMS Provider, upon reaching the Storage layer of kube-apiserver, this secret will be encrypted in full according to the supplied Encryption Config.
KMS Manager
gcloud beta kms keys create [KEY_NAME] \
--location [LOCATION] \
--keyring [KEYRING_NAME] \
--purpose ASYMMETRIC_DECRYPT \
--default-algorithm rsa-decrypt-oaep-4096-sha256
gcloud beta kms keys versions \
get-public-key [CRYPTO_KEY_VERSION] \
--location [LOCATION] \
--keyring [KEY_RING] \
--key [KEY_NAME] \
--output-file ~/mykey.pub
Secrets Custodian
JWE=$(echo "P@ssw0rd" | jose-util encrypt --full \
--key "/tmp/key.pub" --alg "RSA-OAEP-256" \
--enc "A128CBC-HS256")
cat > encrypted-secret-k8s.yaml <<EOF
kind: Secret
stringData:
password: ${JWE}
EOF
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
webhooks:
- name: secrets-demo.kubecon-eu.info
rules:
- apiGroups: [""]
apiVersions: ["v1"]
operations: ["CREATE", "DELETE"]
scope: "Namespaced"
clientConfig:
url: "https://jwe-webhook-farm.example.com/secrets"
caBundle: Ls0tLs1CRUdJtiBDRVJUSUZJQ0FURS0t...
The next time when CI/CD pipeline runs the sealed secret will be added to the kube-apiserver and become available to applicatoins.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.