Giter VIP home page Giter VIP logo

austinheap / laravel-security-txt Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 0.0 920 KB

A package for serving `security.txt` in Laravel 5.5+, based on configuration settings. https://securitytext.org/

Home Page: https://packagist.org/packages/austinheap/laravel-security-txt

License: MIT License

PHP 100.00%
laravel laravel5 laravel55 laravel-5-package security security-txt composer composer-package php php7

laravel-security-txt's Introduction

Laravel 5.5+ security.txt Package

laravel-security-txt banner from the documentation

License Current Release Total Downloads Build Status Dependency Status Scrutinizer CI StyleCI Maintainability Test Coverage SensioLabs

A package for serving security.txt in Laravel 5.5+, based on configuration settings.

The purpose of this project is to create a set-it-and-forget-it package that can be installed without much effort to get a Laravel project compliant with the current security.txt spec. It is therefore highly opinionated but built for configuration.

When enabled, it allows access to all clients and serves up the security.txt. Otherwise, it operates almost identically to Laravel's default configuration, denying access to all clients.

security.txt is a draft "standard" which allows websites to define security policies. This "standard" sets clear guidelines for security researchers on how to report security issues, and allows bug bounty programs to define a scope. Security.txt is the equivalent of robots.txt, but for security issues.

There is documentation for laravel-security-txt online, the source of which is in the docs/ directory. The most logical place to start are the docs for the SecurityTxt class.

Table of Contents

Installation

Step 1: Composer

Via Composer command line:

$ composer require austinheap/laravel-security-txt

Or add the package to your composer.json:

{
    "require": {
        "austinheap/laravel-security-txt": "0.3.*"
    }
}

Step 2: Remove any existing security.txt

Laravel doesn't ship with a default security.txt file. If you have added one, it needs to be removed for the configured route to work.

$ rm public/.well-known/security.txt

Step 3: Enable the package (Optional)

This package implements Laravel 5.5's auto-discovery feature. After you install it the package provider and facade are added automatically.

If you would like to declare the provider and/or alias explicitly, then add the service provider to your config/app.php:

Add the service provider to your config/app.php:

'providers' => [
    //
    AustinHeap\Security\Txt\SecurityTxtServiceProvider::class,
];

And then add the alias to your config/app.php:

'aliases' => [
    //
    'SecurityTxt' => AustinHeap\Security\Txt\SecurityTxtFacade::class,
];

Step 4: Configure the package

Publish the package config file:

$ php artisan vendor:publish --provider="AustinHeap\Security\Txt\SecurityTxtServiceProvider"

You may now allow clients via security.txt by editing the config/security-txt.php file, opening up the route to the public:

return [
    'enabled' => env('SECURITY_TXT_ENABLED', true),
];

Or simply setting the the SECURITY_TXT_ENABLED environment variable to true, via the Laravel .env file or hosting environment.

SECURITY_TXT_ENABLED=true

Full .env Example

After installing the package with composer, simply add the following to your .env file:

SECURITY_TXT_ENABLED=true
SECURITY_TXT_CACHE=true
[email protected]
SECURITY_TXT_ENCRYPTION=https://your-site.com/pgp.key
SECURITY_TXT_DISCLOSURE=full
SECURITY_TXT_ACKNOWLEDGEMENT=https://your-site.com/security-champions

Now point your browser to http://your-site.com/.well-known/security.txt and you should see:

# Our security address
Contact: [email protected]

# Our PGP key
Encryption: http://some.url/pgp.key

# Our disclosure policy
Disclosure: Full

# Our public acknowledgement
Acknowledgement: http://some.url/acks

#
# Generated by "laravel-security-txt" v0.4.0 (https://github.com/austinheap/laravel-security-txt/releases/tag/v0.4.0)
# using "php-security-txt" v0.4.0 (https://github.com/austinheap/php-security-txt/releases/tag/v0.4.0)
# in 0.041008 seconds on 2017-11-22 20:31:25.
#
# Cache is enabled with key "cache:AustinHeap\Security\Txt\SecurityTxt".
#

Unit Tests

This package has aggressive unit tests built with the wonderful orchestral/testbench package which is built on top of PHPUnit.

There are code coverage reports for laravel-security-txt available online.

References

Credits

This is a fork of InfusionWeb/laravel-robots-route, which was a fork of ellisthedev/laravel-5-robots, which was a fork of jayhealey/Robots, which was based on earlier work.

License

The MIT License (MIT). Please see License File for more information.

laravel-security-txt's People

Contributors

austinheap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

laravel-security-txt's Issues

Error on WP 4.9.4

On Wordpress 4.9.4, show me this error

Warning: Unsupported declare 'strict_types' in /.../wp-content/plugins/wp-security-txt/lib/src/Directives/Acknowledgement.php on line 10

Parse error: syntax error, unexpected ':', expecting ';' or '{' in /.../wp-content/plugins/wp-security-txt/lib/src/Directives/Acknowledgement.php on line 41

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.