Skip to content

[Bug]: CSP type is wrong in Internal middleware configuration in Security middleware #1321

@lrasata

Description

@lrasata

Link to the documentation page or resource

https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.html#security

Describe the bug

In the table of possible options for security middleware, for contentSecurityPolicy it is mentioned that the Type is a Boolean which is not correct regarding the source code node_modules/@strapi/strapi/lib/middlewares/security.js
These are the default configuration used by Strapi :

const defaults = {
  crossOriginEmbedderPolicy: false,
  crossOriginOpenerPolicy: false,
  crossOriginResourcePolicy: false,
  originAgentCluster: false,
  contentSecurityPolicy: {
    useDefaults: true,
    directives: {
      'connect-src': ["'self'", 'https:'],
      'img-src': ["'self'", 'data:', 'blob:', 'https://dl.airtable.com'],
      'media-src': ["'self'", 'data:', 'blob:'],
      upgradeInsecureRequests: null,
    },
  },
  xssFilter: false,
  hsts: {
    maxAge: 31536000,
    includeSubDomains: true,
  },
  frameguard: {
    action: 'sameorigin',
  },
};

And you can see that contentSecurityPolicy is of type Object and not Boolean.

Additional context

No response

Suggested improvements or fixes

contentSecurityPolicy is of Type Object and not Boolean
Screenshot 2022-12-06 at 10 45 26 AM

Related issue(s)/PR(s)

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions