Free, open-source add-on for Optimizely CMS

Stott Security

Manage Content Security Policy, CORS, Permissions Policy, response headers and security.txt from inside Optimizely CMS, without a code deployment.

dotnet add package Stott.Security.Optimizely

Get started View on GitHub Using SaaS CMS?

Stott Security CSP Sources tab showing the source and directive grid
The Content Security Policy sources tab in version 7.
nuget.org downloads
View on NuGet
Optimizely feed downloads
View on the Optimizely feed
Latest version
View on NuGet
Licence
MIT

About the add-on

Stott Security is an Add-on for Optimizely CMS that allows a CMS Administrator to manage security headers that are used to protect the CMS website without requiring a code deployment. This Add-on is free to use and is covered by an MIT License. If you wish to support the ongoing development of this Add-on, then please feel free to buy me a coffee.

Choose your edition

Optimizely Connect Platform app

SaaS CMS

Early access

A complete rebuild as an OCP app, shown inside the CMS using CMS UI Extensions. Audit history and per-page policies are not available on SaaS.

Key features

01

Global, Application & Host Configuration

  • Multiple Contexts: Configure headers globally, by application (site in CMS 12) and by individual host, using the built-in context switcher.
  • Layered Content Security Policy: CSP sources merge across four levels — Global, Application, Host and Page — so you can enforce strong defaults while refining policies for specific journeys.
  • Override Model: Permissions Policy and Response Headers use an override approach where more specific levels replace broader ones.
  • Separate Front-End & CMS Policies: Apply tight, nonce-based policies to your delivery hosts while granting the CMS editor host the permissions it needs.
Hierarchical inheritance of Content Security Policy sources from Global, Application, Host and Page levels
CSP sources merge across Global, Application, Host and Page level.
02

Content Security Policy

  • User Friendly Interface: Manage individual domains and what permissions you grant them on a domain by domain basis.
  • Searchable: Search by domain or filter by permission to fully understand what permissions have been granted.
  • Reporting: Supporting internal and external reporting endpoints, understand violations either directly within the add-on or in a third party service.
  • Violation Handling: Add blocked domains straight into your CSP straight from the violation report screen
  • Agency Allow List: Automatically update your Content Security Policies across multiple instances based on a centrally managed allow list.
  • Supports Nonce: Supports nonce attributes on script and style tags. Automatically applied for traditional CMS pages, must be applied in UI code for Headless solutions.
  • Layered by Scope: Define sources globally and refine them by application, host and page, merged into a single policy for the page being served.
A screenshot of the content security policy Nonce source modal
Adding a nonce source to the Content Security Policy.
03

Response Headers

  • User Friendly Interface: Manage all of your classic response headers in a nice easy to manage interface.
  • Scoped Configuration: Configure globally and override at application or host level.
  • Custom Headers: Supports adding or removing of any configured header name.

Specialized Security Headers:

  • Cross-Origin-Embedder-Policy
  • Cross-Origin-Opener-Policy
  • Cross-Origin-Resource-Policy
  • X-Content-Type-Options
  • X-XSS-Protection
  • X-Frame-Options
  • Referrer-Policy
  • Strict-Transport-Security (HSTS)
Example of the Response Headers being overridden for a specific application
Overriding response headers for a specific application.

Also included

Permission Policy

  • User Friendly Interface: Manage individual directives in an easy-to-use interface.
  • Searchable: Search by domain or filter by permission to fully understand what permissions have been granted.
  • Scoped Configuration: Configure globally and override at application or host level.

Cross Origin Resource Sharing (CORS)

  • CORS Support: Manage the domains that are allows to make CORS requests into your website.
  • Native: Hooks into the Microsoft’s built in .NET CORS middleware to protect your CMS with minimal effort.
  • Optimizely Headers: Quickly add known Optimizely headers for the Content Delivery and Definition APIs at the click of a button.

Security.txt

  • User Friendly Interface: Manage your security.txt files in an easy to interface that is familiar to users of Stott Robots Handler.
  • Multi-Domain / Host Support: Write a single security.txt file for your entire CMS, or create them by application (site in CMS 12) or even specific host.

Additional Features

  • Previews: A preview screen that will show you your complete collection of compiled headers.
  • Headless Support: APIs can be consumed by your headless solution to serve headers using middleware in well known headless providers.
  • Import/Export: Export all your settings to back them up before making sweeping changes and import them to roll them back to a known state.
  • Fully Audited: All changes made within the add-on are audited complete with field value changes.
  • Audit Reporting: Review all changes made to settings by user, date or record type.
  • Validation: Client side and server side validation with visual feedback to prevent configuration errors

Get started

Read the full guide
  1. Install the package

    # .NET CLI
    dotnet add package Stott.Security.Optimizely
    # Package Manager Console
    Install-Package Stott.Security.Optimizely
  2. Register the services

    Two lines bring the module to life, one in your service registration and one in the request pipeline.

    C# · Startup
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddStottSecurity();
    }
    
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        app.UseAuthentication();
        app.UseAuthorization();
        app.UseStottSecurity();
    
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapContent();
            endpoints.MapControllers();
        });
    }
    • Declare app.UseStottSecurity() immediately before app.UseEndpoints(...) so that the headers are added to content responses.
    • If you are calling app.UseStaticFiles(), make sure that call is made after app.UseStottSecurity().
  3. Create your first Content Security Policy

    Open Stott Security in the CMS and follow the getting started guide to add your first sources, including separate policies for your front-end and CMS hosts.

Guides & release notes

Optimizely MVP Technology, Platinum

Built and maintained by Mark Stott, Platinum Optimizely MVP.

Free to use and covered by an MIT licence.

Get started Buy me a coffee Raise an issue