[HTTPS-Everywhere] Python interface for the rulesets?

Peter Eckersley pde at eff.org
Wed Jan 9 14:23:38 PST 2013


By the way, MB just encountered this bug in the JS ruleset implementation; you
probably didn't implement the same bug in https-everywhere-checker but just
in case:

https://gitweb.torproject.org/https-everywhere.git/commitdiff/6ca405d010062d2b2cb91b2024d4ebf7d405dee7


On Thu, Jan 03, 2013 at 04:30:50PM +0100, Ondrej Mikle wrote:
> On 12/26/2012 10:47 AM, Osama Khalid wrote:
> > Has anyone used HTTPSEverywhere rulesets in Python?  I am thinking
> > about writing a small script that can use the rulesets.  As far as I
> > know, JavaScript and Python regex libraries are pretty much
> > compatible, so it should not be too difficult, but it would be easier
> > to find something ready.
> 
> I wrote a ruleset matcher in python as a part of HTTPS Everywhere ruleset
> checker (https://github.com/hiviah/https-everywhere-checker). Python 're' module
> and JS regexps are very similar, but not identical, I had to use 'regex' module
> because of some limitations of 're' module.
> 
> The differences between 're' and JS regexps I remember:
> 
> 1) if there was a regexp like "^http://(www\.)?domain\.tld/" and the string to
> be matched didn't contain the optional 'www.' part, 're' module failed for some
> reason (or the capture groups had different numbering, not quite sure now)
> 
> 2) JS regexp seems to only support capture groups 0-9, i.e. a target like
> 'to="https://$101.org/"' would rewrite only the "$1" part. Whereas python's re
> and regex module would treat it as 101-st group. Thus the "$1" in substitution
> needed to be replaced with "\g<1>". See Rule:__init__() in
> https://github.com/hiviah/https-everywhere-checker/blob/master/rules.py
> 
> The algorithm for matching rules is a bit different than what HTTPS Everywhere
> uses, and could in theory support multiple wildcard '*' parts (at the expense of
> computational complexity). I think otherwise both algorithms should be
> functionally equivalent, at least for the rulesets that existed couple of months
> ago. But I didn't do any formal proof :-)
> 
> Ondrej
> 



> _______________________________________________
> HTTPS-everywhere mailing list
> HTTPS-everywhere at mail1.eff.org
> https://mail1.eff.org/mailman/listinfo/https-everywhere


-- 
Peter Eckersley                            pde at eff.org
Technology Projects Director      Tel  +1 415 436 9333 x131
Electronic Frontier Foundation    Fax  +1 415 436 9993




More information about the HTTPS-everywhere mailing list