This repository was archived by the owner on Sep 19, 2024. It is now read-only.
refactor: decrypt PK when it is used#858
Open
rndquu wants to merge 2 commits intoubiquity:developmentfrom
Open
refactor: decrypt PK when it is used#858rndquu wants to merge 2 commits intoubiquity:developmentfrom
rndquu wants to merge 2 commits intoubiquity:developmentfrom
Conversation
✅ Deploy Preview for ubiquibot-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
wannacfuture
previously approved these changes
Oct 13, 2023
whilefoo
previously approved these changes
Oct 13, 2023
cuddle-dev
previously approved these changes
Oct 16, 2023
9c58746
whilefoo
approved these changes
Oct 17, 2023
| networkId: networkId, | ||
| rpc: rpc, | ||
| privateKey: privateKey, | ||
| privateKeyEncrypted: privateKeyEncrypted || null, |
Collaborator
There was a problem hiding this comment.
privateKeyEncrypted is already string | undefined, so I think converting it to string | null is unnecessary step, but not a big deal.
It would also simplify Type.Union([Type.Null(), Type.String()]) into Type.Optional(Type.String())
Member
There was a problem hiding this comment.
null is more expressive that it is intentionally set to a void value instead of some type of mistake happening.
0x4007
approved these changes
Oct 31, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the code so that partner's wallet private key is decrypted only when the payment permit is about to be generated.
Rationale
We're about to expose the bot's logs to the public. Right now partners' wallets private keys are decrypted on github webhook event. It is pretty easy to leak those PKs via smlth like
logger.info(JSON.stringify(bot.config)). So this PR makes sure that partners' PKs are encrypted in the initial bot config and decrypted only when necessary (i.e. before the permit generation).QA issue run with the bot instance from the current PR's branch: rndquu-org/test-repo#48