Startup configuration logging of connections and connections map - #474
Merged
Rodrigo Brandão (rodrigobr-msft) merged 9 commits intoJul 21, 2026
Merged
Conversation
…microsoft/Agents-for-python into users/robrandao/startup-logging
Rodrigo Brandão (rodrigobr-msft)
marked this pull request as ready for review
July 17, 2026 17:10
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 17, 2026 17:10
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds secure startup logging for authentication connection configuration in the hosting-core layer, including redaction/summarization helpers and unit tests, and tightens configuration normalization for CONNECTIONSMAP/handler defaults.
Changes:
- Introduces
authorization/_log_config.pyto summarize authentication configs and connection maps with redaction, and logs this summary fromConnectionManagerconstruction. - Normalizes configuration defaults (
CONNECTIONSMAPnow defaults to[]; handler config defaults are hardened). - Adds comprehensive unit tests covering redaction, summarization, and parameterized logging behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/hosting_core/test_log_config.py | Adds unit tests validating redaction/summarization outputs and logger parameterization. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/authorization/connection_manager.py | Logs a redacted configuration summary on initialization and normalizes CONNECTIONSMAP shape. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/authorization/_log_config.py | Implements redaction + summarization utilities and _log_config() for safe config logging. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/authorization.py | Makes handler config parsing more robust by defaulting missing config sections/fields. |
| libraries/microsoft-agents-activity/microsoft_agents/activity/config/_load_configuration.py | Changes CONNECTIONSMAP default from {} to [] for consistent runtime typing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Kyle Rohn (kylerohn-msft)
approved these changes
Jul 21, 2026
Rodrigo Brandão (rodrigobr-msft)
enabled auto-merge (squash)
July 21, 2026 18:21
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 21, 2026 18:22
View session
Rodrigo Brandão (rodrigobr-msft)
merged commit Jul 21, 2026
6cf047e
into
main
10 of 11 checks passed
Rodrigo Brandão (rodrigobr-msft)
deleted the
users/robrandao/startup-logging
branch
July 21, 2026 18:24
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/authorization/_log_config.py:77
- _redact_url() relies on urlparse() raising for invalid/non-URL inputs, but urlparse() typically does not raise. For values like regex patterns (e.g., CONNECTIONSMAP SERVICEURL can be "agentic"), this currently logs as "://...", which is confusing and not a valid redaction output. Consider treating inputs without both scheme and netloc as non-URLs and returning "...".
try:
url_parsed = urlparse(url)
return f"{url_parsed.scheme}://{url_parsed.netloc}/..."
except Exception:
return "..."
Comment on lines
+120
to
+122
| IDPM_RESOURCE=SkipNone(_redact_url_or_none(config.IDPM_RESOURCE)), | ||
| AZURE_REGION=SkipNone(_redact_url_or_none(config.AZURE_REGION)), | ||
| ANONYMOUS_ALLOWED=str(config.ANONYMOUS_ALLOWED), |
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.
This pull request introduces logging and redaction utilities for authentication configuration, improves configuration handling, and adds comprehensive tests. The main focus is on securely logging authentication-related configuration while ensuring sensitive data is not exposed. Below are the most important changes:
Logging and Redaction Utilities
_log_configand related redaction helper functions (e.g.,_redact_str,_redact_url,_summarize_auth_configs) inauthorization/_log_config.pyto safely log authentication configuration by redacting secrets and summarizing sensitive fields._log_configinto theConnectionManagerclass to automatically log the configuration summary (with secrets redacted) when a new instance is created. [1] [2]Configuration Handling Improvements
CONNECTIONSMAPinload_configuration_from_envto an empty list instead of an empty dict, ensuring consistent type usage.authorization.py, ensured handler configuration defaults to an empty dict if not present, and made handler type default to an empty string instead ofNone.ConnectionManagerto always use a list, handling both dict and list input.Testing
test_log_config.pywith comprehensive unit tests for all redaction and logging utilities, verifying correct redaction of secrets, proper summarization, and correct logging behavior.