include::../description.adoc[]

include::../ask-yourself.adoc[]

include::../recommended.adoc[]

== Sensitive Code Example

In a Express.js application, the code is sensitive if the https://www.npmjs.com/package/helmet[helmet] contentSecurityPolicy middleware is disabled:

----
const express = require('express');
const helmet = require('helmet');

let app = express();
app.use(
    helmet({
      contentSecurityPolicy: false, // sensitive
    })
);
----

== Compliant Solution

In a Express.js application, a standard way to implement CSP is the https://www.npmjs.com/package/helmet[helmet contentSecurityPolicy middleware]:

[source,javascript]
----
const express = require('express');
const helmet = require('helmet');

let app = express();
app.use(helmet.contentSecurityPolicy()); // Compliant
----

include::../see.adoc[]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

endif::env-github,rspecator-view[]
