ShadowOps Deploy commited on
Commit
d7d3f0c
·
1 Parent(s): c826192

🔧 Fix: Create mandatory README.md with YAML config

Browse files
Files changed (1) hide show
  1. README.md +147 -0
README.md ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: ShadowOps Guardian
3
+ emoji: 🛡️
4
+ colorFrom: blue
5
+ colorTo: black
6
+ sdk: docker
7
+ app_port: 7860
8
+ pinned: false
9
+ ---
10
+
11
+ # 🛡️ ShadowOps: Predictive Quarantine & Reality Forking for AI Agents
12
+ **Team DuoXCode | Meta PyTorch OpenEnv Hackathon**
13
+ # ShadowOps OpenEnv Submission Draft
14
+
15
+ ## What ShadowOps Is
16
+ ShadowOps is an OpenEnv-style reinforcement learning environment for autonomous cyber incident response. The agent receives a live security action, observes risk signals, missing evidence, memory from prior actions, and production impact, then chooses one supervisor action: `ALLOW`, `BLOCK`, `QUARANTINE`, or `FORK`.
17
+
18
+ The current demo is laptop-safe and model-free by default. The Q-aware supervisor establishes a strong pre-training baseline while the SFT/GRPO training pipeline remains ready for GPU execution.
19
+
20
+ ## Why Autonomous Cyber Incident Response Is Hard
21
+ Security automation is not just classification. A wrong `ALLOW` can expose customer data, open SSH to the internet, or create an IAM admin path. A wrong `BLOCK` can stop an approved pentest, break-glass recovery, or critical deployment. The environment rewards agents that balance safety, evidence, risk memory, and false-positive reduction.
22
+
23
+ ## What The Agent Learns
24
+ The agent learns to:
25
+
26
+ - Separate malicious actions from risky-looking but approved work.
27
+ - Ask for missing evidence before allowing production changes.
28
+ - Accumulate risk across multi-step chains.
29
+ - Prefer quarantine or human review when uncertainty is real.
30
+ - Avoid unsafe allow decisions on high-risk incidents.
31
+
32
+ ## Environment Design
33
+ ShadowOps wraps the existing simulation in `backend-ml/openenv_shadowops_env.py`.
34
+
35
+ Interface:
36
+
37
+ ```python
38
+ from openenv_shadowops_env import make_env
39
+
40
+ env = make_env(seed=42)
41
+ observation = env.reset()
42
+ observation, reward, done, info = env.step("QUARANTINE")
43
+ state = env.state()
44
+ env.close()
45
+ ```
46
+
47
+ The environment includes deterministic seed support, multi-step incident trajectories, memory persistence support, reward breakdowns, evidence plans, and safe outcomes.
48
+
49
+ ## Observation, Action, Reward
50
+ Observation includes:
51
+
52
+ - Cybersecurity incident prompt
53
+ - 16-dimensional risk vector
54
+ - Incident domain, intent, payload, and tier
55
+ - Health scores and quarantine status
56
+ - Memory context and accumulated risk
57
+ - Available actions
58
+
59
+ Action space:
60
+
61
+ - `ALLOW`: execute when risk is low or trusted evidence is strong
62
+ - `BLOCK`: reject clearly malicious or high-danger action
63
+ - `QUARANTINE`: isolate until missing evidence is provided
64
+ - `FORK`: route to human/shadow review when approval is required
65
+
66
+ Reward is decomposed into:
67
+
68
+ - Action correctness reward
69
+ - Safety penalty
70
+ - False-positive penalty
71
+ - Evidence-completeness reward
72
+ - Risk-chain handling reward
73
+ - Uncertainty handling reward
74
+
75
+ ## Why This Is Not A Normal Dashboard
76
+ ShadowOps is an RL environment with an executable step loop, not a static UI. Agent actions mutate future state: production/shadow state, quarantine holds, memory, cumulative risk, evidence plans, and final outcomes.
77
+
78
+ ## Baseline Results
79
+ Generated from local validation with no model loading:
80
+
81
+ | Policy | exact_match | safety_accuracy | unsafe_decision_rate | false_positive_rate | reward_mean |
82
+ | --- | ---: | ---: | ---: | ---: | ---: |
83
+ | Random | 0.360 | 0.800 | 0.200 | 0.163 | 0.083 |
84
+ | Heuristic | 0.520 | 0.920 | 0.080 | 0.000 | 1.146 |
85
+ | Q-aware | 0.990 | 1.000 | 0.000 | 0.000 | 1.899 |
86
+ | Oracle | 1.000 | 1.000 | 0.000 | 0.000 | 1.920 |
87
+
88
+ Q-aware supervisor establishes a strong pre-training baseline. GRPO training pipeline is ready. Real trained checkpoint metrics should be inserted after the HF run.
89
+
90
+ ## Why This Is Hard To Game
91
+ The reward is not a single exact-match score. It includes safety, false-positive cost, evidence completeness, uncertainty handling, memory-chain handling, remediation quality, and policy compliance. Always blocking loses reward on approved workflows. Always forking loses reward when evidence is complete. Unsafe allow decisions receive the strongest penalty.
92
+
93
+ ## Hidden Evaluation And False-Positive Traps
94
+ ShadowOps includes a hidden-style evaluation set with 150 scenarios: malicious/adversarial incidents, benign but scary-looking approved workflows, and ambiguous cases requiring human review. The set covers CI/CD, IAM, S3/public storage, Kubernetes, endpoint security, SaaS admin, data export, firewall policy, secrets management, and production deployment.
95
+
96
+ Run:
97
+
98
+ ```powershell
99
+ cd backend-ml
100
+ python training/run_hidden_eval.py
101
+ ```
102
+
103
+ The generated report is saved to `backend-ml/training/reports/hidden_eval_report.md`.
104
+
105
+ ## Memory-Based Multi-Step Incident Response
106
+ ShadowOps evaluates chains where the final decision depends on prior actions, not only the last payload. Examples include firewall exposure followed by IAM admin creation and data export, CI workflow edits followed by secret access and production deploy, and public bucket exposure followed by external transfer and privilege escalation.
107
+
108
+ Run:
109
+
110
+ ```powershell
111
+ cd backend-ml
112
+ python training/multistep_episode_eval.py
113
+ ```
114
+
115
+ The generated report is saved to `backend-ml/training/reports/multistep_episode_report.md`.
116
+
117
+ ## Training Commands
118
+ Laptop-safe validation:
119
+
120
+ ```powershell
121
+ cd backend-ml
122
+ python training/train_qwen3_grpo.py --evaluate-baselines-only --skip-model-load
123
+ python training/generate_submission_plots.py
124
+ python demo_judge.py
125
+ ```
126
+
127
+ GPU training should be launched only from the documented Hugging Face scripts after eval-only validation passes. Do not claim improvement until `model_eval_report.json` proves it and the model-vs-policy gate passes.
128
+
129
+ ## Real Training Evidence
130
+ Real training evidence will be added here after GPU run.
131
+
132
+ Use:
133
+
134
+ ```powershell
135
+ cd backend-ml
136
+ python training/merge_real_training_results.py --input training/training_results_template.json
137
+ ```
138
+
139
+ Replace template values with real checkpoint metrics first. Do not edit code to fake results.
140
+
141
+ ## Hugging Face Space
142
+ HF Space link: TODO
143
+
144
+ ## Demo Video And Slides
145
+ Demo video: TODO
146
+
147
+ Slides: TODO