Skip to content

Commit f99efe3

Browse files
authored
Merge pull request #4033 from DataDog/glopes/libddwaf-rust-2.0.1
Update libddwaf to 2.0.1 on the rust helper
2 parents 0c09f3c + ef31977 commit f99efe3

5 files changed

Lines changed: 22 additions & 21 deletions

File tree

appsec/helper-rust/CLAUDE.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,8 @@ The appsec child pipeline IID can be found in the parent pipeline's downstream p
318318
The GitLab MCP tools don't include a job trace/log reader. To read job logs via the API:
319319

320320
```bash
321-
# Extract the token from MCP config (project ID 355 = DataDog/apm-reliability/dd-trace-php)
322-
jq -r '.mcpServers.gitlab.env.GITLAB_PERSONAL_ACCESS_TOKEN' ~/.claude.json
323-
324-
# Then fetch job trace using the token
325-
curl -s -H "PRIVATE-TOKEN: <TOKEN>" "https://gitlab.ddbuild.io/api/v4/projects/355/jobs/<JOB_ID>/trace" > /tmp/...
321+
# project ID 355 = DataDog/apm-reliability/dd-trace-php
322+
curl -s -H "PRIVATE-TOKEN: $GITLAB_PERSONAL_ACCESS_TOKEN" "https://gitlab.ddbuild.io/api/v4/projects/355/jobs/<JOB_ID>/trace" > /tmp/...
326323
```
327324

328325
### Monitoring CI Jobs

appsec/helper-rust/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

appsec/helper-rust/scripts/check-ci-jobs.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"""
1414

1515
import argparse
16-
import json
1716
import os
1817
import subprocess
1918
import sys
@@ -50,18 +49,12 @@
5049

5150

5251
def get_token() -> str:
53-
config_path = Path.home() / ".claude.json"
54-
config = json.loads(config_path.read_text())
55-
token = (
56-
config.get("mcpServers", {})
57-
.get("gitlab", {})
58-
.get("env", {})
59-
.get("GITLAB_PERSONAL_ACCESS_TOKEN")
60-
)
61-
if not token or token == "null":
62-
print("ERROR: Could not extract GitLab token from ~/.claude.json", file=sys.stderr)
63-
sys.exit(1)
64-
return token
52+
token = os.environ.get("GITLAB_PERSONAL_ACCESS_TOKEN")
53+
if token and token != "null":
54+
return token
55+
56+
print("ERROR: GITLAB_PERSONAL_ACCESS_TOKEN is not set", file=sys.stderr)
57+
sys.exit(1)
6558

6659

6760
def api_get(token: str, path: str, params: dict | None = None) -> list | dict:

appsec/helper-rust/src/client.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,17 @@ impl ReqContext {
709709
RunnableCtx::Owned(ctx) => ctx.run(data, timeout),
710710
}
711711
}
712+
713+
fn run_batches(
714+
&mut self,
715+
data: libddwaf::object::WafArray,
716+
timeout: Duration,
717+
) -> Result<libddwaf::RunResult, libddwaf::RunError> {
718+
match self {
719+
RunnableCtx::Borrowed(ctx) => ctx.run_batches(data, timeout),
720+
RunnableCtx::Owned(ctx) => ctx.run_batches(data, timeout),
721+
}
722+
}
712723
}
713724
match options.subctx_id.as_ref() {
714725
None => Ok(RunnableCtx::Borrowed(&mut self.waf_ctx)),

0 commit comments

Comments
 (0)