You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
// Comments are allowed, and will be stripped before combining the rulesets into a ruleset library.{"name": "0bin.net",// "platform" and "default_off" are no longer supported. Use problematic targets instead./** * Problematic targets are also tested. If a problematic target no longer has the specified * error, Travis test fails. * * Problematic targets may be enabled by the user, e.g. mixedcontent or cacert ones. * * Problematic targets are copied into the ruleset library depending on the reason. * * Targets may have "rules" property for rules specific to this target. If a target has "rules" * property, global rules are ignored. */"targets": {"0bin.net": {"rules": [{"from": "^/testURL$","to": "https://0bin.net/testURL4","tests": ["http://0bin.net/testURL"]},{"forceHTTPS": true,"exclusions": [{"pattern": "^/testURL2$","tests": ["http://0bin.net/testURL2"]}]}]},"www.0bin.net": {"rules": [{"from": "^/","to": "https://0bin.net/"}]},"gay.0bin.net": {"problems": ["redirect-loop"]}},/** * "secureCookies" may be an array of objects having "host" and "name" properties or may be true, * which will secure all cookies. */"secureCookies": true,/** * "rules" contain the rules which are applied if a target doesn't have its own "rules" property. * Rules should always be associated with a target if possible, unless most targets have the same * rules. */"rules": [/** * A rule should have "from" and "to" properties. * * A rule may have "tests" property for tests specific to this rule. It will not be copied * into the ruleset library. * * A rule may have "exclusions" property for exclusions specific to this rule. * * "rules" may be omitted, in this case it is assumed to be ["forceHTTPS"]. */"force HTTPS"],/* * Named rules allow to easily apply one rule to multiple targets. "forceHTTPS" is a built-in named * rule. */"namedRules": {// This rule is identical to the built-in "forceHTTPS" rule."force HTTPS": {"from": "^http:","to": "https:"}},/** * An exclusion may be either a string or an object having "pattern" and "tests" properties. * * Exclusions should always be associated with a rule if possible. */"exclusions": [],/** * "tests" contains tests that are global to the ruleset. Tests should always be associated with * a rule or an exclusion if possible. * * This property will not be copied into the ruleset library. */"tests": ["http://0bin.net/testURL3"]}
It is recommended for rulesets to be hierarchical, only containing targets at root and having rules, exclusions and tests under each target.
Activity
ghost changed the title [-]Discussion about JSON rulesets in the repository.[/-][+]Discussion about new ruleset format.[/+]on Sep 18, 2017
I would also allow nesting rules under targets so that you could match only path part of URL and avoid duplication of hostnames in regexp for 90% of cases, so that example above would become something like:
Note that it still allows defining rules global to the ruleset, but it won't be needed for most cases and such change would allow better refinement optimisations by the rewriter (as it needs to check fewer regexps when it already found the host).
@koops76 You still have host duplication. Avoiding it is one of main benefits of nesting regexps under host target (you save memory, don't need to do extra matching etc.).
url.replace(/^\//, 'https://0bin.net/') will work just fine, but for nested rules, as I said, only path part of URL should be passed.
It won't. As I said, only path part of the URL is passed to nested rules in that scheme (since you already know the host you're matching) so for http://0bin.net/x?y=1 you are just taking result of '/x?y=1'.replace(/^\//, 'https://0bin.net/') and using it as a final URL. No need to overcomplicate things :)
TL;DR - if rule wants to match entire URL, including host - it should be defined globally in ruleset JSON, if it already applies only to specific host and cares only about path part of the URL, it can be nested under corresponding target.
See also #3999.
JSON is even worse to write than XML, especially for simple rule sets. YML would be easy, but not for complex ruleset. Maintain two different formats is also bad, so I think that's why we still use XML.
I would love to see such simple keywords like forceHTTPS and secureCookies.
"platform" and "default_off" are no longer supported. Use problematic targets instead.
Problematic targets are also tested. If a problematic target no longer has the specified error, Travis test fails.
How do exclusions and test urls work together with problematic targets? How does this work with wildcards?
I'm a bit skeptic that we can maintain all problematic targets.
Activity
[-]Discussion about JSON rulesets in the repository.[/-][+]Discussion about new ruleset format.[/+]RReverser commentedon Sep 18, 2017
I would also allow nesting
rulesundertargetsso that you could match only path part of URL and avoid duplication of hostnames in regexp for 90% of cases, so that example above would become something like:{ "name": "0bin.net", "targets": { "0bin.net": { "tests": [ "/testURL", "/testURL3" ], "exclusions": [ { "pattern": "^/testURL2$", "tests": [ "/testURL2" ] } ] }, "www.0bin.net": { "rules": { "from": "^/", "to": "https://0bin.net/" } }, "gay.0bin.net": { "problems": [ "https2http" ] } }, "secureCookies": true, "rules": [{ "forceHTTPS": true }] }Note that it still allows defining
rulesglobal to the ruleset, but it won't be needed for most cases and such change would allow better refinement optimisations by the rewriter (as it needs to check fewer regexps when it already found the host).RReverser commentedon Sep 18, 2017
@koops76
Not directly, but it's easy to fix.
I'd suggest
nullor empty object.RReverser commentedon Sep 18, 2017
@koops76 You still have host duplication. Avoiding it is one of main benefits of nesting regexps under host target (you save memory, don't need to do extra matching etc.).
url.replace(/^\//, 'https://0bin.net/')will work just fine, but for nested rules, as I said, only path part of URL should be passed.RReverser commentedon Sep 18, 2017
It won't. As I said, only path part of the URL is passed to nested rules in that scheme (since you already know the host you're matching) so for
http://0bin.net/x?y=1you are just taking result of'/x?y=1'.replace(/^\//, 'https://0bin.net/')and using it as a final URL. No need to overcomplicate things :)RReverser commentedon Sep 18, 2017
TL;DR - if rule wants to match entire URL, including host - it should be defined globally in ruleset JSON, if it already applies only to specific host and cares only about path part of the URL, it can be nested under corresponding target.
J0WI commentedon Sep 18, 2017
See also #3999.
JSON is even worse to write than XML, especially for simple rule sets. YML would be easy, but not for complex ruleset. Maintain two different formats is also bad, so I think that's why we still use XML.
J0WI commentedon Sep 18, 2017
I would love to see such simple keywords like
forceHTTPSandsecureCookies.How do exclusions and test urls work together with problematic targets? How does this work with wildcards?
I'm a bit skeptic that we can maintain all problematic targets.