Skip to content

Commit

Permalink
Merge branch 'master' into feature/none-override
Browse files Browse the repository at this point in the history
  • Loading branch information
Rias authored Mar 3, 2020
2 parents f4a6ca6 + dcbd4ac commit 6e16736
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 61 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: https://spatie.be/open-source/support-us
48 changes: 48 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: run-tests

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [7.2, 7.3, 7.4]
laravel: [5.8.*, 6.*, 7.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 7.*
testbench: 5.*
- laravel: 6.*
testbench: 4.*
- laravel: 5.8.*
testbench: 3.8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Set content security policy headers in a Laravel app

[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-csp.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-csp)
[![Build Status](https://img.shields.io/travis/spatie/laravel-csp/master.svg?style=flat-square)](https://travis-ci.org/spatie/laravel-csp)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/spatie/laravel-csp/run-tests?label=tests)
[![StyleCI](https://styleci.io/repos/119958264/shield?branch=master)](https://styleci.io/repos/119958264)
[![Quality Score](https://img.shields.io/scrutinizer/g/spatie/laravel-csp.svg?style=flat-square)](https://scrutinizer-ci.com/g/spatie/laravel-csp)
[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-csp.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-csp)
Expand All @@ -17,6 +17,13 @@ This readme does not aim to fully explain all the possible usages of CSP and it'
If you're an audio visual learner you should check out this video on how to use this package.
https://www.laraning.com/videos/spatie-csp-content-security-policy

## Support us

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).


## Installation

You can install the package via composer:
Expand Down Expand Up @@ -293,27 +300,12 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

## Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

We publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).

## Credits

- [Freek Van der Herten](https://github.com/freekmurze)
- [Thomas Verhelst](https://github.com/TVke)
- [All Contributors](../../contributors)

## Support us

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/spatie).
All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
"role": "Developer"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^7.2",
"illuminate/http": "~5.8.0|^6.0",
"illuminate/support": "~5.8.0|^6.0"
"illuminate/http": "~5.8.0|^6.0|^7.0",
"illuminate/support": "~5.8.0|^6.0|^7.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "~3.8.0|^4.0",
"orchestra/testbench": "~3.8.0|^4.0|^5.0",
"phpunit/phpunit": "^8.0"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/CspServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Spatie\Csp;

use Spatie\Csp\Nonce\NonceGenerator;
use Illuminate\Support\ServiceProvider;
use Spatie\Csp\Nonce\NonceGenerator;

class CspServiceProvider extends ServiceProvider
{
Expand Down
2 changes: 1 addition & 1 deletion src/Policies/Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Spatie\Csp\Policies;

use Spatie\Csp\Keyword;
use Spatie\Csp\Directive;
use Spatie\Csp\Keyword;

class Basic extends Policy
{
Expand Down
18 changes: 9 additions & 9 deletions src/Policies/Policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Spatie\Csp\Policies;

use ReflectionClass;
use Spatie\Csp\Value;
use Spatie\Csp\Keyword;
use Spatie\Csp\Directive;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Spatie\Csp\Exceptions\InvalidValueSet;
use ReflectionClass;
use Spatie\Csp\Directive;
use Spatie\Csp\Exceptions\InvalidDirective;
use Spatie\Csp\Exceptions\InvalidValueSet;
use Spatie\Csp\Keyword;
use Spatie\Csp\Value;
use Symfony\Component\HttpFoundation\Response;

abstract class Policy
Expand Down Expand Up @@ -140,9 +140,9 @@ protected function guardAgainstInvalidValues(array $values)
protected function isHash(string $value): bool
{
$acceptableHashingAlgorithms = [
'sha256-',
'sha384-',
'sha512-',
'sha256-',
'sha384-',
'sha512-',
];

return Str::startsWith($value, $acceptableHashingAlgorithms);
Expand Down
2 changes: 1 addition & 1 deletion src/PolicyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Spatie\Csp;

use Spatie\Csp\Policies\Policy;
use Spatie\Csp\Exceptions\InvalidCspPolicy;
use Spatie\Csp\Policies\Policy;

class PolicyFactory
{
Expand Down
18 changes: 9 additions & 9 deletions tests/AddCspHeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

namespace Spatie\Csp\Tests;

use Spatie\Csp\Value;
use Spatie\Csp\Scheme;
use Spatie\Csp\Keyword;
use Spatie\Csp\Directive;
use Spatie\Csp\AddCspHeaders;
use Spatie\Csp\Policies\Basic;
use Spatie\Csp\Policies\Policy;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Support\Facades\Route;
use Spatie\Csp\Exceptions\InvalidValueSet;
use Spatie\Csp\AddCspHeaders;
use Spatie\Csp\Directive;
use Spatie\Csp\Exceptions\InvalidCspPolicy;
use Spatie\Csp\Exceptions\InvalidValueSet;
use Spatie\Csp\Keyword;
use Spatie\Csp\Policies\Basic;
use Spatie\Csp\Policies\Policy;
use Spatie\Csp\Scheme;
use Spatie\Csp\Value;
use Symfony\Component\HttpFoundation\HeaderBag;

class GlobalMiddlewareTest extends TestCase
class AddCspHeadersTest extends TestCase
{
public function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Spatie\Csp\Tests;

use Spatie\Csp\CspServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;
use Spatie\Csp\CspServiceProvider;

abstract class TestCase extends Orchestra
{
Expand Down

0 comments on commit 6e16736

Please sign in to comment.