@@ -13,25 +13,29 @@ These tests are located in `api/tests/integration_tests/ssrf_proxy/` because the
13
13
### Basic Testing
14
14
15
15
From the ` api/ ` directory:
16
+
16
17
``` bash
17
18
uv run python tests/integration_tests/ssrf_proxy/test_ssrf_proxy.py
18
19
```
19
20
20
21
Or from the repository root:
22
+
21
23
``` bash
22
24
cd api && uv run python tests/integration_tests/ssrf_proxy/test_ssrf_proxy.py
23
25
```
24
26
25
27
### List Available Tests
26
28
27
29
View all test cases without running them:
30
+
28
31
``` bash
29
32
uv run python tests/integration_tests/ssrf_proxy/test_ssrf_proxy.py --list-tests
30
33
```
31
34
32
35
### Use Custom Test File
33
36
34
37
Run tests from a specific YAML file:
38
+
35
39
``` bash
36
40
uv run python tests/integration_tests/ssrf_proxy/test_ssrf_proxy.py --test-file test_cases_extended.yaml
37
41
```
@@ -41,11 +45,13 @@ uv run python tests/integration_tests/ssrf_proxy/test_ssrf_proxy.py --test-file
41
45
** WARNING: Development mode DISABLES all SSRF protections! Only use in development environments!**
42
46
43
47
Test the development mode configuration (used by docker-compose.middleware.yaml):
48
+
44
49
``` bash
45
50
uv run python tests/integration_tests/ssrf_proxy/test_ssrf_proxy.py --dev-mode
46
51
```
47
52
48
53
Development mode:
54
+
49
55
- Mounts ` conf.d.dev/ ` configuration that allows ALL requests
50
56
- Uses ` test_cases_dev_mode.yaml ` by default (all tests expect ALLOW)
51
57
- Verifies that private networks, cloud metadata, and non-standard ports are accessible
@@ -80,8 +86,8 @@ test_categories:
80
86
## Available Test Files
81
87
82
88
1. **test_cases.yaml** - Standard test suite with essential test cases (default)
83
- 2 . **test_cases_extended.yaml** - Extended test suite with additional edge cases and scenarios
84
- 3 . **test_cases_dev_mode.yaml** - Development mode test suite (all requests should be allowed)
89
+ 1 . **test_cases_extended.yaml** - Extended test suite with additional edge cases and scenarios
90
+ 1 . **test_cases_dev_mode.yaml** - Development mode test suite (all requests should be allowed)
85
91
86
92
All files are located in ` api/tests/integration_tests/ssrf_proxy/`
87
93
@@ -102,10 +108,11 @@ All files are located in `api/tests/integration_tests/ssrf_proxy/`
102
108
# # Adding New Test Cases
103
109
104
110
1. Edit the YAML file (or create a new one)
105
- 2 . Add test cases under appropriate categories
106
- 3 . Run with `--test-file` option if using a custom file
111
+ 1 . Add test cases under appropriate categories
112
+ 1 . Run with `--test-file` option if using a custom file
107
113
108
114
Example :
115
+
109
116
` ` ` yaml
110
117
test_categories:
111
118
custom_tests:
@@ -121,6 +128,7 @@ test_categories:
121
128
# # What Gets Tested
122
129
123
130
The tests validate the SSRF proxy configuration files in `docker/ssrf_proxy/` :
131
+
124
132
- ` squid.conf.template` - Squid proxy configuration
125
133
- ` docker-entrypoint.sh` - Container initialization script
126
134
- ` conf.d/` - Additional configuration files (if present)
@@ -129,6 +137,7 @@ The tests validate the SSRF proxy configuration files in `docker/ssrf_proxy/`:
129
137
# # Development Mode Configuration
130
138
131
139
Development mode provides a zero-configuration environment for local development :
140
+
132
141
- Mounts `conf.d.dev/` instead of `conf.d/`
133
142
- Allows ALL requests including private networks and cloud metadata
134
143
- Enables access to any port
@@ -137,12 +146,14 @@ Development mode provides a zero-configuration environment for local development
137
146
# ## Using Development Mode with Docker Compose
138
147
139
148
From the main Dify repository root :
149
+
140
150
` ` ` bash
141
151
# Use the development overlay
142
152
docker-compose -f docker-compose.middleware.yaml -f docker/ssrf_proxy/docker-compose.dev.yaml up ssrf_proxy
143
153
` ` `
144
154
145
155
Or manually mount the development configuration :
156
+
146
157
` ` ` bash
147
158
docker run -d \
148
159
--name ssrf-proxy-dev \
@@ -161,4 +172,4 @@ docker run -d \
161
172
- **Clarity**: YAML format is human-readable and self-documenting
162
173
- **Flexibility**: Multiple test files for different scenarios
163
174
- **Fallback**: Code includes default test cases if YAML loading fails
164
- - **Integration**: Properly integrated with the API project's Python environment
175
+ - **Integration**: Properly integrated with the API project's Python environment
0 commit comments