S-Dreamer commited on
Commit
e72b2b8
·
verified ·
1 Parent(s): 7d7ed5c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +533 -14
README.md CHANGED
@@ -44,34 +44,553 @@ thumbnail: >-
44
  https://cdn-uploads.huggingface.co/production/uploads/67c714e90b99a2332e310979/L02-prFfHa7eBZGVf4uvR.jpeg
45
  ---
46
 
47
- # Purple Team Code Workbench - Streamlit Starter
48
 
49
- This package contains a working Streamlit implementation based on the provided Purple Team Code Workbench project spec.
 
 
50
 
51
- ## Files
 
 
 
 
 
52
 
53
- - `app.py` - main Streamlit application
54
- - `requirements.txt` - Python dependencies
55
- - `.streamlit/config.toml` - theme and server defaults
 
 
 
56
 
57
- ## Run locally
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  ```bash
60
- python -m venv .venv
61
- .venv\Scripts\activate
62
- pip install -r requirements.txt
63
- streamlit run app.py
64
  ```
65
 
66
- On Linux/macOS:
67
 
68
  ```bash
69
  python -m venv .venv
 
 
 
 
 
 
 
70
  source .venv/bin/activate
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  pip install -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  streamlit run app.py
73
  ```
74
 
75
- ## Safety posture
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
- The app intentionally avoids autonomous offensive execution. It is a scope-gated workflow, findings, evidence, and report workspace for authorized defensive/purple-team work.
 
44
  https://cdn-uploads.huggingface.co/production/uploads/67c714e90b99a2332e310979/L02-prFfHa7eBZGVf4uvR.jpeg
45
  ---
46
 
47
+ # Purple Team Code Workbench
48
 
49
+ <p align="center">
50
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/67c714e90b99a2332e310979/L02-prFfHa7eBZGVf4uvR.jpeg" width="720" alt="Purple Team Code Workbench Banner"/>
51
+ </p>
52
 
53
+ <p align="center">
54
+ <strong>
55
+ Streamlit-powered code generation and workflow orchestration
56
+ surface for authorized purple-team operations.
57
+ </strong>
58
+ </p>
59
 
60
+ <p align="center">
61
+ <img alt="Python" src="https://img.shields.io/badge/python-3.11%2B-blue">
62
+ <img alt="Streamlit" src="https://img.shields.io/badge/streamlit-1.57.0-red">
63
+ <img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-green">
64
+ <img alt="Security" src="https://img.shields.io/badge/focus-purple--team-purple">
65
+ </p>
66
 
