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

Compare only attributes we may have added #8

Closed
wants to merge 4 commits into from

Conversation

camh-
Copy link
Member

@camh- camh- commented Sep 5, 2024

When retrieving secrets that match the attributes we have, ignore any
attributes that we would not have added ourselves. It is conceivable
that another service or the user adds additional attributes to a secret
for their own purposes. We only care about exactly matching the
attributes we would have added ourselves, so do just that.

While we're here, tidy up the SecretService.Store() method and upgrade
the gh command managed by hermit

Attempt to open an encrypted session when opening a session using the
`dh-ietf1024-sha256-aes128-cbc-pkcs7` algorithm specified in the Secret
Service specification. If we fail to open a session with that algorithm,
fall back to a `plain` session. Use the AES key negotiated when opening
the session to encrypt and decrypt the secrets exchanged with the Secret
Service.

The crypto routines in `crypto.go` have been taken from
https://github.com/mvdan/bitw - my thanks go to Daniel Martí for writing
this as it saved me a lot of headaches reading, understanding,
implementing and testing the algorithms as specified in the various
RFCs.

A new dependency = `golang.org/x/[email protected]` has been added, used by
the crypto routines needed to implemented encrypted sessions. Just the
`golang.org/x/crypto/hkdf` package of that module is used.

Turn off the `mnd` (magic number detector) linter as I prefer to decide
when magic numbers are appropriate or not, and not just cargo-cult the
idea that there should be none.
When retrieving secrets that match the attributes we have, ignore any
attributes that we would not have added ourselves. It is conceivable
that another service or the user adds additional attributes to a secret
for their own purposes. We only care about exactly matching the
attributes we would have added ourselves, so do just that.
Tidy up the `SecretService.Store()` method to move the unlock logic to
the top of the function. This keeps code together - code for unlocking
and code for creating the item.

Reverse the test for prompting at the end of the function so it is the
same as the `Delete()` method - i.e. early return for the non-prompt
case. Keep code that does the same thing looking the same.
Upgrade gh from 2.54.0 to 2.55.0. This adds the `--editor`/`-e` flag to
`gh pr create` which is closer in user interface to `hub pull-request`.

This does not matter for this repository, but because this repo does use
`gh` for releases, I need to upgrade it for personal reasons as it gets
used whenever I run `gh` in this repo.

Gen-command: hermit upgrade gh
Copy link
Member

@juliaogris juliaogris left a comment

Choose a reason for hiding this comment

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

💚

@camh- camh- force-pushed the encrypted-sessions branch from ce35151 to 88ac9d6 Compare September 6, 2024 02:25
@camh- camh- deleted the branch encrypted-sessions September 6, 2024 02:26
@camh- camh- closed this Sep 6, 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.

2 participants