Giter Club home page Giter Club logo

hugo-mod-csp's Introduction

Hugo module to generate a server header

The module is in alpha stage and can only generate the file _header for Netlify. It contains a site wide CSP and a few other common security settings.

A content security policy doesn’t necessarily need a hugo module. We may well write one without it. But the syntax is complicated enough to expect typing errors and other mistakes which could undermine the result and the intended security. This module checks the syntax of all entries to prevent a faulty header.

Syntax source & check

  • The syntax for a content security policy (CSP) is documented here for example.

  • We can check our CSP as soon as it's attached to a website here

Goal

CSP is a second content-independent line of defense against attacks. The task is always the same: Advising the web-server to send a header with our specific restrictions of the possible interactions from and to our site.

Different output formats

There are different ways to accomplish this task and this module may be able to generate different formats in the future.

Validation

  • The syntax of all keys and special values gets checked against the official syntax elements. (nonce-* and sha-* are still missing)

  • URLs and pure schemes get parsed by Hugo’s urls.Parse, which is based on the standard Golang method.

Prerequisites

This module expects a CSP section in the Hugo project parameters.

Output

  • One output format is a _header file. An elegant way to generate the header without generating additional HTML. Netlify can process this file.

  • The second implementation should be a meta tag for the HTML header. This is less efficient, because we need additional HTML code. And a few rules don’t have any effect as meta tags. Meta tags have only one advantage: They work on all servers without access to the configuration of the web server.

Configuration syntax (TODO)

hugo-mod-csp's People

Contributors

bowman2001 avatar

Watchers

 avatar

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.