pyddock 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {pyddock-0.2.1 → pyddock-0.2.2}/PKG-INFO +1 -1
  2. {pyddock-0.2.1 → pyddock-0.2.2}/pyproject.toml +1 -1
  3. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/_runtime.py +10 -0
  4. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/config.py +3 -3
  5. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/default_config.toml +4 -3
  6. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_filesystem_guards.py +1 -1
  7. {pyddock-0.2.1 → pyddock-0.2.2}/.gitignore +0 -0
  8. {pyddock-0.2.1 → pyddock-0.2.2}/LICENSE +0 -0
  9. {pyddock-0.2.1 → pyddock-0.2.2}/README.md +0 -0
  10. {pyddock-0.2.1 → pyddock-0.2.2}/publish-to-pypi.ps1 +0 -0
  11. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/__init__.py +0 -0
  12. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/_process_utils.py +0 -0
  13. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/ast_validator.py +0 -0
  14. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/cli.py +0 -0
  15. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/executor.py +0 -0
  16. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/script_registry.py +0 -0
  17. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/server.py +0 -0
  18. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/shell_executor.py +0 -0
  19. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/tools/__init__.py +0 -0
  20. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/tools/fs_append.py +0 -0
  21. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/tools/fs_delete.py +0 -0
  22. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/tools/read_file.py +0 -0
  23. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/tools/stat_file.py +0 -0
  24. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/tools/str_replace.py +0 -0
  25. {pyddock-0.2.1 → pyddock-0.2.2}/src/pyddock/venv_manager.py +0 -0
  26. {pyddock-0.2.1 → pyddock-0.2.2}/tests/__init__.py +0 -0
  27. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_ast_properties.py +0 -0
  28. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_chmod_integration.py +0 -0
  29. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_config.py +0 -0
  30. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_deny_messages.py +0 -0
  31. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_executor.py +0 -0
  32. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_file_tools.py +0 -0
  33. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_proxy_properties.py +0 -0
  34. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_realistic.py +0 -0
  35. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_runtime.py +0 -0
  36. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_security_guards.py +0 -0
  37. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_server.py +0 -0
  38. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_shell_arg_paths.py +0 -0
  39. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_shell_executor.py +0 -0
  40. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_shell_properties.py +0 -0
  41. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_subprocess_enforcement.py +0 -0
  42. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_subprocess_properties.py +0 -0
  43. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_subst_trusted_path.py +0 -0
  44. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_venv_stamp.py +0 -0
  45. {pyddock-0.2.1 → pyddock-0.2.2}/tests/test_workspace_imports.py +0 -0
  46. {pyddock-0.2.1 → pyddock-0.2.2}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyddock
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: MCP server that gives AI agents pre-approved Python, shell, and file I/O tools with declarative policy controls
5
5
  Project-URL: Homepage, https://github.com/portablestew/pyddock
6
6
  Project-URL: Repository, https://github.com/portablestew/pyddock
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyddock"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "MCP server that gives AI agents pre-approved Python, shell, and file I/O tools with declarative policy controls"
5
5
  requires-python = ">=3.11"
6
6
  license = "MIT"
@@ -1152,6 +1152,16 @@ class RuntimeEnforcement:
1152
1152
  f"'{pattern.pattern}', disposition: deny-all). "
1153
1153
  f"This path is blocked for security."
1154
1154
  )
1155
+ elif disposition == "read-only":
1156
+ # "read-only" allows reads but blocks writes.
1157
+ if operation == "read":
1158
+ return True # reads permitted
1159
+ raise PermissionError(
1160
+ f"PermissionError: Cannot {operation} '{path}' — "
1161
+ f"path matches a filesystem guard (pattern: "
1162
+ f"'{pattern.pattern}', disposition: read-only). "
1163
+ f"This path is read-only."
1164
+ )
1155
1165
  elif disposition == "workspace":
1156
1166
  try:
1157
1167
  path.relative_to(_workspace_root_abs)
@@ -197,16 +197,16 @@ def _parse_filesystem(data: dict) -> FilesystemConfig:
197
197
  if not isinstance(guards_section, dict):
198
198
  raise ConfigError("[filesystem.guards] must be a table")
199
199
  guards: list[GuardRule] = []
200
- _valid_dispositions = ("deny-agent", "deny-all", "workspace", "allow")
200
+ _valid_dispositions = ("deny-agent", "deny-all", "read-only", "workspace", "allow")
201
201
  for pattern, disposition in guards_section.items():
202
202
  if not isinstance(disposition, str):
203
203
  raise ConfigError(
204
204
  f"[filesystem.guards].'{pattern}' must be a string "
205
- f"('deny-agent', 'deny-all', 'workspace', or 'allow'), got {type(disposition).__name__}"
205
+ f"('deny-agent', 'deny-all', 'read-only', 'workspace', or 'allow'), got {type(disposition).__name__}"
206
206
  )
207
207
  if disposition not in _valid_dispositions:
208
208
  raise ConfigError(
209
- f"[filesystem.guards].'{pattern}' must be 'deny-agent', 'deny-all', 'workspace', "
209
+ f"[filesystem.guards].'{pattern}' must be 'deny-agent', 'deny-all', 'read-only', 'workspace', "
210
210
  f"or 'allow', got '{disposition}'"
211
211
  )
212
212
  guards.append(GuardRule(pattern=pattern, disposition=disposition))
@@ -83,6 +83,7 @@ readable_paths = ["*"]
83
83
  # Dispositions:
84
84
  # "deny-agent" — block agent code; trusted libraries (site-packages) can still access
85
85
  # "deny-all" — block unconditionally, no caller bypass
86
+ # "read-only" — allow reads, block writes unconditionally
86
87
  # "workspace" — allow only if the path is inside the workspace
87
88
  # "allow" — permit unconditionally (override for specific paths)
88
89
  [filesystem.guards]
@@ -96,9 +97,9 @@ readable_paths = ["*"]
96
97
  '/\.pypirc$' = "deny-all" # PyPI registry tokens — no library reader in sandbox
97
98
  '/\.git-credentials$' = "deny-all" # Git plaintext passwords — no library reader in sandbox
98
99
  '/\.env(\.[^/]*)?$' = "workspace" # .env files — workspace only
99
- '/\.kiro/agent' = "deny-all" # Kiro agent config — prevent self-modification
100
- '/\.kiro/settings' = "deny-all" # Kiro settings — prevent self-modification
101
- '/\.claude/settings' = "deny-all" # Claude settings — prevent self-modification
100
+ '/\.kiro/agent' = "read-only" # Kiro agent config — prevent self-modification
101
+ '/\.kiro/settings' = "read-only" # Kiro settings — prevent self-modification
102
+ '/\.claude/settings' = "read-only" # Claude settings — prevent self-modification
102
103
 
103
104
  # AST-level static analysis — blocks dangerous constructs before execution.
104
105
  # These prevent trivial jailbreaks (e.g. eval("__import__('os').system(...)")).
@@ -59,7 +59,7 @@ class TestGuardConfigParsing:
59
59
  "[filesystem.guards]\n"
60
60
  "'/\\.ssh/' = 'block'\n"
61
61
  ))
62
- with pytest.raises(ConfigError, match="'deny-agent', 'deny-all', 'workspace', or 'allow'"):
62
+ with pytest.raises(ConfigError, match="'deny-agent', 'deny-all', 'read-only', 'workspace', or 'allow'"):
63
63
  load_config(tmp_path)
64
64
 
65
65
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes