websec-repair-env / README.md
Daksh Verma
Upload folder using huggingface_hub
57c1397 verified
|
Raw History Blame Contribute Delete
1.96 kB
---
title: WebSec Repair Env
emoji: 🛡️
colorFrom: red
colorTo: gray
sdk: docker
pinned: false
app_port: 8000
base_path: /web
tags:
- openenv
- security
- web
- training
---
# WebSec Repair Env
`websec_repair_env` is a lean OpenEnv environment for AI vulnerability review and remediation.
Each episode presents one deterministic vulnerability scenario and asks the agent to:
1. inspect the task
2. classify the vulnerability
3. apply one discrete patch template
4. verify exploit blocking and functionality preservation
5. submit
The environment ships with exactly three tasks:
- `sqli_login`
- `xss_comments`
- `broken_auth_admin`
## Actions
- `inspect`
- `classify`
- `apply_patch`
- `verify`
- `submit`
## Reward
The score is absolute in `[0.0, 1.0]`:
- `0.25` correct classification
- `0.35` correct patch
- `0.20` exploit blocked
- `0.15` functionality preserved
- `0.05` successful submit
`step()` returns reward as score delta from the previous state.
## Extra Routes
- `GET /tasks`
- `GET /grader`
- `GET /baseline`
`/grader` accepts optional `task_id`.
`/baseline` accepts optional `task_id` and returns a filtered catalog.
## Local Usage
Install and lock dependencies:
```bash
uv sync
```
Run the server:
```bash
uv run server
```
Run the baseline agent against a running server:
```bash
uv run python inference.py --task sqli_login
```
Run tests:
```bash
uv run pytest
```
Validate structure:
```bash
/home/dux/.openclaw/workspace/OpenEnv/venv/bin/openenv validate . --verbose
```
Validate a running server:
```bash
/home/dux/.openclaw/workspace/OpenEnv/venv/bin/openenv validate --url http://127.0.0.1:8000
```
## Docker
Build:
```bash
docker build -t websec-repair-env:latest -f server/Dockerfile .
```
Run:
```bash
docker run --rm -p 8000:8000 websec-repair-env:latest
```
## Hugging Face Spaces
From this environment directory:
```bash
/home/dux/.openclaw/workspace/OpenEnv/venv/bin/openenv push
```