fix: use profile-scoped get_secret for MATRIX_RECOVERY_KEY (#69090) - #70633
Closed
JonthanaHanh wants to merge 1 commit into
Closed
fix: use profile-scoped get_secret for MATRIX_RECOVERY_KEY (#69090)#70633JonthanaHanh wants to merge 1 commit into
JonthanaHanh wants to merge 1 commit into
Conversation
…rch#69090) In multi-profile gateway mode, os.getenv() reads from the process environment which holds the default profile's value. This caused non-default profiles to use the wrong recovery key, resulting in "Key MAC does not match" E2EE verification failures. Replace os.getenv('MATRIX_RECOVERY_KEY') with get_secret() from agent.secret_scope which honors the active profile's .env file. Closes NousResearch#69090
Collaborator
Duplicate of #69110. It implements the same profile-scoped recovery-key mechanism, including the unscoped multiplex fallback and focused regression coverage; this narrower patch omits those safeguards. |
1 task
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.
Summary
os.getenv("MATRIX_RECOVERY_KEY")with profile-scopedget_secret("MATRIX_RECOVERY_KEY", "")in the Matrix adapterRoot Cause
In multi-profile gateway mode (
gateway.multiplex_profiles), the Matrix adapter readsMATRIX_RECOVERY_KEYusingos.getenv(). Sinceos.environis process-global, every profile reads the default profile's recovery key from the process environment. Non-default profiles' recovery keys (stored in their<profile>/.env) are never read, causing "Key MAC does not match" E2EE verification failures.Fix
Replace
os.getenv("MATRIX_RECOVERY_KEY", "")withget_secret("MATRIX_RECOVERY_KEY", "")fromagent.secret_scope. Theget_secretfunction:os.environfor single-profile deployments (backward compatible)Changed at two call sites:
Test Plan
Closes #69090