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

feat: Secret config reader to work with base64 and ASCII values #1774

Merged
merged 3 commits into from
Nov 10, 2023

Conversation

jachro
Copy link
Contributor

@jachro jachro commented Nov 3, 2023

This PR changes the crypt secret config reader so it can read ASCII and base64 encoded values.

closes #1768

/deploy

@jachro jachro requested a review from a team as a code owner November 3, 2023 15:13
Copy link
Member

@eikek eikek left a comment

Choose a reason for hiding this comment

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

👍🏼

ByteVector.fromBase64Descriptive(b64).flatMap(apply)

def unsafeFromBase64(b64: String): Secret =
fromBase64(b64).fold(sys.error, identity)

implicit def secretReader: ConfigReader[Secret] =
base64ByteVectorReader.emap(bv =>
Secret(bv.takeWhile(_ != 10)).leftMap(err =>
base64SecretReader orElse asciiSecretReader
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean, the ascii secret must not be valid base64? This could happen in theory, perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I know what you mean. It can happen and yes, if it does it's quite unlikely it will be 16, 24 or 32 chars long after decoding. We'll simply fail horrendously. To be honest I don't really see an easy solution for that assuming we'd like to have a single secret entry in the helm config. From the other side, I guess our yat will be the only people who generate the values (in an automatic way), so perhaps that's acceptable. What do you think? I can talk to Alessandro and check if they are happy with that.

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine of course. Just worth noting, I guess. If it occurs, it will be something hard to find in a year 😄 And might be a support case for deployments not on our control. But agree that it is not very likely. And if we are limited by helm or whatever other tool, I think there is not much we can do.

@jachro jachro deployed to renku-ci-gr-1774 November 6, 2023 09:35 — with GitHub Actions Active
@RenkuBot
Copy link
Collaborator

RenkuBot commented Nov 6, 2023

You can access the deployment of this PR at https://renku-ci-gr-1774.dev.renku.ch

@jachro jachro merged commit 0102c0d into development Nov 10, 2023
@jachro jachro deleted the 1768-secrets-reading branch November 10, 2023 12:55
@jachro jachro mentioned this pull request Nov 15, 2023
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.

Make Webhook service and Token Repository more flexible in taking input secret
3 participants