Skip to content

Commit e7d3c20

Browse files
authored
Release v1.15.0 (#228)
1 parent ef0cfad commit e7d3c20

File tree

5 files changed

+136
-5
lines changed

5 files changed

+136
-5
lines changed

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# libddwaf release
22

3+
### v1.15.0 ([unstable](https://github.com/DataDog/libddwaf/blob/master/README.md#versioning-semantics))
4+
5+
This new version of the WAF includes the following new features:
6+
- Ephemeral addresses for composite requests
7+
- Naive duplicate address support on input filters
8+
- Required / Optional address diagnostics
9+
10+
The [upgrading guide](UGRADING.md) has also been updated to cover the new changes.
11+
12+
#### API & Breaking Changes
13+
- Support ephemeral addresses on `ddwaf_run` ([#219](https://github.com/DataDog/libddwaf/pull/219))
14+
- Rename `ddwaf_required_addresses` to `ddwaf_known_addresses` ([#221](https://github.com/DataDog/libddwaf/pull/221))
15+
16+
#### Fixes
17+
- Schema extraction scanners: reduce false positives on arrays ([#220](https://github.com/DataDog/libddwaf/pull/220))
18+
19+
#### Changes
20+
- Ephemeral addresses for rules & exclusion filters ([#219](https://github.com/DataDog/libddwaf/pull/219))([#224](https://github.com/DataDog/libddwaf/pull/224))
21+
- Address diagnostics ([#221](https://github.com/DataDog/libddwaf/pull/221))
22+
- Naive duplicate address support on input/object filters ([#222](https://github.com/DataDog/libddwaf/pull/222))
23+
24+
#### Miscellaneous
25+
- Update nuget packaging to use new musl linux binaries ([#217](https://github.com/DataDog/libddwaf/pull/217))
26+
- Validator improvements ([#225](https://github.com/DataDog/libddwaf/pull/225))
27+
- Use `fmt::format` for logging and vendorize some dependencies within `src/` ([#226](https://github.com/DataDog/libddwaf/pull/226))
28+
- Reduce linux binary size and fix some flaky tests ([#227](https://github.com/DataDog/libddwaf/pull/227))
29+
330
### v1.14.0 ([unstable](https://github.com/DataDog/libddwaf/blob/master/README.md#versioning-semantics))
431

532
This release of the WAF includes the following new features:

UPGRADING.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,108 @@
11
# Upgrading libddwaf
22

3+
## Upgrading from `1.14.0` to `1.15.0`
4+
5+
### Interface changes
6+
7+
With the introduction of ephemeral addresses, `ddwaf_run` now allows the caller to provide data as both persistent or ephemeral. The new signature can be seen below:
8+
```c
9+
DDWAF_RET_CODE ddwaf_run(ddwaf_context context, ddwaf_object *persistent_data,
10+
ddwaf_object *ephemeral_data, ddwaf_result *result, uint64_t timeout);
11+
```
12+
13+
Both `persistent_data` and `ephemeral_data` are nullable, however at least one of them has to be non-null for the call to be valid. Otherwise the call to `ddwaf_run` will return the error `DDWAF_ERR_INVALID_ARGUMENT`.
14+
15+
The other interface change is the renaming of `ddwaf_required_addresses` to `ddwaf_known_addresses`, aside from the name change, the signature hasn't changed, as can be seen below:
16+
17+
```c
18+
const char* const* ddwaf_known_addresses(const ddwaf_handle handle, uint32_t *size);
19+
```
20+
21+
The reason for the name change is to better reflect the nature of the addresses provided by this function, which will now provide a list of all addresses seen by the WAF, regardless of whether they are required for rule, filter or processor evaluation, or whether they are optionally used when available, such as part of an exclusion filter for inputs or a processor mapping. A more accurate distinction, as well as a breakdown of the addresses required by each of the supported high-level features, is now provided as part of the diagnostics returned by `ddwaf_init` and `ddwaf_update`.
22+
23+
Finally, `testPowerWAF` has been renamed to `waf_test`, while this isn't an interface change it might affect those building and testing the WAF directly.
24+
25+
### Ephemeral addresses
26+
27+
Ephemeral addresses is a new feature aimed at providing better support for protocols composed of a single request with multiple subrequests, such as gRPC client / server streaming or GraphQL. As the name implies, ephemeral addresses are short-lived:
28+
- These addresses are only used for evaluation of rules and exclusion filters during the `ddwaf_run` call in which they are provided; subsequent calls will have no access to these addresses.
29+
- At the end of `ddwaf_run` the memory associated with the ephemeral addresses is freed.
30+
31+
As an example, these addresses can be used to evaluate independent gRPC messages within the context of the whole HTTP request. A call with the whole HTTP context and the first gRPC message could look as follows:
32+
```json
33+
{
34+
"persistent": {
35+
"server.request.headers.no_cookies": [ "..." ],
36+
"server.request.uri.raw": "...",
37+
"http.client_ip": "..."
38+
},
39+
"ephemeral": {
40+
"grpc.server.request.message": { "..." }
41+
}
42+
}
43+
```
44+
45+
Subsequent calls only need to provide the relevant gRPC message data:
46+
```json
47+
{
48+
"ephemeral": {
49+
"grpc.server.request.message": { "..." }
50+
}
51+
}
52+
```
53+
54+
When using ephemeral addresses in this manner, each call is somewhat equivalent to creating a new context and providing all of the data at once for each message, however:
55+
- The new approach doesn't need to reevaluate the already evaluated persistent addresses for each gRPC message.
56+
- Consequently the new approach does not provide duplicate events for the already evaluated persistent addresses.
57+
- The performance impact should be much smaller when using the new approach since less rules need to be evaluated and the context can be reused rather than created & destroyed for each message.
58+
59+
Finally, aside from the addresses themselves being ephemeral, the outcome of any evaluation with an ephemeral address is also ephemeral. The evaluation of any condition, from either rules, filters or processors, with ephemeral addresses will always be uncached, meaning that subsequent calls to `ddwaf_run` will reevaluate said conditions if relevant addresses are provided.
60+
61+
Similarly, any address, object or rule excluded as a result of the evaluation of an ephemeral address, either due to the filter condition matching on an ephemeral address or the excluded address being ephemeral, will only have effect for the duration of the `ddwaf_run` call. As a result, subsequent calls to `ddwaf_run` will be able to evaluate those previously excluded rules or addresses, unless filtered again.
62+
63+
### Address diagnostics
64+
In order to provide more visibility regarding the breakdown of addresses per feature and whether they are required or optional, the latest version of the WAF introduces address diagnostics. These diagnostics can typically be obtained through a call to `ddwaf_init` or `ddwaf_update` and are broken down per feature, for example:
65+
66+
```json
67+
68+
{
69+
"rules": {
70+
"loaded": [
71+
"a45b55fc-5b57-4002-90bf-58cdf296124c"
72+
],
73+
"failed": [],
74+
"errors": {},
75+
"addresses": {
76+
"required": [
77+
"http.client_ip",
78+
"usr.id",
79+
"server.request.headers.no_cookies",
80+
"graphql.server.all_resolvers",
81+
"grpc.server.request.message",
82+
"server.request.path_params",
83+
"server.request.body",
84+
"server.request.query",
85+
"server.request.uri.raw",
86+
"server.response.status",
87+
"grpc.server.request.metadata"
88+
],
89+
"optional": []
90+
}
91+
}
92+
}
93+
```
94+
95+
The distinction between required and optional addresses depends on the feature:
96+
- Rules only have required addresses.
97+
- Exclusion filters have both required and optional addresses:
98+
- The required addresses correspond to those used within the filter conditions, i.e. those which are required for the filter to be evaluated altogether.
99+
- Currently the only optional addresses are those of the excluded inputs, e.g. a filter could exclude `http.client_ip` for a specific endpoint, this address would be optional since it's only used when available.
100+
- Processors also have both required and optional addresses:
101+
- The required addresses correspond to those used within the processor conditions.
102+
- The optional addresses correspond to each of the processor mappings, for example if a processor uses `server.request.body.raw` to generate `server.request.body`, the former would be considered optional.
103+
104+
Other diagnostics, such as `rules_data` or `rules_override`, do not provide the addresses key.
105+
3106
## Upgrading from `1.12.0` to `1.13.0`
4107

5108
### Interface changes

tools/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ foreach(EXAMPLE ${LIBDDWAF_EXAMPLE_SOURCE})
77
add_executable(${EXAMPLE_NAME} ${EXAMPLE} ${LIBDDWAF_EXAMPLE_COMMON_SOURCE})
88
target_link_libraries(${EXAMPLE_NAME} PRIVATE libddwaf_objects lib_yamlcpp lib_rapidjson)
99
target_include_directories(${EXAMPLE_NAME} PRIVATE ${libddwaf_SOURCE_DIR}/src)
10+
target_include_directories(${EXAMPLE_NAME} PRIVATE ${libddwaf_SOURCE_DIR}/src/vendor)
1011

1112
set_target_properties(${EXAMPLE_NAME} PROPERTIES
1213
CXX_STANDARD 20

tools/verify_ruleset.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
1515
ddwaf_set_log_cb(log_cb, DDWAF_LOG_TRACE);
1616

1717
if (argc < 2) {
18-
DDWAF_ERROR("Usage: %s <json/yaml file>", argv[0]);
18+
DDWAF_ERROR("Usage: {} <json/yaml file>", argv[0]);
1919
return EXIT_FAILURE;
2020
}
2121

@@ -33,13 +33,13 @@ int main(int argc, char *argv[])
3333

3434
DDWAF_INFO("Ruleset loaded successfully");
3535

36-
DDWAF_INFO("Diagnostics:\n%s", object_to_json(diagnostics).c_str());
36+
DDWAF_INFO("Diagnostics:\n{}", object_to_json(diagnostics).c_str());
3737
ddwaf_object_free(&diagnostics);
3838

3939
uint32_t required_size;
4040
const char *const *required = ddwaf_known_addresses(handle, &required_size);
41-
DDWAF_INFO("Required addresses: %u", required_size);
42-
for (uint32_t i = 0; i < required_size; i++) { DDWAF_INFO(" - %s", required[i]); }
41+
DDWAF_INFO("Required addresses: {}", required_size);
42+
for (uint32_t i = 0; i < required_size; i++) { DDWAF_INFO(" - {}", required[i]); }
4343
ddwaf_destroy(handle);
4444

4545
return EXIT_SUCCESS;

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.14.0
1+
1.15.0

0 commit comments

Comments
 (0)