Skip to content

🔒 Fix memory leak of raw admin password#106

Merged
scobru merged 1 commit into
mainfrom
fix/memory-leak-admin-password-12006240448961593198
Jun 26, 2026
Merged

🔒 Fix memory leak of raw admin password#106
scobru merged 1 commit into
mainfrom
fix/memory-leak-admin-password-12006240448961593198

Conversation

@scobru

@scobru scobru commented Jun 22, 2026

Copy link
Copy Markdown
Owner

What: Prevent the raw process.env.ADMIN_PASSWORD from persisting in memory.
Risk: Cleartext memory retention could lead to inadvertent leakage or dump exposure.
Solution: Hashing is centralized in utils/security.ts with a cached closure, which immediately zeroes out the environment variable after generating the hash. The cleartext references in config and middleware instances have been completely removed and centralized to validateAdminToken().


PR created automatically by Jules for task 12006240448961593198 started by @scobru

🎯 What: The vulnerability fixed is the cleartext caching of the admin password in the environment configuration and in multiple middleware states.
⚠️ Risk: If the service gets subjected to memory inspection or arbitrary file reads that hit process memory maps, the cleartext admin password could easily be exposed.
🛡️ Solution: Hashing operations and validation states are centralized via `validateAdminToken` in `relay/src/utils/security.ts`. The initial hash generation logic instantly clears `process.env.ADMIN_PASSWORD` from Node.js memory limits. All middlewares, index files, and tests were rewritten to use the new centralized abstraction instead of `authConfig.adminPassword`.

Co-authored-by: scobru <1079164+scobru@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@scobru scobru merged commit 5292304 into main Jun 26, 2026
5 checks passed
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.

1 participant