khoj icon indicating copy to clipboard operation
khoj copied to clipboard

Refactor: Moving environment variables of docker-compose.yml to .dockercompose_env file

Open DharunKumar04 opened this issue 11 months ago • 2 comments

Move Environment Variables to env File

Refactored the setup to move environment variables from docker-compose.yml to a .dockercompose_env file for better maintainability. This makes managing secrets easier and keeps the docker-compose.yml cleaner.

DharunKumar04 avatar Jan 09 '25 07:01 DharunKumar04

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard. Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
10005301 Triggered Generic Password 2da3c5503419ca6953e27f78f8d432230f857d26 docker-compose.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

gitguardian[bot] avatar Jan 09 '25 07:01 gitguardian[bot]

@sabaimran / @debanjum This will improve user experience for self hosting options .

DharunKumar04 avatar Jan 09 '25 07:01 DharunKumar04

Hi @DharunKumar04 thanks for the PR. It was a good idea to try handle all the environment in a separate file for maintainability.

But the .dockercompose_env doesn't seem to allow specifying which environment variables to share with which containers. Sharing all those environment variables with all the Khoj microservices seems unnecessarily risky. We don't want to expose the KHOJ_ADMIN_PASSWORD environment variable to the other containers. It breaks privilege minimization (requires more trust in the other containers than necessary). It'd be ideal if the environment variables could be specified in a single separate.

Let me know if you have other thoughts or ideas but I'll close this PR for now.

debanjum avatar May 12 '25 15:05 debanjum