Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Run securecookie normalization script #11870

Closed

Description

@Hainish Please run this script: https://gist.github.com/koops76/14db6c6c1250eadc98644cff51e7add7.

I'm not making this a pull request because it changes 5354 files. Travis would probably explode. 😁

Please note that if ruleset whitelist cleanup is not run before running this script, it will throw errors on SHA256 mismatches.

After the script is run, merge #11872.

Activity

  1. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    @koops76 AFAIK

    <securecookie host=".+" name=".+" />
                       ^         ^
         possibly some spaces here (some badly formated ones)
                                     ^
          this space does not necessarily exist, e.g. \s* should be better 
    

    FYI, here is a sample regex used by hsts-prune for your reference. e.g

    <securecookie\s+host=\s*['"]\^?\.[*+]?['"]\s+name=\s*['"]\^?\.[*+]?['"]\s*/>

    And I recommend using a separate regex for each orders of name and host. It is much easier to read.

    Not really, e.g. ^\w does not match .example.com but .+ does. Also, rules.js#L57 does not include ^\w.

  2. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    @koops76 please also note the spaces before the quote and consider splitting the for each orders of name and host. thanks!!

  3. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    exactly. you can insert \s* right before the opening quotes.

  4. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    ok. A minor issues, the regex you use might rewrite commented securecookie as well. do you mind if I fix that as well? e.g.

    <!-- <securecookie ... /> -->
  5. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    @koops76 please have a look

    Source

    P.S. I seldom do nodejs but I guess this will work. (at least the regex 😄 )

  6. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    Just updated to make sure host always go before name.

  7. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    Thing like SecureCookie, Host, NAME should fails rules-test. The same hold true if securecookie has double host or name as specified in https://github.com/EFForg/https-everywhere/blob/master/utils/relaxng.xml#L49

    @koops76 modified for simplicity. thanks!

  8. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    @koops76 <securecookie host=".+" name=".+" /> are matched by the 1st regular expression, but it won't be replaced (the replacement does not change anything). You may permute the combination of ., .+ and .* to exclude (.+, .+). But they are just the same IMHO.

    btw, from which directory should I run your script?

  9. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    @koops76 Would you modify your script on GIST for Hainish to run it later?

  10. cschanaj commented on Aug 14, 2017

    @cschanaj
    Collaborator

    @koops76 not the same as https://gist.github.com/cschanaj/eb0de61c00389cfccb93cd78381a7b8e? the leading \n([ \t]*) and \s*?\n avoid commented securecookie to be rewritten, you shouldn't remove that.

    Besides, https://gist.github.com/koops76/14db6c6c1250eadc98644cff51e7add7#file-normalize-securecookie-js-L21 match host="".

    If possible, please replace them with the ones I proposed.

  11. cschanaj commented on Aug 15, 2017

    @cschanaj
    Collaborator

    @koops76 since you've said that you will be modifying the script, IMHO you can rewrite the files in-place. This will avoid unnecessary workload and possible human errors in the operations.

    Besides, it is also fine not to modify the whitelist with your script, since Hanish will have to whitelist the files anyway. A bonus of this is that you can reduce the program to a sed script. And we will have less false-listing in the whitelist. (optional)

  12. cschanaj commented on Aug 15, 2017

    @cschanaj
    Collaborator

    @koops76 I just think that this change is a cosmetic one (related to #10378), so minimal works should be done on making a script. Please feel free to continue your work on the script in your preferred way.

    normsc.sed is a sed script I have made and it seems that only 200+ files need whitelisting from rules-test, see list-failed-rules-test.txt. (Since I have already made the script, I prefer to leave it here AS-IS).

  13. gloomy-ghost commented on Aug 26, 2017

    @gloomy-ghost
    Collaborator

    I created a similar PR before, see #7892

  14. ghost closed this as completedon Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions