CystronCode commited on
Commit
e5ed341
·
verified ·
1 Parent(s): 34e989e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +39 -1
README.md CHANGED
@@ -9,5 +9,43 @@ license: mit
9
  tags:
10
  - openenv
11
  ---
 
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  tags:
10
  - openenv
11
  ---
12
+ # API Gateway Defender: OpenEnv Environment
13
 
14
+ ## Environment Description and Motivation
15
+ "API Gateway Defender" simulates a live production incident for Site Reliability Engineers (SREs) and DevOps teams. The agent monitors a stream of simulated incoming HTTP requests to a Node.js/Express backend and must configure middleware rules to block malicious traffic while allowing legitimate users through.
16
+
17
+ This environment tests an AI's ability to recognize algorithmic attack patterns (volumetric attacks, distributed scraping, and SQL injection) and write precise, deterministic filtering rules. It bridges the gap between simple text parsing and complex, real-world cybersecurity system management.
18
+
19
+ ## Observation Space
20
+ The agent receives a JSON state containing:
21
+ * `recent_requests`: A list of dictionaries representing the last 100 HTTP requests. Keys include `ip`, `method`, `path`, `user_agent`, `query_string`, and `status_code`.
22
+ * `active_rules`: A list of currently applied middleware filtering rules.
23
+
24
+ ## Action Space
25
+ The agent can execute one of three explicit actions:
26
+ * `add_rate_limit(target_ip)`: Blocks a specific IP address.
27
+ * `block_user_agent(target_user_agent)`: Drops traffic from a specific User-Agent string.
28
+ * `write_custom_middleware(regex_pattern)`: Applies a regex filter to the path and query string.
29
+
30
+ ## Tasks and Expected Difficulty
31
+ 1. **Easy (Volumetric Attack):** Identify and block a single IP making excessive requests to `/login`.
32
+ 2. **Medium (Scraper Bot):** Identify a distributed scraping attack targeting `/api/data` across multiple IPs that share an obscure, identical User-Agent. Write a rule to block the User-Agent.
33
+ 3. **Hard (Distributed SQLi):** An attacker rotates IPs and User-Agents, but all malicious requests contain a specific SQL injection payload in the `query_string`. The agent must deploy a custom regex middleware rule to drop these specific payloads.
34
+
35
+ ## Reward Function and Grader Logic
36
+ The grader evaluates the agent's rules against a hidden test set of 1,000 requests (roughly 80% legitimate, 20% malicious).
37
+ * **Score:** (Percentage of malicious requests blocked) - (Penalty for legitimate requests blocked).
38
+ * **Failure State:** If false positives (blocking legitimate users) exceed 10%, the score drops to 0.0.
39
+
40
+ ## Setup and Usage Instructions
41
+ This environment is fully containerized via Docker and deployed on Hugging Face Spaces.
42
+ 1. Send a POST request to `/reset` with `{"task_id": "easy"}` to initialize the state.
43
+ 2. Retrieve the state via GET `/state`.
44
+ 3. Submit an action via POST `/step` using the defined Action schema.
45
+ 4. Retrieve the score via GET `/grader`.
46
+
47
+ ## Baseline Scores
48
+ The baseline heuristic agent successfully achieves perfect scores across all tasks without triggering the false positive penalty.
49
+ * **Easy:** 1.000
50
+ * **Medium:** 1.000
51
+ * **Hard:** 1.000