Skip to content

Commit 72c796e

Browse files
committed
fix: tighten APPMAP env var filter to avoid matching APPMAPX_* etc.
Addresses Copilot review feedback on #386: startswith(("APPMAP", "_APPMAP")) also matched unrelated variables like APPMAPX_FOO. Match the exact APPMAP/_APPMAP names plus the APPMAP_/_APPMAP_ prefixes instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Nw1eEFHvABs5hdjMej5bf
1 parent 47500de commit 72c796e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

_appmap/configuration.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,10 @@ def initialize():
511511
# Only log AppMap's own settings, never the full environment: arbitrary
512512
# environment variables (API keys, credentials, tokens, etc.) must never
513513
# end up in application logs.
514-
appmap_env = {k: v for k, v in os.environ.items() if k.startswith(("APPMAP", "_APPMAP"))}
514+
appmap_env = {
515+
k: v
516+
for k, v in os.environ.items()
517+
if k in ("APPMAP", "_APPMAP") or k.startswith(("APPMAP_", "_APPMAP_"))
518+
}
515519
logger.info("env: %r", appmap_env)
516520
os.environ["_APPMAP_MESSAGES_SHOWN"] = "true"

0 commit comments

Comments
 (0)