2017 © Pedro Peláez
 

library nonce-generator

Content Security Policy nonce generator

image

spaze/nonce-generator

Content Security Policy nonce generator

  • Wednesday, December 20, 2017
  • by spaze
  • Repository
  • 2 Watchers
  • 4 Stars
  • 616 Installations
  • PHP
  • 0 Dependents
  • 2 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

Nonce Generator

PHP Tests, (*1)

This generates random nonces for Content Security Policy nonce attributes. These nonces work with CSP3 strict-dynamic which aims to make Content Security Policy simpler to deploy for existing applications. This package is intended to be used with Nette Framework, spaze/csp-config and spaze/sri-macros., (*2)

Usage

This is a plug and play generator., (*3)

If installed, \Spaze\ContentSecurityPolicy\Config::addDirective() from spaze/csp-config will automatically add nonce-... attribute to configured directives, and Latte macros {script ...} and {stylesheet ...} from spaze/sri-macros will add nonce="..." attribute to script and style attributes respectively. Also n:nonce shortcut will use the same generated value., (*4)

Installation

With Composer:, (*5)

composer require spaze/nonce-generator

Add the extension to your configuration:, (*6)

extensions:
    nonceGenerator: Spaze\NonceGenerator\Bridges\Nette\GeneratorExtension

Requirements

  • PHP 8.2 or newer
  • Latte 3.0 or newer
  • Nette Application 3.1 or newer
  • Nette DI 3.0 or newer

API

createNonce(): Nonce

Generates and returns a Nonce object. Use Nonce::getValue() to get the generated nonce., (*7)

The Versions

20/12 2017

dev-master

9999999-dev

Content Security Policy nonce generator

  Sources   Download

MIT

The Requires

  • php ~7.0

 

The Development Requires

11/11 2016

v1.0.0

1.0.0.0

Content Security Policy nonce generator

  Sources   Download

MIT

The Development Requires