grey-panda 1.0.0__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 (83) hide show
  1. grey_panda-1.0.0/.gitignore +33 -0
  2. grey_panda-1.0.0/CHANGELOG.md +42 -0
  3. grey_panda-1.0.0/LICENSE +201 -0
  4. grey_panda-1.0.0/Module 1 - Developer Kit/HOW-TO-add-guardrails.md +91 -0
  5. grey_panda-1.0.0/Module 1 - Developer Kit/HOW-TO-use-in-your-ide.md +64 -0
  6. grey_panda-1.0.0/Module 1 - Developer Kit/PROFILES.md +53 -0
  7. grey_panda-1.0.0/Module 1 - Developer Kit/QUICKSTART.md +79 -0
  8. grey_panda-1.0.0/Module 1 - Developer Kit/README.md +73 -0
  9. grey_panda-1.0.0/Module 2 - Security Reviewer Kit/APPSEC_REVIEWER_GUIDE.md +114 -0
  10. grey_panda-1.0.0/Module 2 - Security Reviewer Kit/HOW-TO-run-aisvs-verification.md +50 -0
  11. grey_panda-1.0.0/Module 2 - Security Reviewer Kit/README.md +53 -0
  12. grey_panda-1.0.0/Module 2 - Security Reviewer Kit/threat-models/sample-agentic-system.json +87 -0
  13. grey_panda-1.0.0/Module 3 - Scanner and CI-CD Kit/HOW-TO-add-to-ci.md +63 -0
  14. grey_panda-1.0.0/Module 3 - Scanner and CI-CD Kit/HOW-TO-read-sarif.md +39 -0
  15. grey_panda-1.0.0/Module 3 - Scanner and CI-CD Kit/HOW-TO-write-a-rule.md +60 -0
  16. grey_panda-1.0.0/Module 3 - Scanner and CI-CD Kit/README.md +62 -0
  17. grey_panda-1.0.0/Module 3 - Scanner and CI-CD Kit/RULES_CATALOG.md +209 -0
  18. grey_panda-1.0.0/Module 4 - MCP and Agent Security Kit/HOW-TO-guard-an-agent.md +108 -0
  19. grey_panda-1.0.0/Module 4 - MCP and Agent Security Kit/HOW-TO-run-the-mcp-server.md +51 -0
  20. grey_panda-1.0.0/Module 4 - MCP and Agent Security Kit/HOW-TO-secure-your-mcp-server.md +85 -0
  21. grey_panda-1.0.0/Module 4 - MCP and Agent Security Kit/README.md +75 -0
  22. grey_panda-1.0.0/Module 5 - Standards and Governance Kit/README.md +64 -0
  23. grey_panda-1.0.0/Module 5 - Standards and Governance Kit/WHAT_IT_CAN_AND_CANNOT_DO.md +110 -0
  24. grey_panda-1.0.0/Module 5 - Standards and Governance Kit/mappings/AGENT_CONTROL_STANDARD.md +15 -0
  25. grey_panda-1.0.0/Module 5 - Standards and Governance Kit/mappings/AISVS.md +138 -0
  26. grey_panda-1.0.0/Module 5 - Standards and Governance Kit/mappings/MCP_SECURITY.md +19 -0
  27. grey_panda-1.0.0/Module 5 - Standards and Governance Kit/mappings/OWASP_AGENTIC.md +20 -0
  28. grey_panda-1.0.0/Module 5 - Standards and Governance Kit/mappings/OWASP_DSGAI.md +31 -0
  29. grey_panda-1.0.0/Module 5 - Standards and Governance Kit/mappings/OWASP_LLM_TOP10.md +20 -0
  30. grey_panda-1.0.0/NOTICE +28 -0
  31. grey_panda-1.0.0/PKG-INFO +219 -0
  32. grey_panda-1.0.0/README.md +183 -0
  33. grey_panda-1.0.0/docs/ARCHITECTURE.md +95 -0
  34. grey_panda-1.0.0/examples/example_usage.py +160 -0
  35. grey_panda-1.0.0/examples/secure_app/app.py +98 -0
  36. grey_panda-1.0.0/examples/secure_app/requirements.txt +4 -0
  37. grey_panda-1.0.0/examples/vulnerable_app/app.py +109 -0
  38. grey_panda-1.0.0/examples/vulnerable_app/requirements.txt +4 -0
  39. grey_panda-1.0.0/pyproject.toml +99 -0
  40. grey_panda-1.0.0/skill/SKILL.md +72 -0
  41. grey_panda-1.0.0/src/greypanda/__init__.py +90 -0
  42. grey_panda-1.0.0/src/greypanda/__main__.py +6 -0
  43. grey_panda-1.0.0/src/greypanda/_version.py +3 -0
  44. grey_panda-1.0.0/src/greypanda/cli/__init__.py +5 -0
  45. grey_panda-1.0.0/src/greypanda/cli/main.py +359 -0
  46. grey_panda-1.0.0/src/greypanda/data/AI_SECURITY_CHECKLIST.md +115 -0
  47. grey_panda-1.0.0/src/greypanda/data/__init__.py +61 -0
  48. grey_panda-1.0.0/src/greypanda/data/standards/agent-control-standard.json +13 -0
  49. grey_panda-1.0.0/src/greypanda/data/standards/aisvs.json +66 -0
  50. grey_panda-1.0.0/src/greypanda/data/standards/mcp-security.json +17 -0
  51. grey_panda-1.0.0/src/greypanda/data/standards/owasp-agentic-top10-2026.json +80 -0
  52. grey_panda-1.0.0/src/greypanda/data/standards/owasp-dsgai-2026.json +29 -0
  53. grey_panda-1.0.0/src/greypanda/data/standards/owasp-llm-top10-2026.json +88 -0
  54. grey_panda-1.0.0/src/greypanda/mcpserver/__init__.py +5 -0
  55. grey_panda-1.0.0/src/greypanda/mcpserver/__main__.py +6 -0
  56. grey_panda-1.0.0/src/greypanda/mcpserver/server.py +235 -0
  57. grey_panda-1.0.0/src/greypanda/scanner/__init__.py +15 -0
  58. grey_panda-1.0.0/src/greypanda/scanner/engine.py +166 -0
  59. grey_panda-1.0.0/src/greypanda/scanner/profiles.py +52 -0
  60. grey_panda-1.0.0/src/greypanda/scanner/reporters.py +149 -0
  61. grey_panda-1.0.0/src/greypanda/scanner/rules.py +435 -0
  62. grey_panda-1.0.0/src/greypanda/sdk/__init__.py +1 -0
  63. grey_panda-1.0.0/src/greypanda/sdk/acs.py +227 -0
  64. grey_panda-1.0.0/src/greypanda/sdk/agent.py +209 -0
  65. grey_panda-1.0.0/src/greypanda/sdk/audit.py +109 -0
  66. grey_panda-1.0.0/src/greypanda/sdk/context.py +138 -0
  67. grey_panda-1.0.0/src/greypanda/sdk/dlp.py +193 -0
  68. grey_panda-1.0.0/src/greypanda/sdk/guardrails.py +260 -0
  69. grey_panda-1.0.0/src/greypanda/sdk/mcp.py +248 -0
  70. grey_panda-1.0.0/src/greypanda/verify/__init__.py +5 -0
  71. grey_panda-1.0.0/src/greypanda/verify/aisvs.py +148 -0
  72. grey_panda-1.0.0/standards/README.md +60 -0
  73. grey_panda-1.0.0/tests/__init__.py +0 -0
  74. grey_panda-1.0.0/tests/test_agent.py +85 -0
  75. grey_panda-1.0.0/tests/test_audit_data_verify.py +63 -0
  76. grey_panda-1.0.0/tests/test_context.py +48 -0
  77. grey_panda-1.0.0/tests/test_dlp.py +55 -0
  78. grey_panda-1.0.0/tests/test_guardrails.py +70 -0
  79. grey_panda-1.0.0/tests/test_ignore.py +68 -0
  80. grey_panda-1.0.0/tests/test_mcp_acs.py +110 -0
  81. grey_panda-1.0.0/tests/test_scanner.py +84 -0
  82. grey_panda-1.0.0/tools/generate_mappings.py +80 -0
  83. grey_panda-1.0.0/tools/generate_rules_catalog.py +73 -0
