HarperFast / HarperFast/harper-pro

Region- and tag-scoped WAF rules are armed on no node by default, silently, while list_waf_rules reports them enabled

Open
#829 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3
Forks
0
Avg merge
1d 21h
Merged PRs (30d)
80

Description

`waf/waf.ts` builds `nodeIdentity` from `waf.region` and `waf.nodeTags`, and `static/defaultConfig.yaml:96` is literally `waf: {}` — neither key is set by default.

`isArmedOnNode` in `waf/matcher.ts` requires the node to satisfy every present selector:

```
if (activation.regions != null && (identity.region == null || !activation.regions.includes(identity.region))) return false;
```

So on a default install, any rule carrying `activation.regions` or `activation.tags` is armed on **zero** nodes. The rule is stored, `list_waf_rules` reports it as enabled, and `compileRules` drops it on the path that is documented as "compiled out silently — it's simply not-for-this-node, so it is neither invalid nor unsupported here". It appears in no invalid count, no unsupported count, and no log line.

That silence is what makes this worse than it first looks: an operator scoping a block rule to a region gets a rule that exists, reads as enabled, and protects nothing, with nothing anywhere reporting the gap.

**Suggested fix, in rough priority order:**

1. Report activation-gated rules in the compile summary as a third category (armed-elsewhere), so the count is visible per node.
2. Have `list_waf_rules` return armed/not-armed for the node answering the operation.
3. Decide what an unset `waf.region` should mean. Treating "no region configured" as "matches any region selector" trades a silent no-op for a silent over-match, so the reporting above probably has to land first either way.

Found by cross-model review while reviewing an unrelated change; not customer-reported. The WAF is unreleased — `main` and `v5.3.0-alpha.1` only.

Contributor guide

Open the contributing guide

Research direction

Start with waf/waf.ts, waf/matcher.ts, and static/defaultConfig.yaml:96, then trace compileRules and list_waf_rules to understand how activation selectors affect reporting. Confirm the default configuration reproduces the silent no-node behavior; done means activation-gated rules are visibly distinguished from invalid and unsupported rules, with their armed status reported for the responding node.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.