The system-ui font

Imagine:

font-family: system-ui, sans-serif;

Enabled by default in Chrome 56, system-ui is a special font name, that tells Chrome to use the system font (be it Cantarell in Gnome, San Francisco in macOS, etc.)

But system-ui is something new, as far as I know available only in the latest versions of Blink based browsers. So what to do as of today? This is from Bootstrap 4:

font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

Safari and Firefox on Mac will recognize -apple-system and use the Mac system font, just as system-ui, but not standard. Then comes the standard system-ui, but only available in Chrome 56. Older versions of Chrome, on Mac only, will interpret the same with BlinkMacSystemFont. Now comes Segoe UI, unlike the first three this is a real font name, the one used in Windows since Windows Vista. Now comes: Roboto for Android, Helvetica Neue for some versions of macOS, and Arial for old Windows.

But, but, where is Gnome’s font, you insensitive clod?

font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Helvetica Neue", Arial, Helvetica, sans-serif;

Ah that looks better, just added Oxygen for KDE, Ubuntu for.. (I let you guess this one), Cantarell for Gnome, and Helvetica because… well I don’t know why.

If you want, you can still add Droid Sans for old Android, Fira Sans for Firefox OS,  and maybe Lucida Grande for some old versions of macOS. Okey, the list is long but you only have to type it once. You can also define the list using @font-face

Make your own list, decide which platforms you don’t care about, and use it as default in your projects. But don’t be insensitive and include Cantarell in the list!

Of course, if your site tries to sell something or to send a message, and if you care enough, then consider choosing a nice font (adjust letter spacing bla bla). To make it short, maybe something like:

font-family: "My nice font", system-ui, sans-serif;

Check Font Squirrel

HTTP Strict Transport Security (hsts)

Just learned about HSTS and started using it. First let me explain HSTS with my own words.

Scenario without hsts:
  1. The user types the domain name in the URL bar without the protocol, such as “example.com”, and the browser automatically adds the “http://” prefix. This first request is vulnerable to Man In The Middle (MITM) attacks.
  2. The server replies with a redirection to the secure “https://example.com”. From the rest of the interaction communication is secure.
  3. The next day the user types again “example.com” in the URL bar. The browser sends again an insecure HTTP request.
Scenario with hsts:
  1. The user types the domain name in the URL bar without the protocol, such as “example.com”, and the browser automatically adds the “http://” prefix. This first request is vulnerable to Man In The Middle (MITM) attacks.
  2. The server replies with a redirection to the secure “https://example.com”. From the rest of the interaction communication is secure. And, the server adds the response header:
    Strict-Transport-Security: max-age=31536000

    This response header instructs the browser to use HTTPS, and asks him to do so for the next 31.536.000 seconds (1 year).

  3. The next day, the user types again “example.com” in the URL bar. But, the browser remembers, and it uses HTTPS instead of HTTP. And will do so even if the user includes explicitly the prefix “http://example.com”.
Closing

So with HSTS the user will only be vulnerable the first time, and not every time she starts a session.

After learning this I have added support for HSTS to my Ansible role for Django deployment. See commit, and I encourage you to start using HSTS too.

Links:

Have a nice secure day!

 

 

Pygit2 0.25.0 released, upgrades to libgit2 0.25

This release requires the recently released libgit2 0.25.0; see the full list of changes.

Thanks to Carlos Martín Nieto, Szucs Krisztian and Guillermo Pérez.

Resources:

Enjoy!

Pygit2 0.24.2 improves support for Windows

Now unit tests pass on Windows. Integration with AppVeyor. Wheels available on Pypi. See the full list of changes.

Thanks to Matthias Bartelmeß, Anatoly Techtonik, Robert Hölzl and Carlos Martín Nieto.

Resources:

Enjoy!

Pygit2 0.22.0 released, updates to libgit2 0.22.0

This release requires the recently released libgit2 0.22.0; other changes include an improved support for remotes. See the full list of changes.

Thanks to Carlos Martín Nieto, Matthew Duggan, Greg Fitzgerald, Kevin Kin-Foo, Richard Möhn, Lukas Fleischer, Peter Dave Hello and Philippe Ombredanne.

Resources:

Enjoy!

Pygit2 0.21.2 fixes regression, use it with libgit2 0.21.1

This release fixes a regression introduced in version 0.21.0, with the index and Python 2. See the full list of changes.

Thanks to Carlos Martín Nieto and Arno van Lumig.

Otherwise most important is the maintenance release of libgit2 v0.21.1, which among other corrections fixes a critical bug which may lead to data corruption. See the full list of libgit2 v021.1 changes.

So upgrading to libgit2 0.21.1 and pygit2 0.21.2 is highly recommended.

Resources:

Enjoy!

Pygit2 0.21.1 and a new skin for the documentation

Changes:

  • Documentation: use the read-the-docs theme
  • New Repository.state_cleanup()
  • New Index.conflicts
  • New checkout option to define the target directory
  • And more…

Thanks to Carlos Martín Nieto, Vlad Temian and Jasper Lievisse Adriaanse.

Release partially sponsored by Bors LTD

Resources:

Enjoy!

 

Pygit2 0.21.0 uses cffi

Changes:

  • Now using cffi
  • Upgraded to libgit2 latest and greatest v0.21.0
  • And much more…

Thanks to Carlos Martín Nieto, Michael Jones, Ian P. McCullough, Jack O’Connor, Thomas Kluyver, Daniel Bruce and Jun Omae.

Release partially sponsored by Bors LTD

Resources:

Enjoy!

pygit2 0.20.3 introduces support for credentials

Changes:

  • Introduce support for credentials
  • Several memory issues fixed
  • Compatibility fixes for Python 3.3, PyPy3 and Visual Studio
  • And much more…

Thanks to Carlos Martín Nieto, Leonardo Rhodes, Devaev Maxim, Erik Meusel, Thomas Kluyver and earl.

Resources:

Enjoy!