nuxt-security-module 4.3.1 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/index.d.ts +0 -2
  2. package/dist/index.js +1 -2
  3. package/dist/models/AllowedMethodsRestricterOptions.d.ts +1 -3
  4. package/dist/models/BasicAuthOptions.d.ts +1 -3
  5. package/dist/models/ContentSecurityPolicy.d.ts +1 -3
  6. package/dist/models/CorsHandlerOptions.d.ts +1 -3
  7. package/dist/models/CrossOriginEmbedderPolicy.d.ts +1 -3
  8. package/dist/models/CrossOriginEmbedderPolicy.js +1 -2
  9. package/dist/models/CsrfOptions.d.ts +1 -3
  10. package/dist/models/ModuleOptions.d.ts +1 -3
  11. package/dist/models/PermissionsPolicy.d.ts +1 -3
  12. package/dist/models/RateLimitWindow.d.ts +1 -3
  13. package/dist/models/RateLimiterOptions.d.ts +1 -3
  14. package/dist/models/RateLimiterStore.d.ts +1 -3
  15. package/dist/models/RequestSizeLimiterOptions.d.ts +1 -3
  16. package/dist/models/SecurityHeaders.d.ts +1 -3
  17. package/dist/models/SecurityRouteRules.d.ts +1 -3
  18. package/dist/models/SecurityRules.d.ts +1 -3
  19. package/dist/models/SsgOptions.d.ts +1 -3
  20. package/dist/models/StrictTransportSecurity.d.ts +1 -3
  21. package/dist/models/XFrameOptions.d.ts +1 -3
  22. package/dist/models/XFrameOptions.js +1 -2
  23. package/dist/runtime/constants.d.ts +1 -3
  24. package/dist/runtime/constants.js +1 -2
  25. package/dist/runtime/nitro/plugins/hidePoweredBy.d.ts +0 -2
  26. package/dist/runtime/nitro/plugins/hidePoweredBy.js +1 -2
  27. package/dist/runtime/nitro/plugins/nonce.d.ts +0 -2
  28. package/dist/runtime/nitro/plugins/nonce.js +1 -2
  29. package/dist/runtime/nitro/plugins/routeRules.d.ts +1 -3
  30. package/dist/runtime/nitro/plugins/routeRules.js +1 -2
  31. package/dist/runtime/nitro/plugins/securityHeaders.d.ts +0 -2
  32. package/dist/runtime/nitro/plugins/securityHeaders.js +1 -2
  33. package/dist/runtime/nitro/plugins/ssgHashes.d.ts +0 -2
  34. package/dist/runtime/nitro/plugins/ssgHashes.js +1 -2
  35. package/dist/runtime/nitro/plugins/subresourceIntegrity.d.ts +1 -3
  36. package/dist/runtime/nitro/plugins/subresourceIntegrity.js +1 -2
  37. package/dist/runtime/server/middleware/allowedMethodsRestricter.d.ts +0 -2
  38. package/dist/runtime/server/middleware/allowedMethodsRestricter.js +1 -2
  39. package/dist/runtime/server/middleware/basicAuth.d.ts +0 -2
  40. package/dist/runtime/server/middleware/basicAuth.js +1 -2
  41. package/dist/runtime/server/middleware/corsHandler.d.ts +0 -2
  42. package/dist/runtime/server/middleware/corsHandler.js +1 -2
  43. package/dist/runtime/server/middleware/csrf.d.ts +0 -2
  44. package/dist/runtime/server/middleware/csrf.js +1 -2
  45. package/dist/runtime/server/middleware/rateLimiter.d.ts +0 -2
  46. package/dist/runtime/server/middleware/rateLimiter.js +1 -2
  47. package/dist/runtime/server/middleware/requestSizeLimiter.d.ts +0 -2
  48. package/dist/runtime/server/middleware/requestSizeLimiter.js +1 -2
  49. package/dist/runtime/services/checkIsBasicAuthorized.d.ts +1 -3
  50. package/dist/runtime/services/checkIsBasicAuthorized.js +1 -2
  51. package/dist/runtime/services/checkIsChallenged.d.ts +1 -3
  52. package/dist/runtime/services/checkIsChallenged.js +1 -2
  53. package/dist/runtime/services/checkIsCsrfTokenValid.d.ts +1 -3
  54. package/dist/runtime/services/checkIsCsrfTokenValid.js +1 -2
  55. package/dist/runtime/services/checkIsEqualInConstantTime.d.ts +1 -3
  56. package/dist/runtime/services/checkIsEqualInConstantTime.js +1 -2
  57. package/dist/runtime/services/checkIsMethodAllowed.d.ts +1 -3
  58. package/dist/runtime/services/checkIsMethodAllowed.js +1 -2
  59. package/dist/runtime/services/checkIsRecord.d.ts +1 -3
  60. package/dist/runtime/services/checkIsRecord.js +1 -2
  61. package/dist/runtime/services/checkIsRequestTooLarge.d.ts +1 -3
  62. package/dist/runtime/services/checkIsRequestTooLarge.js +1 -2
  63. package/dist/runtime/services/collectSsgHashes.d.ts +1 -3
  64. package/dist/runtime/services/collectSsgHashes.js +1 -2
  65. package/dist/runtime/services/createInMemoryRateLimiterStore.d.ts +1 -3
  66. package/dist/runtime/services/createInMemoryRateLimiterStore.js +1 -2
  67. package/dist/runtime/services/generateHash.d.ts +1 -3
  68. package/dist/runtime/services/generateHash.js +1 -2
  69. package/dist/runtime/services/generateNonce.d.ts +1 -3
  70. package/dist/runtime/services/generateNonce.js +1 -2
  71. package/dist/runtime/services/generateRandomToken.d.ts +1 -3
  72. package/dist/runtime/services/generateRandomToken.js +1 -2
  73. package/dist/runtime/services/getBasicAuthCredentials.d.ts +1 -3
  74. package/dist/runtime/services/getBasicAuthCredentials.js +1 -2
  75. package/dist/runtime/services/getBasicAuthOptions.d.ts +1 -3
  76. package/dist/runtime/services/getBasicAuthOptions.js +1 -2
  77. package/dist/runtime/services/getRetryAfterSeconds.d.ts +1 -3
  78. package/dist/runtime/services/getRetryAfterSeconds.js +1 -2
  79. package/dist/runtime/services/getSecurityRules.d.ts +1 -3
  80. package/dist/runtime/services/getSecurityRules.js +1 -2
  81. package/dist/runtime/services/getSecurityState.d.ts +1 -3
  82. package/dist/runtime/services/getSecurityState.js +1 -2
  83. package/dist/runtime/services/injectNonce.d.ts +1 -3
  84. package/dist/runtime/services/injectNonce.js +1 -2
  85. package/dist/runtime/services/injectSubresourceIntegrity.d.ts +1 -3
  86. package/dist/runtime/services/injectSubresourceIntegrity.js +1 -2
  87. package/dist/runtime/services/insertContentSecurityPolicyMeta.d.ts +1 -3
  88. package/dist/runtime/services/insertContentSecurityPolicyMeta.js +1 -2
  89. package/dist/runtime/services/mergeSecurityRules.d.ts +1 -3
  90. package/dist/runtime/services/mergeSecurityRules.js +1 -2
  91. package/dist/runtime/services/readHtmlTagAttribute.d.ts +1 -3
  92. package/dist/runtime/services/readHtmlTagAttribute.js +1 -2
  93. package/dist/runtime/services/rewriteHtmlTags.d.ts +1 -3
  94. package/dist/runtime/services/rewriteHtmlTags.js +1 -2
  95. package/dist/runtime/services/securityRouteMatcher.d.ts +1 -3
  96. package/dist/runtime/services/securityRouteMatcher.js +1 -2
  97. package/dist/runtime/services/serializeBasicAuthChallenge.d.ts +1 -3
  98. package/dist/runtime/services/serializeBasicAuthChallenge.js +1 -2
  99. package/dist/runtime/services/serializeContentSecurityPolicy.d.ts +1 -3
  100. package/dist/runtime/services/serializeContentSecurityPolicy.js +1 -2
  101. package/dist/runtime/services/serializePermissionsPolicy.d.ts +1 -3
  102. package/dist/runtime/services/serializePermissionsPolicy.js +1 -2
  103. package/dist/runtime/services/serializeSecurityHeaders.d.ts +1 -3
  104. package/dist/runtime/services/serializeSecurityHeaders.js +1 -2
  105. package/dist/runtime/services/serializeStrictTransportSecurity.d.ts +1 -3
  106. package/dist/runtime/services/serializeStrictTransportSecurity.js +1 -2
  107. package/dist/runtime/services/stripHtmlTagAttribute.d.ts +1 -3
  108. package/dist/runtime/services/stripHtmlTagAttribute.js +1 -2
  109. package/dist/runtime/services/updateContentSecurityPolicy.d.ts +1 -3
  110. package/dist/runtime/services/updateContentSecurityPolicy.js +1 -2
  111. package/dist/schemas/allowedMethodsRestricterOptionsSchema.js +1 -2
  112. package/dist/schemas/basicAuthOptionsSchema.js +1 -2
  113. package/dist/schemas/contentSecurityPolicySchema.js +1 -2
  114. package/dist/schemas/corsHandlerOptionsSchema.js +1 -2
  115. package/dist/schemas/csrfOptionsSchema.js +1 -2
  116. package/dist/schemas/moduleOptionsSchema.js +1 -2
  117. package/dist/schemas/permissionsPolicySchema.js +1 -2
  118. package/dist/schemas/rateLimiterOptionsSchema.js +1 -2
  119. package/dist/schemas/requestSizeLimiterOptionsSchema.js +1 -2
  120. package/dist/schemas/securityHeadersSchema.js +1 -2
  121. package/dist/schemas/ssgOptionsSchema.js +1 -2
  122. package/dist/schemas/strictTransportSecurityOptionsSchema.js +1 -2
  123. package/dist/services/computeSubresourceIntegrityHashes.js +1 -2
  124. package/dist/services/formatZodIssues.js +1 -2
  125. package/dist/services/getDefaultModuleOptions.js +1 -2
  126. package/dist/services/getDefaultSecurityHeaders.js +1 -2
  127. package/dist/services/getPluginTemplate.js +1 -2
  128. package/dist/services/getRemoveLoggersViteConfig.js +1 -2
  129. package/dist/services/getRouteRulesTemplate.js +1 -2
  130. package/dist/services/getRouteSecurityRules.js +1 -2
  131. package/dist/services/getStaticResourceHeaders.js +1 -2
  132. package/dist/services/getTypeTemplate.js +1 -2
  133. package/dist/services/mergeModuleOptions.js +1 -2
  134. package/dist/services/parseModuleOptions.js +1 -2
  135. package/package.json +4 -4
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ModuleOptions } from "./models/ModuleOptions.js";
2
2
  import { SecurityRouteRules } from "./models/SecurityRouteRules.js";
