fix(config): preserve MCP source through loadAppConfig unwrap - #1256
fix(config): preserve MCP source through loadAppConfig unwrap#125689799969 wants to merge 1 commit into
Conversation
validateProjectConfigSecurity filters on MCPServerConfig.source, but loadAppConfig stripped the loader wrapper (which carries provenance) before validation, so project-level hardcoded-credential checks never ran in the shipped app. Copy wrapper.source onto the runtime server objects and add a regression test that models the real unwrap path. Fixes Nano-Collective#1248 Signed-off-by: halaxy <63827956+89799969@users.noreply.github.com>
nc-review: comments — 2 nits@89799969 — a few things worth a look, none blocking. The change correctly fixes the integration break described in issue #1248 by copying ⚪ nit · The new regression test demonstrates that the unwrap preserves ⚪ nit · Issue #1248 also flags 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
Problem
validateProjectConfigSecurityis the app's defense-in-depth check for hardcoded credentials in project-level MCP configs. It filters onMCPServerConfig.source === 'project', butloadAppConfigunwrappedMCPServerWithSourceto plainMCPServerConfigbefore validation:The loader only tracks provenance on the wrapper, so every runtime object had
source: undefined, the filter was always empty, and the scanner never ran. The unit test passed only because it hand-set.sourceon the inner type — a shape that never occurs in the real data flow.Fix
When unwrapping, copy the wrapper's
sourceonto the runtime object (MCPServerConfig.sourceis already an optional field):Both
useAppInitializationandplain/initialize.tsthen see real provenance.Tests
source/config/validation.spec.tssuite still passesloader unwrap keeps source so project configs reach the validatormodels the realMCPServerWithSource[]shape and asserts:project-serverin the project filtervalidateProjectConfigSecurityaccepts the preserved-source arraytsc --noEmitpasses.Fixes #1248