http-directives
Version:
A TypeScript-friendly package that provides strongly-typed HTTP constants
69 lines (67 loc) • 2.33 kB
JavaScript
// src/directives/csp.ts
var CSPDirectives = class {
};
CSPDirectives.BASE_URI = "base-uri";
CSPDirectives.DEFAULT_SRC = "default-src";
CSPDirectives.CONNECT_SRC = "connect-src";
CSPDirectives.PREFETCH_SRC = "prefetch-src";
CSPDirectives.SCRIPT_SRC = "script-src";
CSPDirectives.STYLE_SRC = "style-src";
CSPDirectives.IMG_SRC = "img-src";
CSPDirectives.FONT_SRC = "font-src";
CSPDirectives.MEDIA_SRC = "media-src";
CSPDirectives.OBJECT_SRC = "object-src";
CSPDirectives.MANIFEST_SRC = "manifest-src";
CSPDirectives.WORKER_SRC = "worker-src";
CSPDirectives.FRAME_SRC = "frame-src";
/** @deprecated Use frame-src and worker-src instead */
CSPDirectives.CHILD_SRC = "child-src";
CSPDirectives.FRAME_ANCESTORS = "frame-ancestors";
CSPDirectives.SANDBOX = "sandbox";
CSPDirectives.FORM_ACTION = "form-action";
CSPDirectives.NAVIGATE_TO = "navigate-to";
CSPDirectives.UPGRADE_INSECURE_REQUESTS = "upgrade-insecure-requests";
CSPDirectives.BLOCK_ALL_MIXED_CONTENT = "block-all-mixed-content";
/** @deprecated Replaced by Referrer-Policy header. */
CSPDirectives.REFERRER = "referrer";
/** @deprecated Use report-to instead. */
CSPDirectives.REPORT_URI = "report-uri";
CSPDirectives.REPORT_TO = "report-to";
/** @deprecated */
CSPDirectives.REQUIRE_SRI_FOR = "require-sri-for";
/** @deprecated */
CSPDirectives.PLUGIN_TYPES = "plugin-types";
var CSPSources = class {
static nonce(value) {
return `'nonce-${value}'`;
}
static sha256(value) {
return `'sha256-${value}'`;
}
static sha384(value) {
return `'sha384-${value}'`;
}
static sha512(value) {
return `'sha512-${value}'`;
}
};
CSPSources.SELF = "self";
CSPSources.NONE = "none";
CSPSources.STRICT_DYNAMIC = "strict-dynamic";
CSPSources.UNSAFE_INLINE = "unsafe-inline";
CSPSources.UNSAFE_EVAL = "unsafe-eval";
CSPSources.UNSAFE_HASHES = "unsafe-hashes";
CSPSources.WASM_UNSAFE_EVAL = "wasm-unsafe-eval";
CSPSources.REPORT_SAMPLE = "report-sample";
CSPSources.SELF_QTD = "'self'";
CSPSources.NONE_QTD = "'none'";
CSPSources.STRICT_DYNAMIC_QTD = "'strict-dynamic'";
CSPSources.UNSAFE_INLINE_QTD = "'unsafe-inline'";
CSPSources.UNSAFE_EVAL_QTD = "'unsafe-eval'";
CSPSources.UNSAFE_HASHES_QTD = "'unsafe-hashes'";
CSPSources.WASM_UNSAFE_EVAL_QTD = "'wasm-unsafe-eval'";
CSPSources.REPORT_SAMPLE_QTD = "'report-sample'";
export {
CSPDirectives,
CSPSources
};