edge.* filter fields for the validator's client class (#481) - #69
Merged
Conversation
…481)
Matching the edge tag already worked on a stock install: collect_request_headers()
forwards the whole $_SERVER['HTTP_*'] set into the rule context, so
req.header("x-wd-class") == "script" has always been a valid expression. Nobody
knew, because nothing said so — the header was documented as "watch it in your
logs" and the Fields line in the settings screen never mentioned it.
So this is discoverability, not capability: edge.class, edge.clearance,
edge.present, plus edge.verified / edge.crawler / edge.script / edge.browser. One
spelling instead of one per site owner, and it survives us renaming a header. The
raw-header form still works and has a test pinning that.
ABSENCE IS NOT A CLASS
A rule using this decides whether to serve someone less, so:
- edge.class is null when the validator did not classify, making a comparison
against it false rather than accidentally true
- a value outside the closed set is DROPPED — outside it means version skew or
something that is not our worker
- edge.present false means "no information", not "human", and the settings screen
says so in those words
Derived from the headers already on RuleContext rather than added as a constructor
argument, so a released plugin's RuleContext signature does not change under
anyone.
THE CACHE CAVEAT IS IN THE UI, NOT ONLY THE DOCS
The settings screen now states that these fields are safe for blocking,
throttling, logging and metering, and that serving different page CONTENT on a
cacheable URL is not: Cloudflare's cache key ignores this header below Enterprise,
so the first cached variant is served to everyone including Googlebot, and on a
cache hit the site never runs at all. A site owner reading the field list is
exactly the person about to make that mistake.
No version bump — releasing is a separate decision, and goes through
bin/release-all.sh.
Refs WebDecoy/app#481, WebDecoy/app#477
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of WebDecoy/app#481. Pairs with WebDecoy/app (worker emits
x-wd-class) and WebDecoy/node#12 (Node SDK reads it).This is discoverability, not new capability
Matching the edge tag already worked on a stock install.
collect_request_headers()forwards the whole$_SERVER['HTTP_*']set into the rule context, so this has always been a valid expression:Nobody knew, because nothing said so. The header was documented as "watch it in your logs" and the Fields line on the settings screen never mentioned it.
Now:
edge.class,edge.clearance,edge.present, plus shorthandsedge.verified/edge.crawler/edge.script/edge.browser. One spelling instead of one per site owner, and it survives us renaming a header. The raw-header form still works, with a test pinning that so nobody has to migrate.Absence is not a class
A rule using this decides whether to serve someone less, so:
edge.classisnullwhen the validator did not classify, making a comparison against it false rather than accidentally trueedge.presentfalse means "no information", not "human", and the settings screen says so in those wordsDerived from the headers already on
RuleContextrather than added as a constructor argument, so a released plugin'sRuleContextsignature does not change under anyone.The cache caveat is in the UI, not only the docs
The settings screen now states that these fields are safe for blocking, throttling, logging and metering — and that serving different page content on a cacheable URL is not:
A site owner reading the field list is exactly the person about to make that mistake.
Testing
php tests/run.php— 84 passed, 0 failed, including four new cases: the fields resolving, absence yielding false for every one of them, an unrecognised value being dropped, and case/whitespace tolerance.Not in this PR
No version bump. Releasing is a separate decision and goes through
bin/release-all.sh.