fix(config): validate persisted settings and MCP hostnames - #35
Open
jung233 wants to merge 2 commits into
Open
Conversation
jung233
force-pushed
the
codex/config-mcp
branch
from
July 17, 2026 08:38
951d7f8 to
ea42a6c
Compare
jung233
marked this pull request as ready for review
July 17, 2026 09:31
There was a problem hiding this comment.
Pull request overview
This PR tightens configuration handling and MCP transport security by introducing validation of persisted numeric settings and adding support for allowing a configured external MCP hostname while keeping DNS rebinding protection enabled.
Changes:
- Add MCP transport security configuration in the server, driven by a new
mcp_server_nameconfig value. - Add centralized config value validation on load and update (type checks, finite numbers, and range checks).
- Update README to document configuring the accepted MCP hostname (including via
MCP_SERVER_NAME).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/scansci_pdf/server.py | Loads configured MCP hostname and applies TransportSecuritySettings/server naming accordingly. |
| src/scansci_pdf/config.py | Adds validation rules and applies them during config load and updates; introduces mcp_server_name. |
| README.md | Documents how to configure MCP accepted hostname and adds related config table entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+22
to
+26
| _config = load_config() | ||
| _mcp_name = _config.get("mcp_server_name", "scansci-pdf") | ||
|
|
||
| # Configure transport security for non-localhost hostnames | ||
| _transport_security = None |
Comment on lines
+105
to
+109
| def _validate_config_value(key: str, value: Any) -> Any: | ||
| rule = _VALIDATION_RULES.get(key) | ||
| if rule is None: | ||
| return value | ||
|
|
Comment on lines
59
to
+62
| "json_probe_cache_seconds": 3600, | ||
| "cache_ttl_hours": 168, | ||
| "parallel_sources": True, | ||
| "source_workers": 4, |
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
Verification