fix: harden extension templates and APE API key verification#849
Merged
Lightheartdevs merged 1 commit intoLight-Heart-Labs:mainfrom Apr 8, 2026
Merged
Conversation
Bind template port mappings to 127.0.0.1 to prevent LAN exposure, and use secrets.compare_digest for constant-time API key comparison in APE to prevent timing attacks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Lightheartdevs
approved these changes
Apr 8, 2026
Collaborator
Lightheartdevs
left a comment
There was a problem hiding this comment.
APPROVE — security hardening. APE API key comparison changed from != to secrets.compare_digest() (timing attack fix). Extension templates hardened to 127.0.0.1 binding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
127.0.0.1:prefix to port bindings in extension compose templatessecrets.compare_digestWhy
"${PORT}:1234"), teaching community extension authors the wrong pattern — LAN-exposed by default. All deployed services already bind to127.0.0.1.!=for API key comparison. All other services (dashboard-api, host-agent, token-spy, privacy-shield) usesecrets.compare_digest().How
compose-template.yaml:61andcompose-gpu-only.yaml:64: prefixed with127.0.0.1:ape/main.py:249:x_api_key != API_KEY→not secrets.compare_digest(x_api_key or "", API_KEY)(secretsalready imported)Testing
Platform Impact