Code Monkey home page Code Monkey logo

hstspreload's Introduction

Logo Chromium

Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.

The project's web site is https://www.chromium.org.

To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.

Documentation in the source is rooted in docs/README.md.

Learn how to Get Around the Chromium Source Code Directory Structure.

For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.

If you found a bug, please file it at https://crbug.com/new.

hstspreload's People

Contributors

agl avatar bkhushi avatar bratell-at-opera avatar carlosjoan91 avatar dadrian avatar davidben avatar dependabot[bot] avatar devonobrien avatar ericlaw1979 avatar estark37 avatar jdeblasio avatar jianglai avatar lgarron avatar martijnc avatar nharper avatar tkabiawu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hstspreload's Issues

Expose HSTSHeader fields outside the package

Here's the writeup of my concern:

I have a struct with two boolean values (always present) and an integer (which may or may not be present). I'm currently using an extra boolean to track if the integer is valid:

type HSTSHeader struct {
preload bool
includeSubDomains bool
maxAgePresent bool
// maxAgeSeconds is valid iff maxAgePreset == true
maxAgeSeconds uint64
}

However, I'm worried about the default integer value of 0 because it indicates an important case that should be distinguished from "not present". Specifically, I'm worried that people won't check the maxAgePresent boolean and just read maxAgeSeconds.

Alternatives:

  1. Use JSON values, which have a concept of a missing key.
  2. Use a pointer.
  3. Make the struct into an interface, and maybe try to use a few encapsulation tricks to discourage using the struct directly (e.g. defining package-local custom type aliases that can't be used to read the values directly).
  4. Use some sort of Maybe/Optional/Nullable interface for just the integer. It seems that an idiomatic way to implement this is to use a boolean and a value, but making the top-level value in the struct a special type will hopefully prevent casual misuse.
  5. Use a "list" of integers that contains either zero or one value.

See https://github.com/chromium/hstspreload/blob/d537ac4e/header.go#L17 for more context.

These all feel really hacky compared to native "object" primitives in other languages. Any other options, or any reason one of my ideas is better than I think?๏ปฟ

Allow ECDSA certs by default.

The main reason we checked the ECDSA requirement was to prevent sites from causing an non-overridable error for Windows XP users. Since Chrome is officially dropping Windows XP support in two days, we should downgrade this to a warning or drop the check entirely.

Encoding variables

This is not a security issue, as the user input is already checked with parser.hostname, and on the server by looking for A-Z, 0-9, Hyphen, and Dot characters only.

But you should be encoding your variables, incase you start allowing UTF-8, and other characters.


With the JavaScript, use encodeURIComponent:

https://github.com/chromium/hstspreload/blob/master/hstspreload.appspot.com/page.html#L99

xhr.open("POST", "/submit/" + domain, true);

https://github.com/chromium/hstspreload/blob/master/hstspreload.appspot.com/page.html#L152

xhr.open("POST", "/clear/" + requestedDomain, true);

https://github.com/chromium/hstspreload/blob/master/hstspreload.appspot.com/page.html#L207

<a href=\"https://www.ssllabs.com/ssltest/analyze.html?d=" + requestedDomain + "\">

I'm not familiar with Go, but isn't there a way of returning JSON data without creating the string yourself? maybe with json.NewEncoder? As that should ensure the values are properly encoded.

https://github.com/chromium/hstspreload/blob/master/hstspreload.appspot.com/hstspreload.go#L136

fmt.Fprintf(w, `    { "name": "%s", "include_subdomains": true, "mode": "force-https" },`, key.StringID())

https://github.com/chromium/hstspreload/blob/master/hsts-review.go#L134

fmt.Printf("    { \"name\": %q, \"include_subdomains\": true, \"mode\": \"force-https\" },\n", result.name)

As an aside, it would be nice if this used a standard <form>, where the server responded with a HTML page without the need to use JavaScript :-)

And provide a <label> for the input, as that will help with a11y:

http://wave.webaim.org/report#/https://hstspreload.appspot.com/

Lint for modified Issues that are not used.

The following has no side effects:

 issues.AddError("error")

The correct way to modify issues is to assign the new value to it:

 issues = issues.AddError("error")

During development, I have occasionally written the former. Tests should help catch changes that are accidentally introduced, but it would be nice to catch modified Issues that are never used.

It would be nice to have an "unused result" warning (similar to "unused variable") at compile or test time.

I'mma look into go vet.

Commandline binary

This will allow developers to test conditions locally.

hstspreload --checkHeader "preload; max-age=20"
hstspreload --checkResponse localhost:8080
hstspreload --checkDomain example.com
hstspreload --submit example.com
hstspreload --status recently-submitted.com

If we enable submission via commandline, the process should require the same explicit user consent as the website (#3). Otherwise, it would be another footgun for preload advice.

End-to-end tests

In particular, testing checkDomain against a local test server.

favicon missing

per lgarron a favicon was requested. Double turnstiles are used to denote tautologies (something which is true), HSTS is used to denote that https must always be used. I combined the turnstile and a padlock for this logo.

(zip has svg source and converted ico)
hstsPreloadIcon.zip

Fold the HSTS "manual" review into hstspreload.appspot.com

From https://crbug.com/587957

agl@ and I actually use an automated script to do what used to be the manual review for HSTS preload list submissions. The code is Google-internal at the moment [1].

Since this review is run manually at irregular intervals, this results in:

  • A slower, uncertain feedback cycle on HSTS preload submissions.
  • Extra work for the preload list maintainer (currently me) due to manual emails regarding rejections.

I want to run this review step automatically for hstspreload.appspot.com submissions.
AppEngine can't do this, so this requires spinning up a GCE instance and integrating hsts-review.go into the AppEngine code.

[1] https://goto.google.com/hsts-review.go

Add a consent checkbox to the submission form

From https://crbug.com/593204

e.g.

[ ] I understand that preloading a domain through this form will require every subdomain of this site to serve a valid certificate (for that subdomain) in order to remain accessible in Chrome.

I would also like something to the effect of "I am either the owner of this site or have direct authorization form the owner of this site." but this is a silly barrier if the only real verification is the header.

Token spelling correction

Simple Levenshtein correction, e.g. Unknown token: includeDomains. Did you mean includeSubDomains?

Can also check for common tokens that are added by accident, e.g. always.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.