ProxyT1190

Compile rules from your own code

Not in the docs yet Microglia is not described on docs.gen0sec.com yet. What it reads and produces follows the published product material; the steps that use Synapse follow the docs. Talk to us for access.

When hand-written rules no longer match what the application serves, take the rules from the application itself. Microglia reads its routes, parameter types, auth boundaries and egress, and compiles positive WAF, IDS and firewall rules from them. Review the surface, put your exceptions above the compiled rules, and let the rules ship with the code.

Overview

Rules written by hand describe the application someone remembered. Rules learned from traffic describe the requests that happened to arrive. Neither knows about the debug endpoint that shipped last week, because nobody wrote a rule for it and nobody has called it yet.

The application's surface is already written down, in its own source. Microglia's AI agents read it there and compile it into the rule types Synapse already enforces. The rules are positive: they describe what the application is, so a request outside that shape stands out.

When you see this

  1. Nobody is sure the WAF rules still match the routes the application serves.
  2. A route, debug endpoint or admin path is reachable that nobody meant to expose.
  3. Releases change the application faster than anyone updates its rules.

Steps

  1. 01

    Put Synapse in front of the app

    WAF rules run in proxy mode: Synapse terminates TLS, applies policy and forwards to the unchanged application.

    /etc/synapse/config.yaml
    mode: "proxy"
    
    proxy:
      address_http: "0.0.0.0:80"
      address_tls: "0.0.0.0:443"
      upstream:
        conf: "/etc/synapse/upstreams.yaml"
  2. 02

    Let Microglia read the application

    Microglia reads the source: the routes the application serves, what each route expects to receive, which routes sit behind authentication, and where the application connects out to. That surface is the Application Surface Model. Connecting a repository is not in the docs yet; talk to us to set it up.

  3. 03

    Review what it compiled

    What comes out are ordinary Synapse rules: WAF rules in the documented expression language, IDS signatures and firewall rules. The two below show the shape of compiled WAF rules: one for the routes the code serves, one for what a route accepts.

    Illustrative: the routes the code serves, action block
    http.request.path not in {"/", "/login", "/api/orders", "/api/orders/status", "/health"}
    Illustrative: what one route accepts, action block
    http.request.path == "/api/orders" and http.request.content_type != "application/json"
    DecisionIs every route the application serves in the surface?

    Yes Carry on.

    No A positive rule refuses what it does not know, so the missing route will return 403. Fix the surface before you enforce.

  4. 04

    Put your exceptions above the compiled rules

    Evaluation stops at the first matching rule. An allow you need, for a health checker or a partner's callback, goes above the compiled rules or it never runs.

    WAF rule, action allow, placed above the compiled rules
    ip.src in {192.0.2.0/24}
  5. 05

    Ship the rules with the code

    Microglia is wired into CI/CD, so the rules are compiled from the code that is being released, not from what the application looked like when someone last wrote a rule.

  6. 06

    Virtual-patch what the agents find

    When the agents find a flaw, they write the virtual patch: a rule for the request shape that reaches it, enforced until the fix ships. The virtual patching playbook covers what to do while it is in place.

Common mistakes

  1. Enforcing compiled rules before checking that every route the application serves is in the surface.
  2. Placing exceptions below the compiled rules: evaluation stops at the first match.
  3. Treating a virtual patch as the fix.

Escalate when

  • Requests to routes outside the surface that come from inside your network.
  • A flaw the agents found in a route that is already reachable from the internet.

Where this stops working

  • The rules are as current as the code they were compiled from: code that reaches production another way is not described by them.
  • Only traffic through the proxy is protected. Make the proxy the only way in.
Run it here

Send the request. Watch where it stops.

Edit the request or any rule and the pipeline runs again. The rules are real wirefilter expressions, evaluated the way the agent evaluates them; the traffic and model scores are samples. It all runs in your browser.

Try this Set http.request.path to /api/orders, a route the code serves, and the request goes through. Then set http.request.content_type to text/plain: that route only takes JSON.

The request

ingress · proxy mode

Every value is a rule field. Change one and the pipeline re-runs.

Connection
Source, resolved by the platform
Fingerprints, from Dendrite
HTTP, readable in proxy mode
Model scores, sample output from Cortex
Flow behaviour, per source
Payload, what Thalamus inspects
Result Refused with 403
ResultRefused with 403Proxy · WAF
  1. 01Capture and fingerprintDendrite · On the wireObserved

    Computed JA4, JA4T, JA4H for this connection. Capture only: Dendrite never blocks.

  2. 02Access rulesHillock · XDP hook, before routingPassed

    198.51.100.77 (NL, AS64501) is on no access list.

    From the threat feed: known-bad sourcesNo match
    Country, resolved to IP ranges on the platform sideNo match
  3. 03Firewall rulesHillock · TC hook, in the kernelNot used

    No firewall rules in this policy.

  4. 04Intrusion detectionThalamus · On the hostNot used

    No signatures loaded for this scenario.

  5. 05Behavioural modelsCortex · On the host CPUObserved

    Sample scores, 0 to 100: C2 2, scan 3, malicious flow 4. Nothing leaves the machine to be scored.

  6. 06Service graphHippocampus · On the hostNot used

    No workload identity on this flow.

  7. 07Smart firewall rulesAmygdala · Decided on the host, enforced in nftablesNot used

    No smart firewall rules in this policy.

  8. 08WAF rulesProxy · In the proxy, after decryptionRefused

    Refused with 403. The application never sees the request.

    Matched
    Not reached
  9. 09Content scanningProxy · ClamAV, before forwardingNot reached

    No WAF rule selected this request for scanning, so nothing was scanned.

Field names and operators follow the docs: WAF and Smart Firewall. A rule that names an unknown field does not load; a field the request does not carry never matches.

What lands in the event log
{
  "ts": "2026-11-17T09:41:07.212Z",
  "layer": "waf",
  "action": "block",
  "source": "waf",
  "rule_id": "w15",
  "src_ip": "198.51.100.77",
  "src_port": 54321,
  "dst_ip": "198.51.100.10",
  "dst_port": 443,
  "src_country": "NL",
  "fingerprints": {
    "ja4t": "64240_2-4-8-1-3_1460_10",
    "ja4": "t13d1516h2_8daaf6152771_02713d6af862"
  }
}

Shaped like the documented event schema; the timestamp, ports, rule ids and ban duration are illustrative.

Now on your own traffic.

A demo runs the same pipeline against real packets, with the engineers who built it.