Opened 10 years ago

Closed 9 years ago

#2220 closed enhancement (fixed)

RELAX NG grammar for HTTPS Everywhere rulesets

Reported by: cypherpunks Owned by: schoen
Priority: Low Milestone:
Component: HTTPS Everywhere/EFF-HTTPS Everywhere Version:
Severity: Keywords:
Cc: inkerman42@… Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Attached is a RELAX NG grammar for HTTPS Everywhere rulesets, in RELAX NG compact syntax (see http://www.relaxng.org/). I wrote it based on the documentation at https://www.eff.org/https-everywhere/rulesets and by looking at the existing rules (the rulesets web page isn't entirely up-to-date with respect to the syntax). You may find it useful for editing ruleset files in a RELAX NG-aware editor like Emacs' nxml-mode, and for validating rulesets with a tool like jing (https://code.google.com/p/jing-trang/).

I tried to use my grammar to validate all the rulesets in the git repository using jing, this gave me a few errors which I suspect are faults in those ruleset files rather than in my grammar:

$ find -name \*.xml -print0 | xargs -0 jing -c https-everywhere.rnc

pending-rules/IsoHunt.xml:5:76: error: value of attribute "to" is invalid; must be a string matching the regular expression "https://.*"
pending-rules/Three.xml:7:90: error: value of attribute "to" is invalid; must be a string matching the regular expression "https://.*"

Child Tickets

Attachments (1)

https-everywhere.rnc (2.9 KB) - added by cypherpunks 10 years ago.
RELAX NG grammar (compact syntax) for HTTPS Everywhere rulesets

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by cypherpunks

Attachment: https-everywhere.rnc added

RELAX NG grammar (compact syntax) for HTTPS Everywhere rulesets

comment:1 Changed 10 years ago by pde

Owner: changed from pde to schoen
Status: newassigned

comment:2 Changed 9 years ago by inkerman

Cc: inkerman42@… added

comment:3 Changed 9 years ago by schoen

Resolution: fixed
Status: assignedclosed

I wrote a version of this grammar back in the non-compact syntax (sorry, none of the non-Java tools I could find understand the compact syntax, and the syntax translator I found didn't work!), but the RELAX NG grammar idea is great and the validation results are extremely useful. Soon I'll make this a part of the trivial-validate script, once we're sure that all of our rules pass validation.

The new grammar can be checked with xmllint --relaxng or with xmlstarlet val -r, among other possibilities.

Note: See TracTickets for help on using tickets.