67
+ ---
68
+
69
+ ## Overview
70
+
71
+ Purple Team Code Workbench is an AI-assisted cybersecurity experimentation environment designed for defensive researchers, purple-team operators, and security engineers.
72
+
73
+ The platform combines:
74
+
75
+ - LLM-driven code generation
76
+ - Workflow prototyping
77
+ - Adversarial simulation
78
+ - Structured findings management
79
+ - Report generation
80
+ - Human-in-the-loop operational control
81
+
82
+ inside a lightweight Streamlit interface.
83
+
84
+ This repository currently includes a working starter implementation with a scope gate, workflow prompt builder, structured findings manager, hash-linked evidence ledger, model profile panel, and Markdown report export. It is designed to run locally or as a Hugging Face Streamlit Space without requiring a GPU.
85
+
86
+ The architecture emphasizes modular orchestration, reproducible workflows, and human-supervised operational control.
87
+
88
+ The platform focuses on:
89
+
90
+ - Authorized assessment workflows
91
+ - Defensive and adversarial simulation support
92
+ - Code generation for security operations
93
+ - Evidence handling and finding management
94
+ - Prompt-assisted workflow acceleration
95
+ - Report artifact generation
96
+ - Research and analysis augmentation
97
+
98
+ The system is intentionally structured around controlled workflows rather than unrestricted autonomous execution.
99
+
100
+ ---
101
+
102
+ ## Why Purple Team?
103
+
104
+ Purple-team methodology combines offensive security simulation with defensive validation and detection engineering.
105
+
106
+ This workbench is designed to support collaborative workflows between:
107
+
108
+ - security researchers
109
+ - defenders
110
+ - detection engineers
111
+ - SOC analysts
112
+ - incident responders
113
+ - application security teams
114
+
115
+ The focus is operational learning, validation, and resilience improvement rather than isolated offensive capability.
116
+
117
+ ---
118
+
119
+ ## Safety & Intended Use
120
+
121
+ Purple Team Code Workbench is intended for:
122
+
123
+ - Authorized security testing
124
+ - Defensive security research
125
+ - Secure software experimentation
126
+ - Educational cybersecurity workflows
127
+ - Purple-team simulation and analysis
128
+
129
+ This project is not intended for:
130
+
131
+ - Unauthorized access
132
+ - Malware deployment
133
+ - Credential theft
134
+ - Persistence mechanisms
135
+ - Destructive operations
136
+ - Autonomous offensive activity
137
+
138
+ Users are responsible for complying with applicable laws, organizational policies, and authorization requirements.
139
+
140
+ ---
141
+
142
+ ## Non-Goals
143
+
144
+ This project is not intended to provide:
145
+
146
+ - autonomous offensive operations
147
+ - malware automation
148
+ - persistence tooling
149
+ - uncontrolled exploitation workflows
150
+ - credential harvesting systems
151
+
152
+ ---
153
+
154
+ ## Model Roles
155
+
156
+ | Model | Purpose |
157
+ |---|---|
158
+ | HauhauCS/Gemma-4-E4B-Uncensored-HauhauCS-Aggressive | Experimental reasoning and adversarial simulation support |
159
+ | DeepHat/DeepHat-V1-7B | Security-oriented coding and workflow assistance |
160
+ | meta-llama/Meta-Llama-3-8B-Instruct | General reasoning and structured instruction following |
161
+
162
+ ---
163
+
164
+ ## Runtime Environment
165
+
166
+ - Python 3.11
167
+ - Streamlit 1.57.0
168
+ - pandas
169
+ - CPU-compatible deployment
170
+ - Optional GPU acceleration if model inference is added later
171
+ - Hugging Face Streamlit Space compatibility
172
+
173
+ The included starter app is intentionally lightweight. It can run locally or inside a Hugging Face Space without requiring a GPU.
174
+
175
+ ---
176
+
177
+ ## Core Design Principles
178
+
179
+ ### Scope-First Architecture
180
+
181
+ Every workflow begins with explicit authorization and target definition.
182
+
183
+ The system is designed to reduce:
184
+
185
+ - accidental scope drift
186
+ - unsafe automation
187
+ - uncontrolled execution paths
188
+ - ambiguous operational state
189
+
190
+ ---
191
+
192
+ ### Human-in-the-Loop Control
193
+
194
+ The workbench assists analysts and engineers rather than replacing operational judgment.
195
+
196
+ Generation ≠ execution.
197
+
198
+ All generated output should be reviewed before use.
199
+
200
+ ---
201
+
202
+ ### Evidence-Centric Workflow
203
+
204
+ Outputs are treated as operational artifacts:
205
+
206
+ - findings
207
+ - prompts
208
+ - code snippets
209
+ - reports
210
+ - remediation notes
211
+ - validation records
212
+
213
+ The system emphasizes traceability and reproducibility over opaque AI behavior.
214
+
215
+ A tragically rare design choice in modern software tooling.
216
+
217
+ ---
218
+
219
+ ## Features
220
+
221
+ ### Current Capabilities
222
+
223
+ - Streamlit-based UI
224
+ - Scope-gated workflow controls
225
+ - Security code generation surface
226
+ - Passive recon helpers
227
+ - Structured findings management
228
+ - Markdown report export
229
+ - Multi-model workflow support
230
+ - Hugging Face Space deployment compatibility
231
+ - CPU-compatible starter runtime
232
+ - Session-state based local workflow records
233
+ - JSON, CSV, and Markdown exports
234
+
235
+ ---
236
+
237
+ ### Included Starter Files
238
+
239
+ The current starter package contains:
240
+
241
+ | File | Purpose |
242
+ |---|---|
243
+ | `app.py` | Main Streamlit application |
244
+ | `requirements.txt` | Python dependencies |
245
+ | `README.md` | Hugging Face Space metadata and project documentation |
246
+ | `.streamlit/config.toml` | Theme and server defaults |
247
+
248
+ The app does **not** call external model APIs by default. The configured model list is used as a profile/routing layer so inference can be added later without hiding provider behavior inside the UI. Because invisible API calls are how dashboards become haunted.
249
+
250
+ ---
251
+
252
+ ### Planned Capabilities
253
+
254
+ - Workflow templates
255
+ - Prompt chaining
256
+ - Agent orchestration
257
+ - Typed finding schemas
258
+ - Multi-provider inference routing
259
+ - Local LLM runtime support
260
+ - Evidence graphing
261
+ - Drift-aware execution state
262
+ - Report diff/version tracking
263
+ - LangGraph integration
264
+ - MCP-compatible tool surfaces
265
+
266
+ ---
267
+
268
+ ## Supported Models
269
+
270
+ Current configured models:
271
+
272
+ | Model | Purpose |
273
+ |---|---|
274
+ | HauhauCS/Gemma-4-E4B-Uncensored-HauhauCS-Aggressive | Experimental coding and reasoning |
275
+ | DeepHat/DeepHat-V1-7B | Security-oriented generation workflows |
276
+ | Meta-Llama-3-8B-Instruct | General-purpose assistant workflows |
277
+
278
+ Model availability depends on provider access and deployment configuration.
279
+
280
+ ---
281
+
282
+ ## Repository Structure
283
+
284
+ Current starter package:
285
+
286
+ ```text
287
+ .
288
+ ├── app.py
289
+ ├── requirements.txt
290
+ ├── README.md
291
+ └── .streamlit/
292
+ └── config.toml
293
+ ```
294
+
295
+ Recommended expanded structure:
296
+
297
+ ```text
298
+ .
299
+ ├── app.py
300
+ ├── requirements.txt
301
+ ├── README.md
302
+ ├── assets/
303
+ ├── workflows/
304
+ ├── prompts/
305
+ ├── reports/
306
+ ├── utils/
307
+ ├── components/
308
+ └── tests/
309
+ ```
310
+
311
+ Recommended modularization:
312
+
313
+ | Directory | Purpose |
314
+ |---|---|
315
+ | workflows/ | Workflow orchestration logic |
316
+ | prompts/ | Prompt templates and chains |
317
+ | reports/ | Generated report artifacts |
318
+ | utils/ | Shared utilities |
319
+ | components/ | Streamlit UI components |
320
+ | assets/ | Static images and branding |
321
+ | tests/ | Unit tests and workflow validation checks |
322
+
323
+ ---
324
+
325
+ ## Installation
326
+
327
+ ### Local Development
328
+
329
+ Clone the repository:
330
 