3
3
  import { NuxtModule } from "@nuxt/schema";
4
- //#region src/module.d.ts
5
4
  declare module "@nuxt/schema" {
6
5
  interface NuxtConfig {
7
6
  security?: Partial<ModuleOptions>;
@@ -13,5 +12,4 @@ declare module "h3/rules" {
13
12
  }
14
13
  }
15
14
  declare const securityModule: NuxtModule<Partial<ModuleOptions>>;
16
- //#endregion
17
15
  export { type ModuleOptions, securityModule as default };
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import { getTypeTemplate } from "./services/getTypeTemplate.js";
12
12
  import { parseModuleOptions } from "./services/parseModuleOptions.js";
13
13
  import { defu } from "defu";
14
14
  import { addNitroPlugin, addServerHandler, addServerTemplate, addTypeTemplate, createResolver, defineNuxtModule } from "@nuxt/kit";
15
- //#region src/module.ts
15
+ // src/module.ts
16
16
  const ROUTE_RULES_TEMPLATE_FILENAME = `#${MODULE_NAME}/route-rules.mjs`;
17
17
  const SRI_HASHES_TEMPLATE_FILENAME = `#${MODULE_NAME}/sri-hashes.mjs`;
18
18
  const ROUTE_RULES_PLUGIN_FILENAME = `#${MODULE_NAME}/route-rules-plugin.mjs`;
@@ -101,5 +101,4 @@ const securityModule = defineNuxtModule({
101
101
  });
102
102
  }