@@ -0,0 +1,33 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ *.egg
9
+
10
+ # Virtual envs
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # Tooling caches
16
+ .pytest_cache/
17
+ .mypy_cache/
18
+ .ruff_cache/
19
+ .tox/
20
+ .coverage
21
+ htmlcov/
22
+
23
+ # Grey Panda outputs
24
+ grey-panda.sarif
25
+ grey_panda_report.md
26
+ findings.json
27
+ *.greypanda.local.toml
28
+
29
+ # OS / editor
30
+ .DS_Store
31
+ .idea/
32
+ .vscode/
33
+ *.swp
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ All notable changes to Grey Panda are documented here. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [1.0.0] — 2026-09-29
8
+
9
+ The first public release. 🐼
10
+
11
+ ### Added
12
+ - **Five module kits** — the bundle is organised into audience-facing kits
13
+ (Developer, Security Reviewer, Scanner & CI/CD, MCP & Agent Security, Standards &
14
+ Governance), each with its own friendly README and how-to guides, all powered by
15
+ one shared zero-dependency engine.
16
+ - **Scanner** (`gp scan`) — **26 high-precision rules** for AI, agent, and MCP risks,
17
+ each citing an OWASP ID, with false-positive suppress guards and per-line /
18
+ per-file ignores. Outputs **Markdown**, **JSON**, and **SARIF 2.1.0** (renders
19
+ inline in VS Code + GitHub code scanning).
20
+ - **SDK** (zero dependencies) — `PromptGuardrail`, `OutputGuardrail`, `DLPScanner`,
21
+ `SecureContextBuilder`, `AgentSecurityWrapper` (Rule of Two, HITL, kill switch,
22
+ call budgets), `AuditLogger`, plus **MCP** controls (`McpToolManifest`,
23
+ `McpServerGuard` — manifest pinning/hashing, rug-pull detection, schema/scope/origin
24
+ checks) and **ACS** controls (`Guardian` with five dispositions, `agent_bill_of_materials`).
25
+ - **MCP server** (`gp mcp`) — Grey Panda ships as an MCP server (JSON-RPC over stdio)
26
+ so any MCP-capable IDE can call `scan`, `review_snippet`, `explain_risk`,
27
+ `list_standards`, and `checklist`.
28
+ - **AISVS verification** (`gp verify`) — check a codebase against AISVS Level 1/2/3
29
+ and produce a signable report.
30
+ - **Standards knowledge pack** — machine-readable JSON for OWASP LLM Top 10 2026,
31
+ GenAI Data Security, Agentic Apps Top 10, AISVS (C1–C12), MCP security, and the
32
+ Agent Control Standard; the single source of truth for scanner, verify, MCP, and skill.
33
+ - **Integrations & governance** — Claude Code/Cursor skill, GitHub Action (SARIF +
34
+ PR comment + gate), pre-commit hooks, AppSec Reviewer Guide, and an OWASP Threat
35
+ Dragon template.
36
+ - **Profiles** — `solo`, `team`, `enterprise`: same safety floor, scaled process.
37
+ - **Docs** — README, Quickstart, Profiles, Architecture, standards mappings, and the
38
+ signature **What It Can and Cannot Do** honesty document.
39
+ - **Examples** — `vulnerable_app` (flagged) vs `secure_app` (clean) and a full SDK tour.
40
+ - **Tests** — 76 zero-dependency `unittest` tests; Grey Panda scans its own repo clean in CI.
41
+
42
+ [1.0.0]: https://github.com/dibakshya01/grey-panda/releases/tag/v1.0.0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but not
32
+ limited to compiled object code, generated documentation, and
33
+ conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions for
125
+ use, reproduction, or distribution of Your modifications, or for any
126
+ such Derivative Works as a whole, provided Your use, reproduction,
127
+ and distribution of the Work otherwise complies with the conditions
128
+ stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Grey Panda contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,91 @@
1
+ # How to add Grey Panda guardrails to an existing LLM call
2
+
3
+ **Time:** ~2 minutes. **Rule:** you never rewrite your LLM call — you wrap it.
4
+
5
+ ## The idea: a 7-step pipeline
6
+
7
+ ```
8
+ 1. PromptGuardrail.assert_safe() # block injection, strip invisible Unicode, size cap
9
+ 2. DLPScanner.redact() # remove PII + secrets before the model sees input
10
+ 3. SecureContextBuilder # tag trust per segment, enforce a size budget
11
+ 4. (your LLM call) # unchanged
12
+ 5. DLPScanner.redact() # scan the response for leaked PII
13
+ 6. OutputGuardrail.sanitize() # block exfil image URLs / unsafe HTML
14
+ 7. AuditLogger # structured event, zero raw text, SIEM-ready
15
+ ```
16
+
17
+ ## Step by step
18
+
19
+ ### 1–2. Screen and redact the input
20
+ ```python
21
+ from greypanda import PromptGuardrail, DLPScanner
22
+
23
+ guard = PromptGuardrail() # add extra_patterns=[...] for your domain
24
+ dlp = DLPScanner() # categories=["pii","secrets"] by default
25
+
26
+ safe = guard.assert_safe(user_input) # raises ValueError on a known injection
27
+ clean = dlp.redact(safe, context="chat_input")
28
+ ```
29
+ > `assert_safe` raises in strict mode. For a monitor-only rollout, use
30
+ > `PromptGuardrail(strict=False)` and inspect `guard.check(text).violations`.
31
+
32
+ ### 3. Build context with trust tags
33
+ ```python
34
+ from greypanda import SecureContextBuilder
35
+
36
+ messages = (
37
+ SecureContextBuilder(user_id=user_id, max_tokens=8000)
38
+ .add_system("You are a helpful assistant.")
39
+ .add_rag_chunk(doc_text, source="kb") # wrapped as untrusted data
40
+ .add_external_content(web_text, source="web") # wrapped as untrusted data
41
+ .add_user(clean)
42
+ .build() # OpenAI-format messages list
43
+ )
44
+ ```
45
+
46
+ ### 4. Your call — unchanged
47
+ ```python
48
+ reply = your_client.chat(messages=messages, max_tokens=512) # keep an output cap
49
+ ```
50
+
51
+ ### 5–6. Clean the output
52
+ ```python
53
+ from greypanda import OutputGuardrail
54
+
55
+ reply = dlp.redact(reply, context="chat_output")
56
+ out = OutputGuardrail(allowed_url_domains=["yourcdn.example"])
57
+ answer = out.sanitize(reply).sanitized_text
58
+ ```
59
+
60
+ ### 7. Audit without leaking
61
+ ```python
62
+ from greypanda import AuditLogger
63
+
64
+ audit = AuditLogger(agent_id="support-bot", session_id=session_id)
65
+ audit.log_prompt_check(user_id, passed=True, metadata={"tokens": len(messages)})
66
+ audit.log_output_check(user_id, passed=out.sanitize(reply).passed)
67
+ ```
68
+ `AuditLogger` emits single-line JSON via the standard `logging` module under
69
+ `greypanda.ai.audit` (or `<org>.ai.audit`) — point your SIEM at it. It **never**
70
+ logs raw prompt/response text.
71
+
72
+ ## Customising for your domain
73
+ - **Injection:** `PromptGuardrail(extra_patterns=[r"your-domain-attack"])`
74
+ - **DLP:** enable regional packs (`DLPScanner(categories=["pii","secrets","regional_in"])`)
75
+ or add your ID formats via `custom_patterns={"org_pii": [("customer_id", r"CUST-\d{8}")]}`.
76
+ - **Output:** set `allowed_url_domains` to your real CDN/domains.
77
+
78
+ ## Verify it worked
79
+ Run the scanner on your file — the SDK forms are recognised and pass cleanly:
80
+ ```bash
81
+ gp scan path/to/your_file.py
82
+ ```
83
+ See the full runnable version in [`/examples/example_usage.py`](../examples/example_usage.py)
84
+ and the before/after in [`/examples/secure_app/app.py`](../examples/secure_app/app.py).
85
+
86
+ ## What this does not do
87
+ Guardrails are a **strong first layer**, not a guarantee. They cannot stop novel or
88
+ paraphrased injection, and DLP regex is language-specific. Pair them with the agent
89
+ controls ([Module 4](../Module%204%20-%20MCP%20and%20Agent%20Security%20Kit)) and a
90
+ review ([Module 2](../Module%202%20-%20Security%20Reviewer%20Kit)) for anything
91
+ high-stakes. Full honesty: [WHAT_IT_CAN_AND_CANNOT_DO](../Module%205%20-%20Standards%20and%20Governance%20Kit/WHAT_IT_CAN_AND_CANNOT_DO.md).
@@ -0,0 +1,64 @@
1
+ # How to use Grey Panda inside your IDE
2
+
3
+ Grey Panda meets you where you code, three ways: **inline findings (SARIF)**, an
4
+ **MCP server** your AI assistant can call, and a **skill** that turns that assistant
5
+ into an AI Security Advisor.
6
+
7
+ ## 1. Inline findings in VS Code (SARIF)
8
+
9
+ Grey Panda emits SARIF 2.1.0, which VS Code and GitHub render right on the offending
10
+ line — no plugin needed beyond the SARIF viewer.
11
+
12
+ ```bash
13
+ gp scan . --format sarif --output grey-panda.sarif
14
+ ```
15
+
16
+ - **VS Code:** install the "SARIF Viewer" extension, then open `grey-panda.sarif`.
17
+ - **GitHub:** the [CI workflow](../Module%203%20-%20Scanner%20and%20CI-CD%20Kit/HOW-TO-add-to-ci.md)
18
+ uploads SARIF to code scanning, so findings appear inline in the PR diff.
19
+
20
+ ## 2. Grey Panda as an MCP server
21
+
22
+ Grey Panda ships **as** a Model Context Protocol server, so any MCP-capable client
23
+ (Claude Code, Cursor, Windsurf, VS Code) can call it while you work.
24
+
25
+ Register it once:
26
+ ```jsonc
27
+ // Claude Code / Cursor / Windsurf MCP config
28
+ {
29
+ "mcpServers": {
30
+ "grey-panda": { "command": "gp", "args": ["mcp"] }
31
+ }
32
+ }
33
+ ```
34
+
35
+ Now you can ask your assistant things like:
36
+ - *"Review this file with grey panda."* → calls `greypanda_review_snippet`
37
+ - *"Scan the repo for AI security issues."* → `greypanda_scan_path`
38
+ - *"Explain LLM03."* → `greypanda_explain_risk`
39
+ - *"Show me the AI security checklist."* → `greypanda_checklist`
40
+
41
+ Tools exposed: `greypanda_scan_path`, `greypanda_review_snippet`,
42
+ `greypanda_explain_risk`, `greypanda_list_standards`, `greypanda_checklist`.
43
+
44
+ Full details: [Module 4 → HOW-TO-run-the-mcp-server](../Module%204%20-%20MCP%20and%20Agent%20Security%20Kit/HOW-TO-run-the-mcp-server.md).
45
+
46
+ ## 3. The AI Security Advisor skill
47
+
48
+ The [`skill/SKILL.md`](../skill/SKILL.md) file turns Claude Code / Cursor into an AI
49
+ Security Advisor scoped to Grey Panda's standards and remediations.
50
+
51
+ Install it (Claude Code):
52
+ ```bash
53
+ mkdir -p .claude/skills/grey-panda
54
+ cp skill/SKILL.md .claude/skills/grey-panda/SKILL.md
55
+ ```
56
+ Then invoke `/grey-panda` (or `/aisec`) and paste code, or let it scan the current
57
+ file. If the MCP server is also registered, the skill uses it for ground-truth
58
+ findings and then explains + prioritises them.
59
+
60
+ ## What this does not do
61
+ The IDE integration surfaces Grey Panda's **static** findings and advice — it does
62
+ not run your code or observe runtime behaviour, and it inherits every limit in
63
+ [WHAT_IT_CAN_AND_CANNOT_DO](../Module%205%20-%20Standards%20and%20Governance%20Kit/WHAT_IT_CAN_AND_CANNOT_DO.md).
64
+ Treat AI-assistant suggestions as input to your judgment, not a verdict.
@@ -0,0 +1,53 @@
1
+ # Profiles: Solo, Team, Enterprise
2
+
3
+ Grey Panda gives **everyone the same safety floor** and lets the **profile scale the
4
+ process, not the safety**. A solo developer isn't drowned in process; an enterprise
5
+ gets the full gate. Pick a profile with `--profile` (default: `team`).
6
+
7
+ | Profile | For | Active rules | Fails build on |
8
+ |---|---|---|---|
9
+ | `solo` | Indie / solo developers, prototypes, hackathons | High-signal core (CRITICAL + key HIGH) | **CRITICAL** |
10
+ | `team` | Startups, product teams | + DLP-before-call, RAG isolation, logging, MCP, shadow-AI | **HIGH** |
11
+ | `enterprise` | Regulated / large orgs | Every rule, incl. cost/consumption + memory-poisoning + AISVS L1/L2/L3 | **HIGH** |
12
+
13
+ ## Solo
14
+ ```bash
15
+ gp scan . --profile solo
16
+ ```
17
+ Quiet and precise. Only the rules a single developer must not ship without. No CI,
18
+ no reviewer process required — though `gp init --profile solo` still gives you a
19
+ one-file GitHub Action if you want it.
20
+
21
+ ## Team
22
+ ```bash
23
+ gp init . --profile team # config + GitHub Action + pre-commit
24
+ gp scan . --profile team
25
+ ```
26
+ Adds the controls a team sharing a codebase needs: DLP before model calls, RAG
27
+ per-user isolation, no-raw-logging, MCP tool checks, and shadow-AI detection. The
28
+ gate fails on HIGH so risky code doesn't merge.
29
+
30
+ ## Enterprise
31
+ ```bash
32
+ gp scan . --profile enterprise
33
+ gp verify . --level 2
34
+ ```
35
+ Everything on, including MEDIUM cost/consumption and agent-memory checks, plus the
36
+ AppSec reviewer workflow and AISVS verification. Pair with the
37
+ [AppSec Reviewer Guide](../Module%202%20-%20Security%20Reviewer%20Kit/APPSEC_REVIEWER_GUIDE.md).
38
+
39
+ ## Configuring
40
+ `gp init` writes a `.greypanda.toml` you can commit:
41
+ ```toml
42
+ [greypanda]
43
+ profile = "team"
44
+ fail_on = "HIGH"
45
+ paths = ["."]
46
+ ```
47
+
48
+ ## Customising rules for your domain
49
+ - **DLP:** enable regional packs (`regional_in`, `regional_eu`) or add your customer/
50
+ order/seller ID formats via `custom_patterns` (see `dlp.py`).
51
+ - **Injection:** pass `extra_patterns` to `PromptGuardrail` for domain-specific attacks.
52
+ - **Scanner:** add a `Rule` to `src/greypanda/scanner/rules.py` (see [CONTRIBUTING](../CONTRIBUTING.md)).
53
+ - **Gateway allowlist:** add your AI gateway domain so `GP-AI-013` stops flagging it.
@@ -0,0 +1,79 @@
1
+ # Quick Start
2
+
3
+ Two five-minute paths: one for **developers**, one for **security reviewers**.
4
+
5
+ ## For developers
6
+
7
+ ### 1. Install
8
+ ```bash
9
+ pip install grey-panda # or: pipx install grey-panda / uvx grey-panda
10
+ ```
11
+
12
+ ### 2. Scan your repo
13
+ ```bash
14
+ gp scan . # Markdown report to your terminal
15
+ gp scan . --format sarif -o grey-panda.sarif # for VS Code / GitHub code scanning
16
+ ```
17
+
18
+ ### 3. Add drop-in guardrails (under 2 minutes)
19
+ ```python
20
+ from greypanda import PromptGuardrail, DLPScanner, OutputGuardrail
21
+
22
+ guard, dlp, out = PromptGuardrail(), DLPScanner(), OutputGuardrail()
23
+
24
+ safe = guard.assert_safe(user_input) # block injection, strip invisible Unicode
25
+ clean = dlp.redact(safe) # redact PII & secrets
26
+ reply = call_your_llm(clean) # your existing call — unchanged
27
+ answer = out.sanitize(reply).sanitized_text # neutralise exfil URLs / unsafe HTML
28
+ ```
29
+
30
+ ### 4. Wire it into your IDE (MCP)
31
+ ```jsonc
32
+ { "mcpServers": { "grey-panda": { "command": "gp", "args": ["mcp"] } } }
33
+ ```
34
+ Now your AI assistant can `review this file with grey panda` or `explain LLM03`.
35
+
36
+ ### 5. Gate your CI
37
+ ```bash
38
+ gp init . # writes .github/workflows/grey-panda.yml + config + pre-commit
39
+ ```
40
+
41
+ ### 6. Complete the checklist
42
+ ```bash
43
+ gp checklist > SECURITY_CHECKLIST.md
44
+ ```
45
+
46
+ ---
47
+
48
+ ## For security reviewers
49
+
50
+ ### 1. Get the artifact
51
+ Pull the JSON/SARIF report from CI, or run it yourself:
52
+ ```bash
53
+ gp scan <service_dir> --profile enterprise --format json -o findings.json
54
+ ```
55
+
56
+ ### 2. Run AISVS verification
57
+ ```bash
58
+ gp verify <service_dir> --level 2 -o aisvs-l2.md
59
+ ```
60
+
61
+ ### 3. Follow the reviewer guide
62
+ See the [AppSec Reviewer Guide](../Module%202%20-%20Security%20Reviewer%20Kit/APPSEC_REVIEWER_GUIDE.md): scanner review → manual threat-model review → utility checks (injection battery, RAG isolation, DLP output) → OWASP Threat Dragon model → sign-off.
63
+
64
+ ### 4. Import the threat model
65
+ Load the [threat-model template](../Module%202%20-%20Security%20Reviewer%20Kit/threat-models/sample-agentic-system.json) into OWASP Threat Dragon and adapt it to the feature's real architecture.
66
+
67
+ ### 5. Sign off
68
+ Use the sign-off template in the reviewer guide. Any 🔴 Critical blocks the release.
69
+
70
+ ---
71
+
72
+ ## Retrospective scan of an existing service
73
+ ```bash
74
+ gp scan ./services/payments --profile enterprise --format markdown
75
+ gp scan ./services/payments --profile enterprise --format json -o payments.json
76
+ ```
77
+
78
+ ## Honest limits
79
+ Before you rely on any of this, read [WHAT_IT_CAN_AND_CANNOT_DO.md](../Module%205%20-%20Standards%20and%20Governance%20Kit/WHAT_IT_CAN_AND_CANNOT_DO.md).
@@ -0,0 +1,73 @@
1
+ # 🧰 Module 1 — Developer Kit
2
+
3
+ > **For:** developers building anything with an LLM, an agent, or MCP.
4
+ > **Goal:** make the secure choice the *frictionless* choice. You should be able to
5
+ > add real protection to an existing LLM call in **under two minutes** — without
6
+ > rewriting the call.
7
+
8
+ This is the kit you reach for first. It gives you the **drop-in SDK** (runtime
9
+ guardrails), the **scanner** for your own code, and the **IDE integration** so your
10
+ AI assistant reviews security as you type.
11
+
12
+ ---
13
+
14
+ ## What's in this kit
15
+
16
+ | Piece | What it does | Where |
17
+ |---|---|---|
18
+ | **The SDK** | Drop-in runtime controls: input/output guardrails, DLP, secure context, agent security, audit | `import greypanda` |
19
+ | **The scanner** | Finds AI/agent/MCP issues in your code (`gp scan`) | see [Module 3](../Module%203%20-%20Scanner%20and%20CI-CD%20Kit) |
20
+ | **IDE / AI integration** | Grey Panda as an MCP server + a Claude/Cursor skill | [HOW-TO-use-in-your-ide.md](HOW-TO-use-in-your-ide.md) |
21
+ | **Quickstart & Profiles** | Get running in 60 seconds; pick your rigor level | [QUICKSTART.md](QUICKSTART.md) · [PROFILES.md](PROFILES.md) |
22
+ | **Runnable examples** | `vulnerable_app` (flagged) vs `secure_app` (clean) + a full SDK tour | [`/examples`](../examples) |
23
+
24
+ ## The 60-second version
25
+
26
+ ```bash
27
+ pip install grey-panda
28
+ gp scan . # scan your repo
29
+ ```
30
+
31
+ ```python
32
+ from greypanda import PromptGuardrail, DLPScanner, OutputGuardrail
33
+
34
+ guard, dlp, out = PromptGuardrail(), DLPScanner(), OutputGuardrail()
35
+
36
+ safe = guard.assert_safe(user_input) # block known injection + strip invisible Unicode
37
+ clean = dlp.redact(safe) # remove PII & secrets before the model sees them
38
+ reply = call_your_llm(clean) # ← your existing call, unchanged
39
+ answer = out.sanitize(reply).sanitized_text # block data-exfil URLs & unsafe HTML
40
+ ```
41
+
42
+ ## The SDK at a glance
43
+
44
+ | Control | Import | Protects against |
45
+ |---|---|---|
46
+ | `PromptGuardrail` | `from greypanda import PromptGuardrail` | Prompt injection, invisible-Unicode smuggling (`LLM01`) |
47
+ | `DLPScanner` | `from greypanda import DLPScanner` | PII & secret leakage (`LLM02`, `DSGAI01`) |
48
+ | `OutputGuardrail` | `from greypanda import OutputGuardrail` | XSS / data-exfil via model output (`LLM10`, `LLM02`) |
49
+ | `SecureContextBuilder` | `from greypanda import SecureContextBuilder` | Indirect injection, cross-user bleed (`LLM01`, `LLM09`) |
50
+ | `AgentSecurityWrapper` | `from greypanda import AgentSecurityWrapper` | Excessive agency, lethal trifecta (`LLM03`) → see [Module 4](../Module%204%20-%20MCP%20and%20Agent%20Security%20Kit) |
51
+ | `AuditLogger` | `from greypanda import AuditLogger` | Telemetry leakage (`DSGAI14`) |
52
+
53
+ Full walkthroughs:
54
+ - **[HOW-TO-add-guardrails.md](HOW-TO-add-guardrails.md)** — wire the 7-step pipeline into a real request.
55
+ - **[HOW-TO-use-in-your-ide.md](HOW-TO-use-in-your-ide.md)** — Grey Panda in Claude Code / Cursor / VS Code.
56
+
57
+ ## ✅ What this kit can do — and ❌ what it can't
58
+
59
+ **Can:** block *known* injection patterns cheaply at the edge; redact structured PII
60
+ and known secret shapes; keep instructions and untrusted data structurally
61
+ separate; give you an auditable, SIEM-ready event stream — all with **zero runtime
62
+ dependencies**.
63
+
64
+ **Cannot:** stop *all* prompt injection, catch paraphrased/novel attacks, or
65
+ understand meaning. Regex DLP is language-specific. Treat this as the **first layer
66
+ of defense in depth**, never as "injection-proof." The complete, honest breakdown
67
+ (with confidence levels per capability) is in
68
+ **[Module 5 → WHAT_IT_CAN_AND_CANNOT_DO](../Module%205%20-%20Standards%20and%20Governance%20Kit/WHAT_IT_CAN_AND_CANNOT_DO.md)**.
69
+
70
+ ## Where to go next
71
+ - Shipping an agent or MCP server? → **[Module 4 — MCP & Agent Security Kit](../Module%204%20-%20MCP%20and%20Agent%20Security%20Kit)**
72
+ - Want a CI gate? → **[Module 3 — Scanner & CI/CD Kit](../Module%203%20-%20Scanner%20and%20CI-CD%20Kit)**
73
+ - Getting reviewed by security? → **[Module 2 — Security Reviewer Kit](../Module%202%20-%20Security%20Reviewer%20Kit)**