Skip to content

fix(security): encrypt API key in config file (#100) - #128

Closed
duongynhi000005-oss wants to merge 1 commit into
ByteBell:mainfrom
duongynhi000005-oss:fix/100-encrypt-api-key
Closed

duongynhi000005-oss wants to merge 1 commit into
ByteBell:mainfrom
duongynhi000005-oss:fix/100-encrypt-api-key

Conversation

@duongynhi000005-oss

Copy link
Copy Markdown

Fixes #100## Problemopenrouter_api_key is stored as plaintext in ~/.bytebell/config.json. Any process running as the same OS user can read it.## SolutionEncrypts sensitive fields using AES-256-GCM with a machine-derived key before writing to disk.### Changes:- packages/config/src/crypto.ts (new): Encryption/decryption using node:crypto- packages/config/src/writer.ts: Encrypts sensitive fields before save- packages/config/src/loader.ts: Decrypts on read- Backward compatible with existing plaintext configs

The openrouter_api_key was stored as plaintext in ~/.bytebell/config.json.
Any process running as the same OS user could read it with a single
.

Now encrypts sensitive fields (openrouter_api_key, neo4j_password) using
AES-256-GCM with a machine-derived key before writing to disk.

- Added crypto.ts with encrypt/decrypt functions
- Writer encrypts sensitive fields before saving
- Loader decrypts on read
- Backward compatible with existing plaintext configs

Fixes #100
@bharatsachya
bharatsachya self-requested a review June 5, 2026 09:13

@bharatsachya bharatsachya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Won't work

@bharatsachya
bharatsachya self-requested a review June 5, 2026 10:52

@bharatsachya bharatsachya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#129

Hi!! Great Attempt but this won't work in opensource look into this PR that i have added in review you will be able to find that we can use features of macos and windows and do not have to worry about encryption

Other things encryption won't work as our code is public and this makes you code vulenrable of attack

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.

[bug] openrouter_api_key stored as plaintext in ~/.bytebell/config.json

2 participants