You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,7 +185,9 @@ For more examples and use cases, check out [Hook Examples](docs/en-US/Hook-Examp
185
185
186
186
## About This Fork
187
187
188
-
This project is a maintained fork of the original [webhook](https://github.com/adnanh/webhook) project, focused on:
188
+
This project is a maintained fork of the original [webhook](https://github.com/adnanh/webhook) project. Current supported versions are 5.x; see [SECURITY.md](SECURITY.md) for the version support table.
189
+
190
+
The fork is focused on:
189
191
190
192
-**Security**: Regular security updates, vulnerability fixes, and enhanced security features
191
193
-**Maintenance**: Active development, dependency updates, and bug fixes
Copy file name to clipboardExpand all lines: SECURITY.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,23 @@ Current support status of each version.
6
6
7
7
| Version | Supported |
8
8
| ------- | ------------------ |
9
-
|3.4.x|:white_check_mark:|
10
-
| < 3.4.1|:x:|
9
+
|5.x |:white_check_mark:|
10
+
| < 5.0|:x:|
11
11
12
12
## Security Features
13
13
14
14
### Command Injection Protection
15
15
16
16
Webhook includes several security features to help prevent command injection attacks:
17
17
18
-
1.**Command Path Whitelist**: Use `--allowed-command-paths` (or `ALLOWED_COMMAND_PATHS` environment variable) to restrict which commands can be executed. Only commands from the whitelist will be allowed to run.
18
+
1.**Command Path Whitelist**: Use `-allowed-command-paths` (or `ALLOWED_COMMAND_PATHS` environment variable) to restrict which commands can be executed. Only commands from the whitelist will be allowed to run.
19
19
20
20
2.**Argument Validation**:
21
-
-`--max-arg-length`: Limit the maximum length of a single argument (default: 1MB)
22
-
-`--max-total-args-length`: Limit the total length of all arguments (default: 10MB)
23
-
-`--max-args-count`: Limit the maximum number of arguments (default: 1000)
21
+
-`-max-arg-length`: Limit the maximum length of a single argument (default: 1MB)
22
+
-`-max-total-args-length`: Limit the total length of all arguments (default: 10MB)
23
+
-`-max-args-count`: Limit the maximum number of arguments (default: 1000)
24
24
25
-
3.**Strict Mode**: Enable `--strict-mode` to reject arguments containing potentially dangerous characters (shell special characters like `;`, `|`, `&`, `` ` ``, `$`, etc.)
25
+
3.**Strict Mode**: Enable `-strict-mode` to reject arguments containing potentially dangerous characters (shell special characters like `;`, `|`, `&`, `` ` ``, `$`, etc.)
26
26
27
27
4.**Secure Logging**: All command executions are logged with sensitive information (passwords, tokens, keys) automatically sanitized.
28
28
@@ -31,8 +31,8 @@ Webhook includes several security features to help prevent command injection att
31
31
- Enable strict mode for enhanced security
32
32
- Set appropriate limits for argument length and count
33
33
- Regularly review and update your whitelist
34
-
- Never enable `--allow-auto-chmod` in production (it's a security risk)
35
-
- Do not enable `--openapi` or `--config-ui` on publicly reachable servers (they have no authentication; use only for debugging or intranet). Config UI is mounted on the webhook server; restrict access with firewall/reverse proxy.
34
+
- Never enable `-allow-auto-chmod` in production (it's a security risk)
35
+
- Do not enable `-openapi` or `-config-ui` on publicly reachable servers (they have no authentication; use only for debugging or intranet). Config UI is mounted on the webhook server; restrict access with firewall/reverse proxy.
36
36
37
37
For more details, see the [Webhook Parameters (English)](docs/en-US/Webhook-Parameters.md) or [配置参数 (中文)](docs/zh-CN/Webhook-Parameters.md).
Copy file name to clipboardExpand all lines: docs/en-US/API-Reference.md
+45-4Lines changed: 45 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ http://your-server:9000
12
12
13
13
You can customize the IP address and port using the `-ip` and `-port` command-line arguments or environment variables.
14
14
15
+
**Reserved paths and path conflicts:** Do not set `-openapi-path` or `-config-ui-path` to a path that conflicts with reserved endpoints. Reserved paths include `/`, `/health`, `/livez`, `/readyz`, `/version`, `/metrics`, and the hook base path (e.g. `/hooks`). If a conflict is detected at startup, the server will skip registering that route and log a warning.
16
+
15
17
## Endpoints
16
18
17
19
### 1. Root Endpoint
@@ -53,9 +55,48 @@ curl http://localhost:9000/
53
55
curl http://localhost:9000/health
54
56
```
55
57
58
+
**Note:** The exact JSON structure is defined by the health check library (e.g. it may include multiple check results). For the precise schema, see the OpenAPI spec when `-openapi` is enabled.
59
+
60
+
---
61
+
62
+
### 3. Liveness and Readiness Endpoints
63
+
64
+
**Endpoints:**`GET /livez`, `GET /readyz`
65
+
66
+
**Description:** Kubernetes-style liveness and readiness probes. `/livez` indicates the process is running; `/readyz` reports whether the server is ready to accept traffic (e.g. after loading hooks).
67
+
68
+
**Response:**
69
+
-**Status Code:**`200 OK` when healthy/ready; non-2xx when not.
70
+
-**Content-Type:**`application/json`
71
+
-**Body:** Implementation-defined JSON (see OpenAPI spec for schema when `-openapi` is enabled).
72
+
73
+
**Example:**
74
+
```bash
75
+
curl http://localhost:9000/livez
76
+
curl http://localhost:9000/readyz
77
+
```
78
+
79
+
---
80
+
81
+
### 4. Version Endpoint
82
+
83
+
**Endpoint:**`GET /version`
84
+
85
+
**Description:** Returns server version and build information in JSON format, with optional `X-`-prefixed response headers for version details.
86
+
87
+
**Response:**
88
+
-**Status Code:**`200 OK`
89
+
-**Content-Type:**`application/json`
90
+
-**Body:** JSON with version fields (e.g. `version`, `commit`, `buildDate`, `branch`). Exact structure is defined by the version library; use the OpenAPI spec when `-openapi` is enabled for the full schema.
Copy file name to clipboardExpand all lines: docs/en-US/Hook-Definition.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,13 +8,13 @@ Hooks are defined as objects in the JSON or YAML hooks configuration file. Pleas
8
8
*`execute-command` - specifies the command that should be executed when the hook is triggered
9
9
*`command-working-directory` - specifies the working directory that will be used for the script when it's executed
10
10
*`response-message` - specifies the string that will be returned to the hook initiator
11
-
*`response-headers` - specifies the list of headers in format `{"name": "X-Example-Header", "value": "it works"}` that will be returned in HTTP response for the hook
11
+
*`response-headers` - list of header objects returned in the HTTP response for the hook; each object has `"name"` and `"value"` (e.g. `{"name": "X-Example-Header", "value": "it works"}`)
12
12
*`success-http-response-code` - specifies the HTTP status code to be returned upon success
13
13
*`incoming-payload-content-type` - sets the `Content-Type` of the incoming HTTP request (ie. `application/json`); useful when the request lacks a `Content-Type` or sends an erroneous value
14
14
*`http-methods` - a list of allowed HTTP methods, such as `POST` and `GET`
15
15
*`include-command-output-in-response` - boolean whether webhook should wait for the command to finish and return the raw output as a response to the hook initiator. If the command fails to execute or encounters any errors while executing the response will result in 500 Internal Server Error HTTP status code, otherwise the 200 OK status code will be returned.
16
16
*`stream-command-output` - boolean whether webhook should stream the command output to the HTTP response. When enabled, the command's `stdout` and `stderr` are streamed in real-time to the client, rather than waiting for the command to finish before returning. This is useful for long-running commands.
17
-
*`include-command-output-in-response-on-error` - boolean whether webhook should include command stdout & stderror as a response in failed executions. It only works if `include-command-output-in-response` is set to `true`.
17
+
*`include-command-output-in-response-on-error` - boolean whether webhook should include command stdout & stderr as a response in failed executions. It only works if `include-command-output-in-response` is set to `true`.
18
18
*`parse-parameters-as-json` - specifies the list of arguments that contain JSON strings. These parameters will be decoded by webhook and you can access them like regular objects in rules and `pass-arguments-to-command`.
19
19
*`pass-arguments-to-command` - specifies the list of arguments that will be passed to the command. Check [Referencing request values page](Referencing-Request-Values.md) to see how to reference the values from the request. If you want to pass a static string value to your command you can specify it as
Copy file name to clipboardExpand all lines: docs/en-US/Webhook-Parameters.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This document describes all available command-line parameters and environment va
11
11
|`-ip string`| IP address the webhook should serve hooks on |`0.0.0.0`|
12
12
|`-port int`| Port the webhook should serve hooks on |`9000`|
13
13
|`-hooks value`| Explicit single-file mode: path to JSON/YAML hook definitions (can be used multiple times) | - |
14
-
|`-hooks-dir string`| Directory mode: scan hook config files (*.json, *.yaml, *.yml); if empty, watchfor new files; use with Config UI to enable save-to-dir |`./hooks`|
14
+
|`-hooks-dir string`| Directory to scan for hook config files (*.json, *.yaml, *.yml). Default `./hooks`. If explicitly set to an empty string, directory mode is not used; when set to a non-empty path, that directory is scanned and (with `-hotreload` or directory watch) can be watched for new files. With Config UI, enables save-to-dir when in directory mode.|`./hooks`|
15
15
|`-urlprefix string`| URL prefix for served hooks (protocol://yourserver:port/PREFIX/:hook-id); also used by Config UI for the generated call URL |`hooks`|
0 commit comments