331
  ```bash
332
+ git clone https://github.com/your-org/purple-team-code-workbench.git
333
+ cd purple-team-code-workbench
 
 
334
  ```
335
 
336
+ Create a virtual environment:
337
 
338
  ```bash
339
  python -m venv .venv
340
+ ```
341
+
342
+ Activate the environment:
343
+
344
+ #### Linux/macOS
345
+
346
+ ```bash
347
  source .venv/bin/activate
348
+ ```
349
+
350
+ #### Windows PowerShell
351
+
352
+ ```powershell
353
+ .venv\Scripts\Activate.ps1
354
+ ```
355
+
356
+ #### Windows Command Prompt
357
+
358
+ ```cmd
359
+ .venv\Scripts\activate.bat
360
+ ```
361
+
362
+ Install dependencies:
363
+
364
+ ```bash
365
  pip install -r requirements.txt
366
+ ```
367
+
368
+ Run the application:
369
+
370
+ ```bash
371
+ streamlit run app.py
372
+ ```
373
+
374
+ ---
375
+
376
+ ## Hugging Face Spaces Deployment
377
+
378
+ This repository is compatible with:
379
+
380
+ - Hugging Face Streamlit Spaces
381
+ - CPU deployments
382
+ - OAuth-enabled Spaces
383
+ - External inference providers
384
+
385
+ The README front matter already includes Space metadata:
386
+
387
+ ```yaml
388
+ sdk: streamlit
389
+ sdk_version: 1.57.0
390
+ python_version: "3.11"
391
+ app_file: app.py
392
+ license: apache-2.0
393
+ suggested_hardware: cpu-upgrade
394
+ suggested_storage: small
395
+ ```
396
+
397
+ Basic deployment path:
398
+
399
+ 1. Create a new Hugging Face Space.
400
+ 2. Select **Streamlit** as the SDK.
401
+ 3. Upload `app.py`, `requirements.txt`, `README.md`, and `.streamlit/config.toml`.
402
+ 4. Confirm the Space builds against Python 3.11 and Streamlit 1.57.0.
403
+ 5. Add secrets only if external inference providers are integrated later.
404
+
405
+ ---
406
+
407
+ ## Inference Providers
408
+
409
+ The starter app does not include live inference calls by default.
410
+
411
+ Future provider integrations may use:
412
+
413
+ - Hugging Face Inference Providers
414
+ - External API routing
415
+ - Local runtime configuration
416
+ - OAuth authentication state
417
+ - Deployment hardware constraints
418
+
419
+ Recommended provider design:
420
+
421
+ - keep API keys in environment variables or Space secrets
422
+ - separate provider logic from UI components
423
+ - log model profile, prompt template, and output metadata
424
+ - avoid storing secrets in reports, findings, or exported prompt artifacts
425
+ - treat model output as untrusted until reviewed
426
+
427
+ ---
428
+
429
+ ## Recommended Operational Controls
430
+
431
+ If deploying in production environments:
432
+
433
+ - Require authentication
434
+ - Log workflow activity
435
+ - Separate trusted/untrusted prompts
436
+ - Sandbox execution environments
437
+ - Restrict outbound networking
438
+ - Validate generated artifacts
439
+ - Maintain immutable audit trails
440
+ - Enforce scoped execution policies
441
+ - Require approval before provider calls
442
+ - Prevent secrets from entering exported reports
443
+ - Separate draft generation from operational action
444
+
445
+ ---
446
+
447
+ ## Example Workflow
448
+
449
+ ```text
450
+ Scope Definition
451
+
452
+ Passive Recon
453
+
454
+ Evidence Collection
455
+
456
+ Finding Classification
457
+
458
+ Code / Prompt Generation
459
+
460
+ Human Validation
461
+
462
+ Report Export
463
+ ```
464
+
465
+ ---
466
+
467
+ ## Data Handling
468
+
469
+ By default, the starter app stores records in Streamlit session state.
470
+
471
+ That means:
472
+
473
+ - records persist only for the active session
474
+ - exports should be downloaded before closing or refreshing the session
475
+ - no database is configured by default
476
+ - no external telemetry is implemented by default
477
+
478
+ For production use, add explicit persistence through a controlled backend such as SQLite, PostgreSQL, Supabase, or another approved datastore.
479
+
480
+ ---
481
+
482
+ ## Exported Artifacts
483
+
484
+ The current app can export:
485
+
486
+ - workflow prompts as Markdown
487
+ - findings as JSON
488
+ - findings as CSV
489
+ - findings as Markdown
490
+ - evidence ledger as JSON
491
+ - full report as Markdown
492
+
493
+ All exported artifacts should be reviewed before use in client reports, internal tickets, detection engineering tasks, or remediation workflows.
494
+
495
+ ---
496
+
497
+ ## Testing & Quality Checks
498
+
499
+ Suggested local checks:
500
+
501
+ ```bash
502
+ python -m py_compile app.py
503
  streamlit run app.py
504
  ```
