fix(session): require config-backed mutation authority and workspace-bound targets (#714)
Close the #714 remediation gap left at 943d402 where env-only mutation
profiles, REMOTES Timesheet defaults treated as explicit caller input, and
machine-dependent Git remotes produced false greens.
- Fail closed when mutations lack a config-backed profile with non-empty
allowed_repositories; env ops cannot invent mutation authority.
- Preserve omitted-vs-explicit org/repo provenance through the mutation
gate; omitted targets bind to the verified workspace repository.
- Prefer workspace-aligned Git remotes over historical Timesheet defaults
in MCP _resolve and CLI resolve_remote.
- Centralize deterministic config-backed mutation fixtures; migrate
mutation tests off env-only authority without weakening security
assertions.
Full suite: 2744 passed, 6 skipped.
This commit is contained in:
@@ -55,6 +55,7 @@ CONFIG_714 = {
|
||||
"gitea.pr.merge",
|
||||
"gitea.pr.request_changes",
|
||||
],
|
||||
"allowed_repositories": ["Scaled-Tech-Consulting/Gitea-Tools"],
|
||||
"execution_profile": "prgs-author",
|
||||
},
|
||||
"mdcps-reviewer": {
|
||||
@@ -78,6 +79,7 @@ CONFIG_714 = {
|
||||
"gitea.pr.merge",
|
||||
"gitea.repo.commit",
|
||||
],
|
||||
"allowed_repositories": ["913443/eAgenda"],
|
||||
"execution_profile": "mdcps-reviewer",
|
||||
},
|
||||
"mdcps-author": {
|
||||
@@ -102,6 +104,7 @@ CONFIG_714 = {
|
||||
"gitea.pr.merge",
|
||||
"gitea.pr.request_changes",
|
||||
],
|
||||
"allowed_repositories": ["913443/eAgenda"],
|
||||
"execution_profile": "mdcps-author",
|
||||
},
|
||||
},
|
||||
@@ -131,6 +134,14 @@ class TestIssue714SessionContextImmutability(unittest.TestCase):
|
||||
clear=False,
|
||||
)
|
||||
self._remotes.start()
|
||||
def _url(name):
|
||||
if name == "dadeschools":
|
||||
return "https://gitea.dadeschools.net/913443/eAgenda.git"
|
||||
if name == "prgs":
|
||||
return "https://gitea.prgs.cc/Scaled-Tech-Consulting/Gitea-Tools.git"
|
||||
return None
|
||||
self._url_patch = patch.object(mcp_server, "_local_git_remote_url", side_effect=_url)
|
||||
self._url_patch.start()
|
||||
mcp_server._IDENTITY_CACHE.clear()
|
||||
gitea_config._active_profile_override = None
|
||||
mcp_server._MUTATION_AUTHORITY = None
|
||||
@@ -143,6 +154,7 @@ class TestIssue714SessionContextImmutability(unittest.TestCase):
|
||||
}
|
||||
|
||||
def tearDown(self):
|
||||
self._url_patch.stop()
|
||||
self._remotes.stop()
|
||||
mcp_server._IDENTITY_CACHE.clear()
|
||||
gitea_config._active_profile_override = None
|
||||
|
||||
Reference in New Issue
Block a user