-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix: add root encryption key in the examples env #4919
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
base: main
Are you sure you want to change the base?
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Greptile OverviewGreptile SummaryThis PR attempts to fix docker-compose deployment issues with FIPS-enabled images by adding Changes:
Critical Issue:
Confidence Score: 1/5
Important Files ChangedFile Analysis
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 1 comment
|
|
||
| // note(daniel): for some reason this resolves as true for some hex-encoded strings. | ||
| if (!isBase64(appCfg.ENCRYPTION_KEY)) { | ||
| if (!encryptionKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: this check will always evaluate to false since encryptionKey was already verified to be truthy in line 139. This means the validation is skipped entirely.
| if (!encryptionKey) { | |
| if (!Buffer.from(encryptionKey, "base64")) { |
varonix0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes can be removed, except for the .env.example file, left a comment to explain
| # Used for compatibility with the FIPS image | ||
| # THIS IS A SAMPLE ENCRYPTION KEY AND SHOULD NEVER BE USED FOR PRODUCTION | ||
| ROOT_ENCRYPTION_KEY=RQKPV9co/vf3N7DFBBTu82exLjtTcMLXWjuHBZAjazA= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIPS doesn't use the ROOT_ENCRYPTION_KEY variable. It still uses the ENCRYPTION_KEY variable, internally transforms it to ROOT_ENCRYPTION_KEY.
| # Used for compatibility with the FIPS image | |
| # THIS IS A SAMPLE ENCRYPTION KEY AND SHOULD NEVER BE USED FOR PRODUCTION | |
| ROOT_ENCRYPTION_KEY=RQKPV9co/vf3N7DFBBTu82exLjtTcMLXWjuHBZAjazA= | |
| # Used for compatibility with the FIPS image. When using FIPS, a base64-encoded 32-bit key is required. | |
| # THIS IS A SAMPLE ENCRYPTION KEY AND SHOULD NEVER BE USED FOR PRODUCTION | |
| ENCRYPTION_KEY=RQKPV9co/vf3N7DFBBTu82exLjtTcMLXWjuHBZAjazA= |
|
|
||
| const $getBasicEncryptionKey = () => { | ||
| const encryptionKey = envConfig.ENCRYPTION_KEY || envConfig.ROOT_ENCRYPTION_KEY; | ||
| const encryptionKey = envConfig.ROOT_ENCRYPTION_KEY || envConfig.ENCRYPTION_KEY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed, since we are using ENCRYPTION_KEY
| hsmService: THsmServiceFactory, | ||
| kmsRootConfigDAL: TKmsRootConfigDALFactory, | ||
| envCfg?: Pick<TEnvConfig, "ENCRYPTION_KEY"> | ||
| envCfg?: Pick<TEnvConfig, "ENCRYPTION_KEY" | "ROOT_ENCRYPTION_KEY"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| } | ||
|
|
||
| if (bytesToBits(Buffer.from(appCfg.ENCRYPTION_KEY, "base64").length) !== 256) { | ||
| if (bytesToBits(Buffer.from(encryptionKey, "base64").length) !== 256) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above applies for all other changes except the .env.example file
Description 📣
Fix this issue #4900
Type ✨
Tests 🛠️