Skip to content

Commit

Permalink
fix(content-security-policy): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdbd committed Sep 28, 2022
1 parent 9d9b9ab commit ca16767
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions packages/content-security-policy/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ export const csp_source_values = Joi.array()
.unique()
.unique(hashAlgorithmComparator)

const glob_pattern = Joi.string().min(1)

const glob_patterns = Joi.array().items(glob_pattern).min(1)

// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-to
const groupname = Joi.string().min(1)

Expand Down Expand Up @@ -106,16 +102,6 @@ const sandbox_value = Joi.string().valid(
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
const trusted_types_value = Joi.string().min(1)

export const defaultOptions = {
allowDeprecatedDirectives: false,
directives: {},
globPatterns: ['/', '/*/'],
globPatternsDetach: [],
excludePatterns: [],
includePatterns: ['/**/**.html'],
reportOnly: false
}

export const directives = Joi.object({
'base-uri': csp_source_values,
'child-src': csp_source_values,
Expand Down Expand Up @@ -148,22 +134,3 @@ export const directives = Joi.object({
'upgrade-insecure-requests': Joi.boolean(),
'worker-src': csp_source_values
})

export const pluginOptions = Joi.object().keys({
allowDeprecatedDirectives: Joi.boolean().default(
defaultOptions.allowDeprecatedDirectives
),

directives: directives.default(defaultOptions.directives),

excludePatterns: glob_patterns.default(defaultOptions.excludePatterns),

globPatterns: glob_patterns.default(defaultOptions.globPatterns),

// https://developers.cloudflare.com/pages/platform/headers/#detach-a-header
globPatternsDetach: glob_patterns.default(defaultOptions.globPatternsDetach),

includePatterns: glob_patterns.default(defaultOptions.includePatterns),

reportOnly: Joi.boolean().default(defaultOptions.reportOnly)
})

0 comments on commit ca16767

Please sign in to comment.