505
 
506
+ Recommended future checks:
507
+
508
+ ```bash
509
+ python -m pip install ruff pytest bandit pip-audit
510
+ ruff check .
511
+ bandit -r .
512
+ pip-audit
513
+ pytest
514
+ ```
515
+
516
+ For now, the starter package is intentionally small, so the primary validation path is syntax checking plus manual UI testing.
517
+
518
+ ---
519
+
520
+ ## Development Roadmap
521
+
522
+ ### Phase 1
523
+
524
+ - Scope-gated workflows
525
+ - Findings management
526
+ - Report export
527
+ - Prompt surface
528
+ - Evidence ledger
529
+
530
+ ### Phase 2
531
+
532
+ - Agent coordination
533
+ - Structured memory
534
+ - Typed contracts
535
+ - Multi-model routing
536
+
537
+ ### Phase 3
538
+
539
+ - Drift-aware orchestration
540
+ - Evidence graphs
541
+ - Policy enforcement engine
542
+ - Autonomous validation loops
543
+
544
+ ---
545
+
546
+ ## Contributing
547
+
548
+ Contributions should prioritize:
549
+
550
+ - clarity
551
+ - safety
552
+ - reproducibility
553
+ - deterministic behavior
554
+ - typed interfaces
555
+ - operational traceability
556
+
557
+ Before submitting:
558
+
559
+ - run linting
560
+ - validate workflows
561
+ - document assumptions
562
+ - avoid opaque automation behavior
563
+ - confirm no unsafe workflow bypasses were introduced
564
+ - keep generated content reviewable by humans
565
+
566
+ ---
567
+
568
+ ## License
569
+
570
+ Licensed under the Apache 2.0 License.
571
+
572
+ See the LICENSE file for details.
573
+
574
+ ---
575
+
576
+ ## Disclaimer
577
+
578
+ This project is provided for authorized security research, defensive engineering, and educational purposes only.
579
+
580
+ The maintainers assume no liability for misuse, unauthorized deployment, or operational damage caused by derivative implementations.
581
+
582
+ Generated outputs may contain inaccuracies, insecure assumptions, or incomplete implementations.
583
+
584
+ Human review is required before production or operational use.
585
+
586
+ ---
587
+
588
+ ## Acknowledgements
589
+
590
+ Built with:
591
+
592
+ - Streamlit
593
+ - Hugging Face
594
+ - Python Software Foundation
595
 
596
+ Inspired by structured operational engineering, purple-team methodology, and the stubborn belief that security tooling should behave like systems engineering rather than ritual magic.