Hook cheat sheet: Julia
How to add a vulnboxd runtime hook to a Julia service by hand. Find your setup in the table, then follow its block.
- Without source access: only the compose file changes; redeploy. With source access: you change the code or Dockerfile and rebuild.
- Hub automation says how much the hub's proposals do for you. Fully: approve the proposal in the hub; the block is the fallback when it failed. With conditions: the same, when the conditions listed hold. Partly: the hub pushes the compose part, the rest is yours. Not at all: everything is by hand.
/usr/local/lib/vulnboxd/traceis the hook directory vulnboxd installs on the vulnbox. Compose snippets mount it read-only at/opt/vbxtracein the container.- How to check that the hook works and undo it is at the end of the page.
- Runtime hooks explains what a hook does.
Julia
| Setup | Use this when | Change | Hub automation |
|---|---|---|---|
| vulnboxd hook for HTTP.jl (Julia) | Depends on HTTP, Oxygen or Genie (in its manifest) | source, rebuild | partly |
With source access
These change the service's code or Dockerfile, then it is rebuilt.
vulnboxd hook for HTTP.jl (Julia)
- Use this when: Julia service that depends on
HTTP,OxygenorGenie(in its manifest). - Hub automation: partly. The hub pushes the compose lines; the source change is yours.
- Check and undo: hook mounted into the container
Vendors the pure-Julia VBXTrace module (no compiler needed) and serves the HTTP.jl handler through its stream middleware: request boundaries with the exact per-connection request index; the request context follows every task the handler starts.
1. Compose: merge into the service (app is its name) and redeploy:
services:
app:
volumes:
- /usr/local/lib/vulnboxd/trace:/opt/vbxtrace:ro2. Source change, then rebuild:
- copy
/usr/local/lib/vulnboxd/trace/native/julia/VBXTrace.jlandVBXTraceHTTP.jlinto<service>/vbxtrace/ - after
using HTTP:include("vbxtrace/VBXTrace.jl"); include("vbxtrace/VBXTraceHTTP.jl") - serve through the middleware:
HTTP.serve(VBXTraceHTTP.middleware(HTTP.streamhandler(handler)), host, port; stream = true)(stream handlers: wrap them directly; Oxygen:serve(middleware=...)is request-level, so pass the router toHTTP.serveas above) - optional: report spawned processes (
VBXTrace.spawned(p)), outgoing sockets (VBXTrace.connected(sock)) and opened files (VBXTrace.open(path, mode)) - mount the hook directory read-only at
/opt/vbxtracein the service's compose entry
Example change on a sample service (hooks/native/c4/proposals/julia-http.diff):
# Example: an HTTP.jl service (server.jl) after copying vbxtrace/VBXTrace.jl and vbxtrace/VBXTraceHTTP.jl.
--- a/server.jl
+++ b/server.jl
@@ -1,8 +1,10 @@
using HTTP
+include("vbxtrace/VBXTrace.jl")
+include("vbxtrace/VBXTraceHTTP.jl")
function handler(req::HTTP.Request)
# ...
end
-HTTP.serve(handler, "0.0.0.0", 8080)
+HTTP.serve(VBXTraceHTTP.middleware(HTTP.streamhandler(handler)), "0.0.0.0", 8080; stream = true)
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,2 +3,4 @@ services:
<service>:
build: .
+ volumes:
+ - /usr/local/lib/vulnboxd/trace:/opt/vbxtrace:roExact detection rules
Package C4 (Haskell, OCaml, Julia, R, Scala Native), proposal C4:julia, defined in hooks/native/c4/proposals/julia.toml.
- Image matches (regex):
^julia: - Command matches (regex):
\bjulia\b - Dependency on:
HTTP,Oxygen,Genie - Files:
Project.toml,Manifest.toml,*.jl
Check that it works, and undo
Each block links the variant it needs.
Hook mounted into the container
Check: After the redeploy, this lists the processes that loaded the hook (empty: it is not loaded):
docker compose exec app sh -c 'grep -l vbxtrace /proc/[0-9]*/maps'The hub's Trace tab then shows links whose method starts with hook:.
Undo: Set VBXTRACE: "0" in the service's environment and restart it, or revert the commit (the hub's proposal screen has a revert per container). Remove the mount of /opt/vbxtrace only together with what loads from it: a runtime told to preload a missing file may refuse to start.