103
103
  });
104
- //#endregion
105
104
  export { securityModule as default };
@@ -1,5 +1,3 @@
1
- //#region src/models/AllowedMethodsRestricterOptions.d.ts
2
1
  export interface AllowedMethodsRestricterOptions {
3
2
  methods: string[];
4
- }
5
- //#endregion
3
+ }
@@ -1,9 +1,7 @@
1
- //#region src/models/BasicAuthOptions.d.ts
2
1
  export interface BasicAuthOptions {
3
2
  exclude?: string[];
4
3
  include?: string[];
5
4
  message?: string;
6
5
  name: string;
7
6
  pass: string;
8
- }
9
- //#endregion
7
+ }
@@ -1,3 +1 @@
1
- //#region src/models/ContentSecurityPolicy.d.ts
2
- export type ContentSecurityPolicy = Record<string, boolean | string[] | undefined>;
3
- //#endregion
1
+ export type ContentSecurityPolicy = Record<string, boolean | string[] | undefined>;
@@ -1,4 +1,3 @@
1
- //#region src/models/CorsHandlerOptions.d.ts
2
1
  export interface CorsHandlerOptions {
3
2
  allowHeaders?: string[];
4
3
  credentials?: boolean;
@@ -9,5 +8,4 @@ export interface CorsHandlerOptions {
9
8
  preflight?: {
10
9
  statusCode: number;
11
10
  };
12
- }
13
- //#endregion
11
+ }
@@ -1,8 +1,6 @@
1
- //#region src/models/CrossOriginEmbedderPolicy.d.ts
2
1
  export declare const CrossOriginEmbedderPolicy: {
3
2
  readonly Credentialless: "credentialless";
4
3
  readonly RequireCorp: "require-corp";
5
4
  readonly UnsafeNone: "unsafe-none";
6
5
  };
7
- export type CrossOriginEmbedderPolicy = (typeof CrossOriginEmbedderPolicy)[keyof typeof CrossOriginEmbedderPolicy];
8
- //#endregion
6
+ export type CrossOriginEmbedderPolicy = (typeof CrossOriginEmbedderPolicy)[keyof typeof CrossOriginEmbedderPolicy];
@@ -1,8 +1,7 @@
1
- //#region src/models/CrossOriginEmbedderPolicy.ts
1
+ // src/models/CrossOriginEmbedderPolicy.ts
2
2
  const CrossOriginEmbedderPolicy = {
3
3
  Credentialless: "credentialless",
4
4
  RequireCorp: "require-corp",
5
5
  UnsafeNone: "unsafe-none"
6
6
  };
7
- //#endregion
8
7
  export { CrossOriginEmbedderPolicy };
@@ -1,6 +1,4 @@
1
- //#region src/models/CsrfOptions.d.ts
2
1
  export interface CsrfOptions {
3
2
  cookieName: string;
4
3
  headerName: string;
5
- }
6
- //#endregion
4
+ }
@@ -6,7 +6,6 @@ import { RateLimiterOptions } from "./RateLimiterOptions.js";
6
6
  import { RequestSizeLimiterOptions } from "./RequestSizeLimiterOptions.js";
7
7
  import { SecurityHeaders } from "./SecurityHeaders.js";
8
8
  import { SsgOptions } from "./SsgOptions.js";
9
- //#region src/models/ModuleOptions.d.ts
10
9
  export interface ModuleOptions {
11
10
  allowedMethodsRestricter: AllowedMethodsRestricterOptions | false;
12
11
  basicAuth: BasicAuthOptions | false;
@@ -23,5 +22,4 @@ export interface ModuleOptions {
23
22
  sri: boolean;
24
23
  ssg: false | SsgOptions;
25
24
  strict: boolean;
26
- }
27
- //#endregion
25
+ }
@@ -1,3 +1 @@
1
- //#region src/models/PermissionsPolicy.d.ts
2
- export type PermissionsPolicy = Record<string, false | string[] | undefined>;
3
- //#endregion
1
+ export type PermissionsPolicy = Record<string, false | string[] | undefined>;
@@ -1,6 +1,4 @@
1
- //#region src/models/RateLimitWindow.d.ts
2
1
  export interface RateLimitWindow {
3
2
  count: number;
4
3
  resetAt: number;
5
- }
6
- //#endregion
4
+ }
@@ -1,6 +1,4 @@
1
- //#region src/models/RateLimiterOptions.d.ts
2
1
  export interface RateLimiterOptions {
3
2
  intervalInMilliseconds: number;
4
3
  tokensPerInterval: number;
5
- }
6
- //#endregion
4
+ }
@@ -1,6 +1,4 @@
1
1
  import { RateLimitWindow } from "./RateLimitWindow.js";
2
- //#region src/models/RateLimiterStore.d.ts
3
2
  export interface RateLimiterStore {
4
3
  increment: (key: string, intervalInMilliseconds: number) => Promise<RateLimitWindow>;
5
- }
6
- //#endregion
4
+ }
@@ -1,6 +1,4 @@
1
- //#region src/models/RequestSizeLimiterOptions.d.ts
2
1
  export interface RequestSizeLimiterOptions {
3
2
  maxRequestSizeInBytes: number;
4
3
  maxUploadFileRequestInBytes: number;
5
- }
6
- //#endregion
4
+ }
@@ -3,7 +3,6 @@ import { CrossOriginEmbedderPolicy } from "./CrossOriginEmbedderPolicy.js";
3
3
  import { PermissionsPolicy } from "./PermissionsPolicy.js";
4
4
  import { StrictTransportSecurity } from "./StrictTransportSecurity.js";
5
5
  import { XFrameOptions } from "./XFrameOptions.js";
6
- //#region src/models/SecurityHeaders.d.ts
7
6
  export interface SecurityHeaders {
8
7
  contentSecurityPolicy?: ContentSecurityPolicy | false;
9
8
  crossOriginEmbedderPolicy?: CrossOriginEmbedderPolicy | false;
@@ -18,5 +17,4 @@ export interface SecurityHeaders {
18
17
  xDownloadOptions?: false | string;
19
18
  xFrameOptions?: false | XFrameOptions;
20
19
  xPermittedCrossDomainPolicies?: false | string;
21
- }
22
- //#endregion
20
+ }
@@ -1,4 +1,2 @@
1
1
  import { ModuleOptions } from "./ModuleOptions.js";
2
- //#region src/models/SecurityRouteRules.d.ts
3
- export type SecurityRouteRules = Partial<ModuleOptions>;
4
- //#endregion
2
+ export type SecurityRouteRules = Partial<ModuleOptions>;
@@ -1,4 +1,2 @@
1
1
  import { ModuleOptions } from "./ModuleOptions.js";
2
- //#region src/models/SecurityRules.d.ts
3
- export type SecurityRules = Partial<ModuleOptions>;
4
- //#endregion
2
+ export type SecurityRules = Partial<ModuleOptions>;
@@ -1,9 +1,7 @@
1
- //#region src/models/SsgOptions.d.ts
2
1
  export interface SsgOptions {
3
2
  exportToPresets: boolean;
4
3
  hashScripts: boolean;
5
4
  hashStyles: boolean;
6
5
  meta: boolean;
7
6
  nitroHeaders: boolean;
8
- }
9
- //#endregion
7
+ }
@@ -1,7 +1,5 @@
1
- //#region src/models/StrictTransportSecurity.d.ts
2
1
  export interface StrictTransportSecurity {
3
2
  includeSubdomains: boolean;
4
3
  maxAge: number;
5
4
  preload: boolean;
6
- }
7
- //#endregion
5
+ }
@@ -1,7 +1,5 @@
1
- //#region src/models/XFrameOptions.d.ts
2
1
  export declare const XFrameOptions: {
3
2
  readonly Deny: "DENY";
4
3
  readonly SameOrigin: "SAMEORIGIN";
5
4
  };
6
- export type XFrameOptions = (typeof XFrameOptions)[keyof typeof XFrameOptions];
7
- //#endregion
5
+ export type XFrameOptions = (typeof XFrameOptions)[keyof typeof XFrameOptions];
@@ -1,7 +1,6 @@
1
- //#region src/models/XFrameOptions.ts
1
+ // src/models/XFrameOptions.ts
2
2
  const XFrameOptions = {
3
3
  Deny: "DENY",
4
4
  SameOrigin: "SAMEORIGIN"
5
5
  };
6
- //#endregion
7
6
  export { XFrameOptions };
@@ -1,5 +1,4 @@
1
1
  import { SecurityHeaders } from "../models/SecurityHeaders.js";
2
- //#region src/runtime/constants.d.ts
3
2
  export declare const MODULE_NAME = "nuxt-security-module";
4
3
  export declare const ROUTE_RULES_HOOK: `${typeof MODULE_NAME}:routeRules`;
5
4
  export declare const SECURITY_HEADER_NAMES: Readonly<Record<keyof SecurityHeaders, string>>;
@@ -20,5 +19,4 @@ export declare const NONCE_TAG_NAMES: readonly string[];
20
19
  export declare const FILE_UPLOAD_CONTENT_TYPE = "multipart/form-data";
21
20
  export declare const SIZE_LIMITED_METHODS: readonly string[];
22
21
  export declare const DEFAULT_BASIC_AUTH_REALM = "Please enter username and password";
23
- export declare const BASIC_AUTHORIZATION_SCHEME = "Basic";
24
- //#endregion
22
+ export declare const BASIC_AUTHORIZATION_SCHEME = "Basic";
@@ -1,4 +1,4 @@
1
- //#region src/runtime/constants.ts
1
+ // src/runtime/constants.ts
2
2
  const MODULE_NAME = "nuxt-security-module";
3
3
  const ROUTE_RULES_HOOK = `${MODULE_NAME}:routeRules`;
4
4
  const SECURITY_HEADER_NAMES = {
@@ -48,5 +48,4 @@ const SIZE_LIMITED_METHODS = [
48
48
  ];
49
49
  const DEFAULT_BASIC_AUTH_REALM = "Please enter username and password";
50
50
  const BASIC_AUTHORIZATION_SCHEME = "Basic";
51
- //#endregion
52
51
  export { BASIC_AUTHORIZATION_SCHEME, CONTENT_SECURITY_POLICY_REPORT_ONLY_HEADER_NAME, CSP_HASH_ALGORITHM, CSRF_TOKEN_BYTE_LENGTH, CSRF_UNSAFE_METHODS, DEFAULT_BASIC_AUTH_REALM, FILE_UPLOAD_CONTENT_TYPE, HTML_ATTRIBUTE_REGEX, HTML_TAG_REGEX, MAX_RATE_LIMIT_ENTRIES, MODULE_NAME, NONCE_BYTE_LENGTH, NONCE_PLACEHOLDER, NONCE_TAG_NAMES, PRERENDERED_HEADERS_DIRECTORY_NAME, PRERENDERED_HEADERS_FILE_NAME, ROUTE_RULES_HOOK, SECURITY_HEADER_NAMES, SIZE_LIMITED_METHODS, SRI_HASH_ALGORITHM, UNKNOWN_CLIENT_KEY };
@@ -1,5 +1,3 @@
1
1
  import { NitroAppPlugin } from "nitro/types";
2
- //#region src/runtime/nitro/plugins/hidePoweredBy.d.ts
3
2
  declare const hidePoweredBy: NitroAppPlugin;
4
- //#endregion
5
3
  export { hidePoweredBy as default };
@@ -1,7 +1,7 @@
1
1
  import { getSecurityRules } from "../../services/getSecurityRules.js";
2
2
  import { definePlugin } from "nitro";
3
3
  import { isEvent } from "nitro/h3";
4
- //#region src/runtime/nitro/plugins/hidePoweredBy.ts
4
+ // src/runtime/nitro/plugins/hidePoweredBy.ts
5
5
  const hidePoweredBy = definePlugin((nitroApp) => {
6
6
  nitroApp.hooks.hook("response", (_response, event) => {
7
7
  if (!isEvent(event)) return;
@@ -9,5 +9,4 @@ const hidePoweredBy = definePlugin((nitroApp) => {
9
9
  if (rules?.enabled && rules.hidePoweredBy) event.res.headers.delete("x-powered-by");
10
10
  });
11
11
  });
12
- //#endregion
13
12
  export { hidePoweredBy as default };
@@ -1,5 +1,3 @@
1
1
  import { NitroAppPlugin } from "nitro/types";
2
- //#region src/runtime/nitro/plugins/nonce.d.ts
3
2
  declare const noncePlugin: NitroAppPlugin;
4
- //#endregion
5
3
  export { noncePlugin as default };
@@ -3,7 +3,7 @@ import { getSecurityRules } from "../../services/getSecurityRules.js";
3
3
  import { getSecurityState } from "../../services/getSecurityState.js";
4
4
  import { injectNonce } from "../../services/injectNonce.js";
5
5
  import { definePlugin } from "nitro";
6
- //#region src/runtime/nitro/plugins/nonce.ts
6
+ // src/runtime/nitro/plugins/nonce.ts
7
7
  const HTML_SECTIONS = [
8
8
  "body",
9
9
  "bodyAppend",
@@ -23,5 +23,4 @@ const noncePlugin = definePlugin((nitroApp) => {
23
23
  for (const section of HTML_SECTIONS) html[section] = html[section].map((element) => injectNonce(element, nonce));
24
24
  });
25
25
  });
26
- //#endregion
27
26
  export { noncePlugin as default };
@@ -1,5 +1,3 @@
1
1
  import { SecurityRules } from "../../../models/SecurityRules.js";
2
2
  import { NitroAppPlugin } from "nitro/types";
3
- //#region src/runtime/nitro/plugins/routeRules.d.ts
4
- export declare const createRouteRulesPlugin: (routeRules: Record<string, SecurityRules>) => NitroAppPlugin;
5
- //#endregion
3
+ export declare const createRouteRulesPlugin: (routeRules: Record<string, SecurityRules>) => NitroAppPlugin;
@@ -1,7 +1,7 @@
1
1
  import { ROUTE_RULES_HOOK } from "../../constants.js";
2
2
  import { setSecurityRouteMatcher } from "../../services/securityRouteMatcher.js";
3
3
  import { definePlugin } from "nitro";
4
- //#region src/runtime/nitro/plugins/routeRules.ts
4
+ // src/runtime/nitro/plugins/routeRules.ts
5
5
  const createRouteRulesPlugin = (routeRules) => definePlugin((nitroApp) => {
6
6
  let routesResolved;
7
7
  nitroApp.hooks.hook("request", () => {
@@ -13,5 +13,4 @@ const createRouteRulesPlugin = (routeRules) => definePlugin((nitroApp) => {
13
13
  return routesResolved;
14
14
  });
15
15
  });
16
- //#endregion
17
16
  export { createRouteRulesPlugin };
@@ -1,5 +1,3 @@
1
1
  import { NitroAppPlugin } from "nitro/types";
2
- //#region src/runtime/nitro/plugins/securityHeaders.d.ts
3
2
  declare const securityHeaders: NitroAppPlugin;
4
- //#endregion
5
3
  export { securityHeaders as default };
@@ -4,7 +4,7 @@ import { getSecurityState } from "../../services/getSecurityState.js";
4
4
  import { serializeSecurityHeaders } from "../../services/serializeSecurityHeaders.js";
5
5
  import { updateContentSecurityPolicy } from "../../services/updateContentSecurityPolicy.js";
6
6
  import { definePlugin } from "nitro";
7
- //#region src/runtime/nitro/plugins/securityHeaders.ts
7
+ // src/runtime/nitro/plugins/securityHeaders.ts
8
8
  const CONTENT_SECURITY_POLICY_HEADER_NAME = SECURITY_HEADER_NAMES.contentSecurityPolicy;
9
9
  const securityHeaders = definePlugin((nitroApp) => {
10
10
  nitroApp.hooks.hook("render:route", (_context, { event }) => {
@@ -21,5 +21,4 @@ const securityHeaders = definePlugin((nitroApp) => {
21
21
  }
22
22
  });
23
23
  });
24
- //#endregion
25
24
  export { securityHeaders as default };
@@ -1,5 +1,3 @@
1
1
  import { NitroAppPlugin } from "nitro/types";
2
- //#region src/runtime/nitro/plugins/ssgHashes.d.ts
3
2
  declare const ssgHashes: NitroAppPlugin;
4
- //#endregion
5
3
  export { ssgHashes as default };
@@ -4,7 +4,7 @@ import { getSecurityState } from "../../services/getSecurityState.js";
4
4
  import { insertContentSecurityPolicyMeta } from "../../services/insertContentSecurityPolicyMeta.js";
5
5
  import { updateContentSecurityPolicy } from "../../services/updateContentSecurityPolicy.js";
6
6
  import { definePlugin } from "nitro";
7
- //#region src/runtime/nitro/plugins/ssgHashes.ts
7
+ // src/runtime/nitro/plugins/ssgHashes.ts
8
8
  const HTML_SECTIONS = [
9
9
  "head",
10
10
  "bodyPrepend",
@@ -23,5 +23,4 @@ const ssgHashes = definePlugin((nitroApp) => {
23
23
  html.head = [insertContentSecurityPolicyMeta(html.head.join(""), policy)];
24
24
  });
25
25
  });
26
- //#endregion
27
26
  export { ssgHashes as default };
@@ -1,4 +1,2 @@
1
1
  import { NitroAppPlugin } from "nitro/types";
2
- //#region src/runtime/nitro/plugins/subresourceIntegrity.d.ts
3
- export declare const createSubresourceIntegrityPlugin: (sriHashes: Record<string, string>) => NitroAppPlugin;
4
- //#endregion
2
+ export declare const createSubresourceIntegrityPlugin: (sriHashes: Record<string, string>) => NitroAppPlugin;
@@ -1,7 +1,7 @@
1
1
  import { getSecurityRules } from "../../services/getSecurityRules.js";
2
2
  import { injectSubresourceIntegrity } from "../../services/injectSubresourceIntegrity.js";
3
3
  import { definePlugin } from "nitro";
4
- //#region src/runtime/nitro/plugins/subresourceIntegrity.ts
4
+ // src/runtime/nitro/plugins/subresourceIntegrity.ts
5
5
  const HTML_SECTIONS = [
6
6
  "body",
7
7
  "bodyAppend",
@@ -15,5 +15,4 @@ const createSubresourceIntegrityPlugin = (sriHashes) => definePlugin((nitroApp)
15
15
  for (const section of HTML_SECTIONS) html[section] = html[section].map((element) => injectSubresourceIntegrity(element, sriHashes));
16
16
  });
17
17
  });
18
- //#endregion
19
18
  export { createSubresourceIntegrityPlugin };
@@ -1,5 +1,3 @@
1
1
  import { Middleware } from "nitro/h3";
2
- //#region src/runtime/server/middleware/allowedMethodsRestricter.d.ts
3
2
  declare const allowedMethodsRestricter: Middleware;
4
- //#endregion
5
3
  export { allowedMethodsRestricter as default };
@@ -2,7 +2,7 @@ import { checkIsMethodAllowed } from "../../services/checkIsMethodAllowed.js";
2
2
  import { getSecurityRules } from "../../services/getSecurityRules.js";
3
3
  import { defineMiddleware } from "nitro";
4
4
  import { HTTPError } from "nitro/h3";
5
- //#region src/runtime/server/middleware/allowedMethodsRestricter.ts
5
+ // src/runtime/server/middleware/allowedMethodsRestricter.ts
6
6
  const allowedMethodsRestricter = defineMiddleware((event) => {
7
7
  const rules = getSecurityRules(event);
8
8
  if (!rules?.enabled || !rules.allowedMethodsRestricter) return;
@@ -11,5 +11,4 @@ const allowedMethodsRestricter = defineMiddleware((event) => {
11
11
  statusText: "Method not allowed"
12
12
  });
13
13
  });
14
- //#endregion
15
14
  export { allowedMethodsRestricter as default };
@@ -1,5 +1,3 @@
1
1
  import { Middleware } from "nitro/h3";
2
- //#region src/runtime/server/middleware/basicAuth.d.ts
3
2
  declare const basicAuthMiddleware: Middleware;
4
- //#endregion
5
3
  export { basicAuthMiddleware as default };
@@ -6,7 +6,7 @@ import { serializeBasicAuthChallenge } from "../../services/serializeBasicAuthCh
6
6
  import { defineMiddleware } from "nitro";
7
7
  import { HTTPError } from "nitro/h3";
8
8
  import { useRuntimeConfig } from "nuxt/server";
9
- //#region src/runtime/server/middleware/basicAuth.ts
9
+ // src/runtime/server/middleware/basicAuth.ts
10
10
  const basicAuthMiddleware = defineMiddleware((event) => {
11
11
  const basicAuth = getBasicAuthOptions(useRuntimeConfig().private);
12
12
  if (!basicAuth) return;
@@ -19,5 +19,4 @@ const basicAuthMiddleware = defineMiddleware((event) => {
19
19
  statusText: "Access denied"
20
20
  });
21
21
  });
22
- //#endregion
23
22
  export { basicAuthMiddleware as default };
@@ -1,5 +1,3 @@
1
1
  import { Middleware } from "nitro/h3";
2
- //#region src/runtime/server/middleware/corsHandler.d.ts
3
2
  declare const corsHandler: Middleware;
4
- //#endregion
5
3
  export { corsHandler as default };
@@ -1,7 +1,7 @@
1
1
  import { getSecurityRules } from "../../services/getSecurityRules.js";
2
2
  import { defineMiddleware } from "nitro";
3
3
  import { handleCors } from "nitro/h3";
4
- //#region src/runtime/server/middleware/corsHandler.ts
4
+ // src/runtime/server/middleware/corsHandler.ts
5
5
  const corsHandler = defineMiddleware((event) => {
6
6
  const rules = getSecurityRules(event);
7
7
  if (!rules?.enabled || !rules.corsHandler) return;
@@ -16,5 +16,4 @@ const corsHandler = defineMiddleware((event) => {
16
16
  preflight
17
17
  });
18
18
  });
19
- //#endregion
20
19
  export { corsHandler as default };
@@ -1,5 +1,3 @@
1
1
  import { Middleware } from "nitro/h3";
2
- //#region src/runtime/server/middleware/csrf.d.ts
3
2
  declare const csrf: Middleware;
4
- //#endregion
5
3
  export { csrf as default };
@@ -4,7 +4,7 @@ import { generateRandomToken } from "../../services/generateRandomToken.js";
4
4
  import { getSecurityRules } from "../../services/getSecurityRules.js";
5
5
  import { defineMiddleware } from "nitro";
6
6
  import { HTTPError, getCookie, setCookie } from "nitro/h3";
7
- //#region src/runtime/server/middleware/csrf.ts
7
+ // src/runtime/server/middleware/csrf.ts
8
8
  const csrf = defineMiddleware((event) => {
9
9
  const rules = getSecurityRules(event);
10
10
  if (!rules?.enabled || !rules.csrf) return;
@@ -24,5 +24,4 @@ const csrf = defineMiddleware((event) => {
24
24
  statusText: "Forbidden"
25
25
  });
26
26
  });
27
- //#endregion
28
27
  export { csrf as default };
@@ -1,5 +1,3 @@
1
1
  import { Middleware } from "nitro/h3";
2
- //#region src/runtime/server/middleware/rateLimiter.d.ts
3
2
  declare const rateLimiter: Middleware;
4
- //#endregion
5
3
  export { rateLimiter as default };
@@ -4,7 +4,7 @@ import { getRetryAfterSeconds } from "../../services/getRetryAfterSeconds.js";
4
4
  import { getSecurityRules } from "../../services/getSecurityRules.js";
5
5
  import { defineMiddleware } from "nitro";
6
6
  import { HTTPError, getRequestIP } from "nitro/h3";
7
- //#region src/runtime/server/middleware/rateLimiter.ts
7
+ // src/runtime/server/middleware/rateLimiter.ts
8
8
  const rateLimiterStore = createInMemoryRateLimiterStore(MAX_RATE_LIMIT_ENTRIES);
9
9
  const rateLimiter = defineMiddleware(async (event) => {
10
10
  const rules = getSecurityRules(event);
@@ -18,5 +18,4 @@ const rateLimiter = defineMiddleware(async (event) => {
18
18
  statusText: "Too Many Requests"
19
19
  });
20
20
  });
21
- //#endregion
22
21
  export { rateLimiter as default };
@@ -1,5 +1,3 @@
1
1
  import { Middleware } from "nitro/h3";
2
- //#region src/runtime/server/middleware/requestSizeLimiter.d.ts
3
2
  declare const requestSizeLimiter: Middleware;
4
- //#endregion
5
3
  export { requestSizeLimiter as default };
@@ -2,7 +2,7 @@ import { checkIsRequestTooLarge } from "../../services/checkIsRequestTooLarge.js
2
2
  import { getSecurityRules } from "../../services/getSecurityRules.js";
3
3
  import { defineMiddleware } from "nitro";
4
4
  import { HTTPError } from "nitro/h3";
5
- //#region src/runtime/server/middleware/requestSizeLimiter.ts
5
+ // src/runtime/server/middleware/requestSizeLimiter.ts
6
6
  const requestSizeLimiter = defineMiddleware((event) => {
7
7
  const rules = getSecurityRules(event);
8
8
  if (!rules?.enabled || !rules.requestSizeLimiter) return;
@@ -13,5 +13,4 @@ const requestSizeLimiter = defineMiddleware((event) => {
13
13
  statusText: "Payload Too Large"
14
14
  });
15
15
  });
16
- //#endregion
17
16
  export { requestSizeLimiter as default };
@@ -1,4 +1,2 @@
1
1
  import { BasicAuthOptions } from "../../models/BasicAuthOptions.js";
2
- //#region src/runtime/services/checkIsBasicAuthorized.d.ts
3
- export declare const checkIsBasicAuthorized: (authorization: null | string, { name, pass }: BasicAuthOptions) => boolean;
4
- //#endregion
2
+ export declare const checkIsBasicAuthorized: (authorization: null | string, { name, pass }: BasicAuthOptions) => boolean;
@@ -1,6 +1,6 @@
1
1
  import { checkIsEqualInConstantTime } from "./checkIsEqualInConstantTime.js";
2
2
  import { getBasicAuthCredentials } from "./getBasicAuthCredentials.js";
3
- //#region src/runtime/services/checkIsBasicAuthorized.ts
3
+ // src/runtime/services/checkIsBasicAuthorized.ts
4
4
  const checkIsBasicAuthorized = (authorization, { name, pass }) => {
5
5
  const credentials = getBasicAuthCredentials(authorization);
6
6
  if (!credentials) return false;
@@ -8,5 +8,4 @@ const checkIsBasicAuthorized = (authorization, { name, pass }) => {
8
8
  const isPassEqual = checkIsEqualInConstantTime(credentials.pass, pass);
9
9
  return isNameEqual && isPassEqual;
10
10
  };
11
- //#endregion
12
11
  export { checkIsBasicAuthorized };
@@ -1,4 +1,2 @@
1
1
  import { BasicAuthOptions } from "../../models/BasicAuthOptions.js";
2
- //#region src/runtime/services/checkIsChallenged.d.ts
3
- export declare const checkIsChallenged: (path: string, { exclude, include }: BasicAuthOptions) => boolean;
4
- //#endregion
2
+ export declare const checkIsChallenged: (path: string, { exclude, include }: BasicAuthOptions) => boolean;
@@ -1,8 +1,7 @@
1
- //#region src/runtime/services/checkIsChallenged.ts
1
+ // src/runtime/services/checkIsChallenged.ts
2
2
  const checkIsChallenged = (path, { exclude = [], include = [] }) => {
3
3
  const isIncluded = include.some((prefix) => path.startsWith(prefix));
4
4
  const isExcluded = exclude.some((prefix) => path.startsWith(prefix));
5
5
  return isIncluded || !isExcluded;
6
6
  };
7
- //#endregion
8
7
  export { checkIsChallenged };
@@ -1,3 +1 @@
1
- //#region src/runtime/services/checkIsCsrfTokenValid.d.ts
2
- export declare const checkIsCsrfTokenValid: (cookieToken: string | undefined, headerToken: null | string) => boolean;
3
- //#endregion
1
+ export declare const checkIsCsrfTokenValid: (cookieToken: string | undefined, headerToken: null | string) => boolean;
@@ -1,8 +1,7 @@
1
1
  import { checkIsEqualInConstantTime } from "./checkIsEqualInConstantTime.js";
2
- //#region src/runtime/services/checkIsCsrfTokenValid.ts
2
+ // src/runtime/services/checkIsCsrfTokenValid.ts
3
3
  const checkIsCsrfTokenValid = (cookieToken, headerToken) => {
4
4
  if (!cookieToken || !headerToken) return false;
5
5
  return checkIsEqualInConstantTime(cookieToken, headerToken);
6
6
  };
7
- //#endregion
8
7
  export { checkIsCsrfTokenValid };
@@ -1,3 +1 @@
1
- //#region src/runtime/services/checkIsEqualInConstantTime.d.ts
2
- export declare const checkIsEqualInConstantTime: (first: string, second: string) => boolean;
3
- //#endregion
1
+ export declare const checkIsEqualInConstantTime: (first: string, second: string) => boolean;
@@ -1,4 +1,4 @@
1
- //#region src/runtime/services/checkIsEqualInConstantTime.ts
1
+ // src/runtime/services/checkIsEqualInConstantTime.ts
2
2
  const checkIsEqualInConstantTime = (first, second) => {
3
3
  const firstBytes = new TextEncoder().encode(first);
4
4
  const secondBytes = new TextEncoder().encode(second);
@@ -7,5 +7,4 @@ const checkIsEqualInConstantTime = (first, second) => {
7
7
  for (const [index, byte] of firstBytes.entries()) difference |= byte ^ (secondBytes[index] ?? 0);
8
8
  return difference === 0;
9
9
  };
10
- //#endregion
11
10
  export { checkIsEqualInConstantTime };
@@ -1,3 +1 @@
1
- //#region src/runtime/services/checkIsMethodAllowed.d.ts
2
- export declare const checkIsMethodAllowed: (method: string, methods: string[]) => boolean;
3
- //#endregion
1
+ export declare const checkIsMethodAllowed: (method: string, methods: string[]) => boolean;
@@ -1,4 +1,3 @@
1
- //#region src/runtime/services/checkIsMethodAllowed.ts
1
+ // src/runtime/services/checkIsMethodAllowed.ts
2
2
  const checkIsMethodAllowed = (method, methods) => methods.includes(method);
3
- //#endregion
4
3
  export { checkIsMethodAllowed };