securityagent-core 3.1.0__py3-none-any.whl

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 (109) hide show
  1. endpoint_agent/__init__.py +1 -0
  2. endpoint_agent/__init__.pyc +0 -0
  3. endpoint_agent/__main__.pyc +0 -0
  4. endpoint_agent/alerting/__init__.py +1 -0
  5. endpoint_agent/alerting/__init__.pyc +0 -0
  6. endpoint_agent/alerting/alert_manager.pyc +0 -0
  7. endpoint_agent/alerting/console_handler.pyc +0 -0
  8. endpoint_agent/alerting/log_handler.pyc +0 -0
  9. endpoint_agent/alerting/webhook_handler.pyc +0 -0
  10. endpoint_agent/cli.pyc +0 -0
  11. endpoint_agent/cloud_bridge/__init__.py +1 -0
  12. endpoint_agent/cloud_bridge/__init__.pyc +0 -0
  13. endpoint_agent/cloud_bridge/lockdown.pyc +0 -0
  14. endpoint_agent/config/__init__.py +1 -0
  15. endpoint_agent/config/__init__.pyc +0 -0
  16. endpoint_agent/config/privacy_mode.pyc +0 -0
  17. endpoint_agent/config/settings.pyc +0 -0
  18. endpoint_agent/engine.pyc +0 -0
  19. endpoint_agent/monitors/__init__.py +1 -0
  20. endpoint_agent/monitors/__init__.pyc +0 -0
  21. endpoint_agent/monitors/behavioral_monitor.pyc +0 -0
  22. endpoint_agent/monitors/file_monitor.pyc +0 -0
  23. endpoint_agent/monitors/honeypot_monitor.pyc +0 -0
  24. endpoint_agent/monitors/privilege_monitor.pyc +0 -0
  25. endpoint_agent/monitors/process_monitor.pyc +0 -0
  26. endpoint_agent/scanners/__init__.py +1 -0
  27. endpoint_agent/scanners/__init__.pyc +0 -0
  28. endpoint_agent/scanners/code_fingerprint.pyc +0 -0
  29. endpoint_agent/scanners/content_analyzer.pyc +0 -0
  30. endpoint_agent/scanners/credential_scanner.pyc +0 -0
  31. endpoint_agent/scanners/data_flow_tracker.pyc +0 -0
  32. endpoint_agent/scanners/dlp_scanner.pyc +0 -0
  33. endpoint_agent/scanners/finding_validators.pyc +0 -0
  34. endpoint_agent/scanners/installation_scanner.pyc +0 -0
  35. endpoint_agent/scanners/knowledge_graph.pyc +0 -0
  36. endpoint_agent/scanners/lethal_trifecta.pyc +0 -0
  37. endpoint_agent/scanners/llm_analyzer.pyc +0 -0
  38. endpoint_agent/scanners/llm_provider.pyc +0 -0
  39. endpoint_agent/scanners/memory_guard.pyc +0 -0
  40. endpoint_agent/scanners/ml_classifier.pyc +0 -0
  41. endpoint_agent/scanners/model_locality.pyc +0 -0
  42. endpoint_agent/scanners/nist_tagger.pyc +0 -0
  43. endpoint_agent/scanners/prompt_analyzer.pyc +0 -0
  44. endpoint_agent/scanners/prompt_guard.pyc +0 -0
  45. endpoint_agent/scanners/rule_classifier.pyc +0 -0
  46. endpoint_agent/scanners/shadow_ai_detector.pyc +0 -0
  47. endpoint_agent/scanners/text_extractor.pyc +0 -0
  48. endpoint_agent/scanners/tool_call_guard.pyc +0 -0
  49. endpoint_agent/scanners/vuln_scanner.pyc +0 -0
  50. endpoint_agent/secure_fs.pyc +0 -0
  51. endpoint_agent/tests/__init__.py +1 -0
  52. endpoint_agent/tests/__init__.pyc +0 -0
  53. endpoint_agent/tests/test_alert_manager.pyc +0 -0
  54. endpoint_agent/tests/test_behavioral_monitor.pyc +0 -0
  55. endpoint_agent/tests/test_cloud_bridge.pyc +0 -0
  56. endpoint_agent/tests/test_credential_scanner.pyc +0 -0
  57. endpoint_agent/tests/test_data_flow_tracker.pyc +0 -0
  58. endpoint_agent/tests/test_dlp_scanner.pyc +0 -0
  59. endpoint_agent/tests/test_engine.pyc +0 -0
  60. endpoint_agent/tests/test_file_monitor.pyc +0 -0
  61. endpoint_agent/tests/test_honeypot_monitor.pyc +0 -0
  62. endpoint_agent/tests/test_installation_scanner.pyc +0 -0
  63. endpoint_agent/tests/test_llm_analyzer.pyc +0 -0
  64. endpoint_agent/tests/test_privilege_monitor.pyc +0 -0
  65. endpoint_agent/tests/test_process_monitor.pyc +0 -0
  66. endpoint_agent/tests/test_prompt_analyzer.pyc +0 -0
  67. endpoint_agent/tests/test_prompt_guard.pyc +0 -0
  68. endpoint_agent/tests/test_rule_classifier.pyc +0 -0
  69. endpoint_agent/tests/test_secure_fs.pyc +0 -0
  70. endpoint_agent/tests/test_semantic_disclosure.pyc +0 -0
  71. endpoint_agent/tests/test_text_extractor.pyc +0 -0
  72. endpoint_agent/tests/test_tool_call_guard.pyc +0 -0
  73. endpoint_agent/tests/test_trial_manager.pyc +0 -0
  74. endpoint_agent/trial_manager.pyc +0 -0
  75. policy/__init__.py +1 -0
  76. policy/__init__.pyc +0 -0
  77. policy/audit.pyc +0 -0
  78. policy/chain_detector.pyc +0 -0
  79. policy/engine.pyc +0 -0
  80. policy/memory_bridge.pyc +0 -0
  81. policy/rules.pyc +0 -0
  82. policy/session.pyc +0 -0
  83. scripts/secagent_check.pyc +0 -0
  84. securityagent_core/__init__.py +1 -0
  85. securityagent_core/__init__.pyc +0 -0
  86. securityagent_core-3.1.0.dist-info/METADATA +119 -0
  87. securityagent_core-3.1.0.dist-info/RECORD +109 -0
  88. securityagent_core-3.1.0.dist-info/WHEEL +5 -0
  89. securityagent_core-3.1.0.dist-info/entry_points.txt +2 -0
  90. securityagent_core-3.1.0.dist-info/top_level.txt +6 -0
  91. skills/__init__.py +1 -0
  92. skills/__init__.pyc +0 -0
  93. skills/adapters/__init__.py +1 -0
  94. skills/adapters/__init__.pyc +0 -0
  95. skills/adapters/cli_adapter.pyc +0 -0
  96. skills/adapters/mcp_server.pyc +0 -0
  97. skills/adapters/python_sdk.pyc +0 -0
  98. skills/base.pyc +0 -0
  99. skills/context.pyc +0 -0
  100. skills/implementations/__init__.py +1 -0
  101. skills/implementations/__init__.pyc +0 -0
  102. skills/implementations/analyze_prompt.pyc +0 -0
  103. skills/implementations/audit_log.pyc +0 -0
  104. skills/implementations/check_policy.pyc +0 -0
  105. skills/implementations/get_session_policy.pyc +0 -0
  106. skills/implementations/scan_output.pyc +0 -0
  107. skills/implementations/secure_exec.pyc +0 -0
  108. skills/implementations/secure_read.pyc +0 -0
  109. skills/registry.pyc +0 -0
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
endpoint_agent/cli.pyc ADDED
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
Binary file
Binary file
policy/__init__.py ADDED
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
policy/__init__.pyc ADDED
Binary file
policy/audit.pyc ADDED
Binary file
Binary file
policy/engine.pyc ADDED
Binary file
Binary file
policy/rules.pyc ADDED
Binary file
policy/session.pyc ADDED
Binary file
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: securityagent-core
3
+ Version: 3.1.0
4
+ Summary: Local-first DLP engine and security layer for AI coding agents
5
+ License: MIT
6
+ Keywords: security,dlp,ai-agents,llm,copilot,claude-code
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Topic :: Security
10
+ Classifier: Topic :: Software Development :: Quality Assurance
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: watchdog
18
+ Requires-Dist: psutil
19
+ Requires-Dist: pydantic>=2.0
20
+ Requires-Dist: pypdf
21
+ Requires-Dist: openpyxl
22
+ Requires-Dist: python-docx
23
+ Requires-Dist: pyyaml
24
+ Provides-Extra: ml
25
+ Requires-Dist: sentence-transformers; extra == "ml"
26
+ Requires-Dist: scikit-learn; extra == "ml"
27
+ Requires-Dist: joblib; extra == "ml"
28
+ Requires-Dist: numpy; extra == "ml"
29
+ Provides-Extra: cloud
30
+ Requires-Dist: boto3; extra == "cloud"
31
+ Requires-Dist: PyJWT; extra == "cloud"
32
+ Requires-Dist: cryptography; extra == "cloud"
33
+ Provides-Extra: llm
34
+ Requires-Dist: ollama; extra == "llm"
35
+ Provides-Extra: ocr
36
+ Requires-Dist: PyMuPDF; extra == "ocr"
37
+ Requires-Dist: pytesseract; extra == "ocr"
38
+ Requires-Dist: Pillow; extra == "ocr"
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest; extra == "dev"
41
+ Requires-Dist: moto; extra == "dev"
42
+ Provides-Extra: all
43
+ Requires-Dist: securityagent-core[cloud,llm,ml,ocr]; extra == "all"
44
+
45
+ # securityagent-core
46
+
47
+ Shared DLP engine, security skills, and policy enforcement for AI coding agents. Used by [SecurityAgent](https://github.com/kaushikdharamshi/SecurityAgent) and [AgnosticSecurity](https://github.com/kaushikdharamshi/AgnosticSecurity).
48
+
49
+ ## What's inside
50
+
51
+ | Package | What it does |
52
+ |---|---|
53
+ | `endpoint_agent/` | DLP engine — file blocking (60+ path patterns), confidence-scored content scanning (PII, credentials, semantic disclosure detection) with structural validators (Luhn, SSA rules, entropy) and context-aware scoring, **data flow taint tracking** (tags sensitive data at ingress, detects at egress via hash/n-gram/substring matching), **tool call argument scanning** (MCP/function call DLP + taint registry), behavioral monitoring (8-signal anomaly scoring), honeypot traps, credential scanning. LLM intent analysis with llama3.1:8b default + fallback chain. Notebook-aware `.ipynb` extraction. PDF extraction via 3-tier pipeline (PyMuPDF → Tesseract OCR → pypdf fallback) with encrypted PDF detection |
54
+ | `skills/` | Agent-agnostic MCP skills — `secure_read`, `secure_exec`, `analyze_prompt`, `scan_output`, `check_policy`, `get_session_policy`, `audit_log` |
55
+ | `policy/` | Policy engine — per-session least privilege, behavioral chain detection (11 attack patterns), audit trail with agent attribution. Obsidian vault integration via `memory_bridge.py` for cross-session policy context |
56
+ | `obsidianMemory/` | Obsidian vault — daily session logs, second-brain knowledge base, used by `memory_bridge.py` for persistent threat/policy tracking |
57
+ | `plugin.py` | Standalone CLI entry point + `validate_exec()`, `validate_prompt()`, `validate_output()` pure functions |
58
+
59
+ ## Install
60
+
61
+ ```bash
62
+ pip install git+https://github.com/kaushikdharamshi/securityagent-core.git
63
+
64
+ # With optional dependencies
65
+ pip install "securityagent-core[cloud] @ git+https://github.com/kaushikdharamshi/securityagent-core.git"
66
+ pip install "securityagent-core[llm] @ git+https://github.com/kaushikdharamshi/securityagent-core.git"
67
+ ```
68
+
69
+ ## Usage
70
+
71
+ ### Python SDK
72
+
73
+ ```python
74
+ from skills.adapters.python_sdk import SecurityAgentSDK
75
+
76
+ sdk = SecurityAgentSDK(agent_id="my-agent", agent_type="langchain")
77
+
78
+ # DLP-gated file read
79
+ result = sdk.secure_read("/path/to/file")
80
+
81
+ # Command validation
82
+ result = sdk.secure_exec("ls -la")
83
+
84
+ # Prompt intent analysis
85
+ result = sdk.analyze_prompt("Get me all customer SSNs")
86
+ ```
87
+
88
+ ### MCP Server
89
+
90
+ ```bash
91
+ python -m skills.adapters.mcp_server # after pip install
92
+ ```
93
+
94
+ Any MCP-compatible client (Claude Code, Copilot, custom agents) can connect via stdio JSON-RPC.
95
+
96
+ ### CLI
97
+
98
+ ```bash
99
+ python -m plugin ~/.env # File read gate
100
+ python -m plugin --exec "cat ~/.env" # Exec validation
101
+ python -m plugin --prompt "Get all passwords" # Prompt analysis
102
+ python -m plugin --skill secure_read --params '{"path":"~/.env"}' # Skills layer
103
+ python -m plugin --mcp-server # MCP server
104
+ ```
105
+
106
+ ### Claude Code Integration
107
+
108
+ See [`integrations/claude_code/`](integrations/claude_code/) for PreToolUse hook configuration.
109
+
110
+ ## Tests
111
+
112
+ ```bash
113
+ pip install -e ".[dev]"
114
+ pytest
115
+ ```
116
+
117
+ ## License
118
+
119
+ MIT
@@ -0,0 +1,109 @@
1
+ endpoint_agent/__init__.py,,
2
+ endpoint_agent/__init__.pyc,,
3
+ endpoint_agent/__main__.pyc,,
4
+ endpoint_agent/alerting/__init__.py,,
5
+ endpoint_agent/alerting/__init__.pyc,,
6
+ endpoint_agent/alerting/alert_manager.pyc,,
7
+ endpoint_agent/alerting/console_handler.pyc,,
8
+ endpoint_agent/alerting/log_handler.pyc,,
9
+ endpoint_agent/alerting/webhook_handler.pyc,,
10
+ endpoint_agent/cli.pyc,,
11
+ endpoint_agent/cloud_bridge/__init__.py,,
12
+ endpoint_agent/cloud_bridge/__init__.pyc,,
13
+ endpoint_agent/cloud_bridge/lockdown.pyc,,
14
+ endpoint_agent/config/__init__.py,,
15
+ endpoint_agent/config/__init__.pyc,,
16
+ endpoint_agent/config/privacy_mode.pyc,,
17
+ endpoint_agent/config/settings.pyc,,
18
+ endpoint_agent/engine.pyc,,
19
+ endpoint_agent/monitors/__init__.py,,
20
+ endpoint_agent/monitors/__init__.pyc,,
21
+ endpoint_agent/monitors/behavioral_monitor.pyc,,
22
+ endpoint_agent/monitors/file_monitor.pyc,,
23
+ endpoint_agent/monitors/honeypot_monitor.pyc,,
24
+ endpoint_agent/monitors/privilege_monitor.pyc,,
25
+ endpoint_agent/monitors/process_monitor.pyc,,
26
+ endpoint_agent/scanners/__init__.py,,
27
+ endpoint_agent/scanners/__init__.pyc,,
28
+ endpoint_agent/scanners/code_fingerprint.pyc,,
29
+ endpoint_agent/scanners/content_analyzer.pyc,,
30
+ endpoint_agent/scanners/credential_scanner.pyc,,
31
+ endpoint_agent/scanners/data_flow_tracker.pyc,,
32
+ endpoint_agent/scanners/dlp_scanner.pyc,,
33
+ endpoint_agent/scanners/finding_validators.pyc,,
34
+ endpoint_agent/scanners/installation_scanner.pyc,,
35
+ endpoint_agent/scanners/knowledge_graph.pyc,,
36
+ endpoint_agent/scanners/lethal_trifecta.pyc,,
37
+ endpoint_agent/scanners/llm_analyzer.pyc,,
38
+ endpoint_agent/scanners/llm_provider.pyc,,
39
+ endpoint_agent/scanners/memory_guard.pyc,,
40
+ endpoint_agent/scanners/ml_classifier.pyc,,
41
+ endpoint_agent/scanners/model_locality.pyc,,
42
+ endpoint_agent/scanners/nist_tagger.pyc,,
43
+ endpoint_agent/scanners/prompt_analyzer.pyc,,
44
+ endpoint_agent/scanners/prompt_guard.pyc,,
45
+ endpoint_agent/scanners/rule_classifier.pyc,,
46
+ endpoint_agent/scanners/shadow_ai_detector.pyc,,
47
+ endpoint_agent/scanners/text_extractor.pyc,,
48
+ endpoint_agent/scanners/tool_call_guard.pyc,,
49
+ endpoint_agent/scanners/vuln_scanner.pyc,,
50
+ endpoint_agent/secure_fs.pyc,,
51
+ endpoint_agent/tests/__init__.py,,
52
+ endpoint_agent/tests/__init__.pyc,,
53
+ endpoint_agent/tests/test_alert_manager.pyc,,
54
+ endpoint_agent/tests/test_behavioral_monitor.pyc,,
55
+ endpoint_agent/tests/test_cloud_bridge.pyc,,
56
+ endpoint_agent/tests/test_credential_scanner.pyc,,
57
+ endpoint_agent/tests/test_data_flow_tracker.pyc,,
58
+ endpoint_agent/tests/test_dlp_scanner.pyc,,
59
+ endpoint_agent/tests/test_engine.pyc,,
60
+ endpoint_agent/tests/test_file_monitor.pyc,,
61
+ endpoint_agent/tests/test_honeypot_monitor.pyc,,
62
+ endpoint_agent/tests/test_installation_scanner.pyc,,
63
+ endpoint_agent/tests/test_llm_analyzer.pyc,,
64
+ endpoint_agent/tests/test_privilege_monitor.pyc,,
65
+ endpoint_agent/tests/test_process_monitor.pyc,,
66
+ endpoint_agent/tests/test_prompt_analyzer.pyc,,
67
+ endpoint_agent/tests/test_prompt_guard.pyc,,
68
+ endpoint_agent/tests/test_rule_classifier.pyc,,
69
+ endpoint_agent/tests/test_secure_fs.pyc,,
70
+ endpoint_agent/tests/test_semantic_disclosure.pyc,,
71
+ endpoint_agent/tests/test_text_extractor.pyc,,
72
+ endpoint_agent/tests/test_tool_call_guard.pyc,,
73
+ endpoint_agent/tests/test_trial_manager.pyc,,
74
+ endpoint_agent/trial_manager.pyc,,
75
+ policy/__init__.py,,
76
+ policy/__init__.pyc,,
77
+ policy/audit.pyc,,
78
+ policy/chain_detector.pyc,,
79
+ policy/engine.pyc,,
80
+ policy/memory_bridge.pyc,,
81
+ policy/rules.pyc,,
82
+ policy/session.pyc,,
83
+ scripts/secagent_check.pyc,,
84
+ securityagent_core/__init__.py,,
85
+ securityagent_core/__init__.pyc,,
86
+ securityagent_core-3.1.0.dist-info/METADATA,,
87
+ securityagent_core-3.1.0.dist-info/WHEEL,,
88
+ securityagent_core-3.1.0.dist-info/entry_points.txt,,
89
+ securityagent_core-3.1.0.dist-info/top_level.txt,,
90
+ skills/__init__.py,,
91
+ skills/__init__.pyc,,
92
+ skills/adapters/__init__.py,,
93
+ skills/adapters/__init__.pyc,,
94
+ skills/adapters/cli_adapter.pyc,,
95
+ skills/adapters/mcp_server.pyc,,
96
+ skills/adapters/python_sdk.pyc,,
97
+ skills/base.pyc,,
98
+ skills/context.pyc,,
99
+ skills/implementations/__init__.py,,
100
+ skills/implementations/__init__.pyc,,
101
+ skills/implementations/analyze_prompt.pyc,,
102
+ skills/implementations/audit_log.pyc,,
103
+ skills/implementations/check_policy.pyc,,
104
+ skills/implementations/get_session_policy.pyc,,
105
+ skills/implementations/scan_output.pyc,,
106
+ skills/implementations/secure_exec.pyc,,
107
+ skills/implementations/secure_read.pyc,,
108
+ skills/registry.pyc,,
109
+ securityagent_core-3.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ secagent = endpoint_agent.cli:main
@@ -0,0 +1,6 @@
1
+ endpoint_agent
2
+ obsidianMemory
3
+ policy
4
+ scripts
5
+ securityagent_core
6
+ skills
skills/__init__.py ADDED
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
skills/__init__.pyc ADDED
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
Binary file
Binary file
skills/base.pyc ADDED
Binary file
skills/context.pyc ADDED
Binary file
@@ -0,0 +1 @@
1
+ # bytecode-only distribution
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
skills/registry.pyc ADDED
Binary file