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

Use a AWS Secret Manager for DB credentials #126

Open
8 tasks
poundifdef opened this issue Mar 18, 2024 · 9 comments · May be fixed by #135 or #161
Open
8 tasks

Use a AWS Secret Manager for DB credentials #126

poundifdef opened this issue Mar 18, 2024 · 9 comments · May be fixed by #135 or #161

Comments

@poundifdef
Copy link
Contributor

Today, the pkg/storage/database package is responsible for fetching the credentials for a database. That interface contains a function called GetDestinationCredentials().

We want to refactor the code to use a separate package for managing secrets.

Step 1: Create pkg/storage/vault package

This will follow the same pattern as the pkg/storage/blobstore package, where different storage types can be configured.

  • The new vault package should have an interface which has two functions: GetCredential(name string) string and SetCredential(name, value string)
  • There should be a default implementation called memory which just returns credentials from config.Destination in YAML. The implementation should basically be identical to the existing functionality here.
  • There should be a new configuration section in our yaml file called vault which has the same format as the database section (type and settings.)

Step 2: Refactor code to use the new vault package instead of database

  • Delete the GetDestinationCredentials() function from the Database interface.
  • Refactor the code to use our new vault instead. This means updating GetStorageServices() to include a Vault as part of the struct and replacing any use of GetDestinationCredentials() to use our new vault instead

Step 3: AWS Secrets Manager

Create a new implementation of the Vault interface which uses AWS Secrets manager

  • Create a new package under vault for AWS.
  • Use the go-v2 API to implement the vault interface
  • The configuration file should take AWS credentials (access id, secret key) along with a prefix. When keys are created or retrieved, we should add this prefix.
@poundifdef poundifdef changed the title Use a vault for DB credentials Use a AWS Secret Manager for DB credentials Mar 18, 2024
@poundifdef
Copy link
Contributor Author

/bounty 150

Copy link

algora-pbc bot commented Mar 18, 2024

💎 $150 bounty created by scratchdata
🙋 If you start working on this, comment /attempt #126 along with your implementation plan
👉 To claim this bounty, submit a pull request that includes the text /claim #126 somewhere in its body
📝 Before proceeding, please make sure you can receive payouts in your country
💵 Payment arrives in your account 2-5 days after the bounty is rewarded
💯 You keep 100% of the bounty award
🙏 Thank you for contributing to scratchdata/scratchdata!

👉 Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🔴 @ezhil56x Mar 19, 2024, 9:22:47 AM WIP
🟢 @uniAIDevs Mar 21, 2024, 11:53:44 AM WIP
🟢 @mehulmathur16 #135

@mehulmathur16
Copy link
Contributor

@poundifdef can I be assigned?

@ezhil56x
Copy link
Contributor

ezhil56x commented Mar 19, 2024

/attempt #126

Algora profile Completed bounties Tech Active attempts Options
@ezhil56x    1 scratchdata bounty
+ 15 bounties from 9 projects
JavaScript, TypeScript,
Rust & more
Cancel attempt

@uniAIDevs
Copy link

uniAIDevs commented Mar 21, 2024

/attempt #126 I'll be using a combination of AI agents and my own knowledge with AWS systems. Should be done today.

@mohanish2504
Copy link
Contributor

mohanish2504 commented Mar 23, 2024

@poundifdef

A doubt here.

GetCredential(name string) string
should just return yaml string? or whole connection string? In case of memory

@poundifdef
Copy link
Contributor Author

Good question. This new interface should just return a string. Then the code can decode that into a golang struct as needed. The vault should not care about what kind of data is being stored, it should just be a "dumb" pipe to get and set key/value pairs.

Copy link

algora-pbc bot commented Mar 24, 2024

💡 @mehulmathur16 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Apr 4, 2024

🎉🎈 @mehulmathur16 has been awarded $150! 🎈🎊

@breadchris breadchris linked a pull request Apr 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment