This repository was archived by the owner on Aug 25, 2026. It is now read-only.
fix(cognee): load allowlisted env files safely - #22
Merged
Merged
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Cognee live lookup can now load its required environment from
FM_COGNEE_ENV_FILEwithout sourcing or evaluating that file. The loader accepts only the Cognee names the wrapper needs, keeps existing exported environment behavior, ignores unrelated names, and fails closed with secret-safe reasons for unreadable or malformed dotenv input.The lookup path still calls only
POST /api/v1/searchin live mode, treats Cognee output ashint_only, requires local source verification, and never authorizes external actions.Testing
tests/fm-cognee-lookup.test.shtests/fm-cognee-telemetry.test.shbash tests/fm-cognee-lookup-gate.test.shbash tests/fm-cognee-source-verify.test.shbash -n bin/fm-cognee-lookup.sh bin/fm-cognee-telemetry-lib.sh tests/fm-cognee-lookup.test.sh && git diff --checkAlso attempted
for t in tests/*.test.sh; do bash "$t"; done; it reached the Firstmate primary-checkout tangle guard and failed because this isolated ship worktree is intentionally onfm/cognee-safe-env-loader-0629, notmain.Post-Deploy Monitoring & Validation
No additional production monitoring is required by default because this is disabled unless an operator sets
FM_COGNEE_ENV_FILEfor the lookup process.When enabled for a manual Cognee lookup, validate for one lookup window:
reason=env_file_unreadable,reason=env_file_malformed,reason=missing_required_env,external_action_authorized=false.mode=live, returnscognee_answer_status=hint_only, and source verification reportsverified_local_sourceor a clear fail-closed reason.FM_COGNEE_ENV_FILEand rely on already-exported environment variables, or leave Cognee lookup disabled.