fastly.js 0.9.0
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.
- package/LICENSE +21 -0
- package/README.md +702 -0
- package/dist/browser.d.ts +10 -0
- package/dist/browser.js +10544 -0
- package/dist/csrf-protection.d.ts +10 -0
- package/dist/diagnostics.d.ts +11 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10435 -0
- package/dist/node-loader.d.ts +3 -0
- package/dist/platform-browser.d.ts +2 -0
- package/dist/platform-node.d.ts +2 -0
- package/dist/platform.d.ts +48 -0
- package/dist/runtime/browser.d.ts +49 -0
- package/dist/runtime/pipeline.d.ts +49 -0
- package/dist/utils.d.ts +7 -0
- package/dist/vcl-accept.d.ts +8 -0
- package/dist/vcl-acl.d.ts +19 -0
- package/dist/vcl-address.d.ts +8 -0
- package/dist/vcl-binary.d.ts +5 -0
- package/dist/vcl-builtin-types.d.ts +10 -0
- package/dist/vcl-compiler.d.ts +513 -0
- package/dist/vcl-digest.d.ts +87 -0
- package/dist/vcl-esi.d.ts +32 -0
- package/dist/vcl-fetch.d.ts +6 -0
- package/dist/vcl-header.d.ts +18 -0
- package/dist/vcl-limits.d.ts +10 -0
- package/dist/vcl-math.d.ts +45 -0
- package/dist/vcl-misc.d.ts +29 -0
- package/dist/vcl-node.d.ts +2 -0
- package/dist/vcl-parser-impl.d.ts +126 -0
- package/dist/vcl-parser.d.ts +320 -0
- package/dist/vcl-querystring.d.ts +46 -0
- package/dist/vcl-ratelimit.d.ts +39 -0
- package/dist/vcl-security.d.ts +23 -0
- package/dist/vcl-std.d.ts +43 -0
- package/dist/vcl-strings.d.ts +47 -0
- package/dist/vcl-table.d.ts +27 -0
- package/dist/vcl-testing.d.ts +60 -0
- package/dist/vcl-time.d.ts +60 -0
- package/dist/vcl-utf8.d.ts +6 -0
- package/dist/vcl-uuid.d.ts +38 -0
- package/dist/vcl-value.d.ts +96 -0
- package/dist/vcl-waf.d.ts +14 -0
- package/dist/vcl.d.ts +7 -0
- package/package.json +90 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSRF Protection Module
|
|
3
|
+
* Provides CSRF token generation and validation for the VCL implementation.
|
|
4
|
+
*/
|
|
5
|
+
import type { VCLContext } from "./vcl-compiler.js";
|
|
6
|
+
export declare function generateCSRFToken(context: VCLContext, secret: string): string;
|
|
7
|
+
export declare function validateCSRFToken(context: VCLContext, token: string, secret: string): boolean;
|
|
8
|
+
export declare function protectAgainstCSRF(context: VCLContext, secret: string): boolean;
|
|
9
|
+
export declare function addCSRFTokenToResponse(context: VCLContext): void;
|
|
10
|
+
export declare const csrfProtectionVCL = "\n# CSRF Protection\nsub vcl_recv {\n if (req.method == \"GET\") {\n set req.http.X-CSRF-Token = digest.hash_sha256(\n client.ip +\n req.http.User-Agent +\n \"secret-salt\" +\n strftime({\"%Y%m%d\"}, now)\n );\n }\n else {\n declare local var.expected_token STRING;\n set var.expected_token = digest.hash_sha256(\n client.ip +\n req.http.User-Agent +\n \"secret-salt\" +\n strftime({\"%Y%m%d\"}, now)\n );\n\n if (req.http.X-CSRF-Token != var.expected_token) {\n error 403 \"CSRF token validation failed\";\n }\n }\n}\n\nsub vcl_deliver {\n if (req.method == \"GET\" && req.http.X-CSRF-Token) {\n set resp.http.X-CSRF-Token = req.http.X-CSRF-Token;\n }\n}\n";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface VCLDiagnostic {
|
|
2
|
+
message: string;
|
|
3
|
+
line?: number;
|
|
4
|
+
column?: number;
|
|
5
|
+
sourceFrame?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function buildDiagnostic(error: Error, source: string): VCLDiagnostic;
|
|
8
|
+
export declare class VCLDiagnosticError extends Error {
|
|
9
|
+
readonly diagnostic: VCLDiagnostic;
|
|
10
|
+
constructor(diagnostic: VCLDiagnostic);
|
|
11
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./platform-node.js";
|
|
2
|
+
export type { VCLDiagnostic } from "./diagnostics.js";
|
|
3
|
+
export { VCLDiagnosticError } from "./diagnostics.js";
|
|
4
|
+
export { loadVCL } from "./node-loader.js";
|
|
5
|
+
export type { TraceEvent, VCLPlatform } from "./platform.js";
|
|
6
|
+
export { UnsupportedFeatureError } from "./platform.js";
|
|
7
|
+
export type { BackendResponse, CacheDecision, CacheEntry, CacheOutcome, PipelineOptions, PipelineResponse, PipelineResult, } from "./runtime/pipeline.js";
|
|
8
|
+
export { runPipeline } from "./runtime/pipeline.js";
|
|
9
|
+
export { createVCLContext, executeVCL, executeVCLByName, loadVCLContent } from "./vcl.js";
|
|
10
|
+
export type { VCLContext, VCLSubroutines } from "./vcl-compiler.js";
|