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 1password-credentials secret injection #193

Closed
wants to merge 1 commit into from
Closed

Fix 1password-credentials secret injection #193

wants to merge 1 commit into from

Conversation

demon
Copy link

@demon demon commented May 1, 2024

Using the credentials as OP_SESSION is confusing, as it requires you to base64 encode the 1password-credentials.json file first. That's on top of having to base64 encode the secret in k8s. This twice base64- encoding is undocumented and unintuitve.

Since connect supports reading the credentials from disk, and we already create the volume from the secret anyway, just follow thru and mount the credentials at the expected location. I imagine this was the intent at some point.

As a sidebar: it was extra weird to find that OP_SESSION has a second use: it can also be used to override the location of 1password-credentials.json. I would advise separating these into two separate environment variables but that's out of scope for this change.

Finally, since we're mounting the file and not trying to double-base64 the data, swap stringData for data in the secret.

Obsoletes pull request #113, fixes issue #163 and issue #94, makes some progress on issue #167.

Copy link
Contributor

github-actions bot commented May 1, 2024

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

Using the credentials as `OP_SESSION` is confusing, as it requires you
to base64 encode the 1password-credentials.json file first. That's on
top of having to base64 encode the secret in k8s. This twice base64-
encoding is undocumented and unintuitve.

Since connect supports reading the credentials from disk, and we already
create the volume from the secret anyway, just follow thru and mount the
credentials at the expected location. I imagine this was the intent at
some point.

As a sidebar: it was extra weird to find that `OP_SESSION` has a second
use: it can also be used to override the location of
`1password-credentials.json`. I would advise separating these into two
separate environment variables but that's out of scope for this change.

Finally, since we're mounting the file and not _trying_ to double-base64
the data, swap `stringData` for `data` in the secret.

Obsoletes pull request #113, fixes issue #163 and issue #94, makes some
progress on issue #167.

Signed-off-by: Chad Horohoe <[email protected]>
@demon demon closed this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant