Skip to content

feat: add JavaScript implementation of ngwaf-compute-interface#32

Open
Copilot wants to merge 1 commit intomainfrom
copilot/create-ngwaf-compute-interface-javascript
Open

feat: add JavaScript implementation of ngwaf-compute-interface#32
Copilot wants to merge 1 commit intomainfrom
copilot/create-ngwaf-compute-interface-javascript

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Summary

Creates a JavaScript Fastly Compute implementation of the existing Rust ngwaf-compute-interface service in a new ngwaf-compute-interface-javascript/ directory, using version 3.40.1 of the @fastly/js-compute SDK.

Changes

  • src/index.js – Main entry point implementing the same logic as the Rust service:
    • Validates cdn-secret header (returns 403 if missing/wrong)
    • Reads corp and workspace from the ngwaf Config Store
    • Optionally overrides client IP from the x-source-ip header
    • Calls inspect() from fastly:security
    • Returns a JSON body and waf-info header with decision time, request ID, agent response, tags, and verdict
    • Status code is passed through if in 200–499 range, otherwise returns 500
  • package.json – Declares @fastly/js-compute@3.40.1 as a dev dependency with build and deploy scripts
  • fastly.toml – JavaScript compute manifest with the same ngwaf config store setup (including local server defaults) as the Rust version
  • README.md – Full documentation mirroring the Rust README
  • .gitignore – Ignores bin/ and node_modules/

Testing

The project builds successfully with npm run build (compiles to WASM via js-compute-runtime).

Agent-Logs-Url: https://github.com/fastly/security-use-cases/sessions/731a42dd-116b-4854-87b1-a5a15b0963fd

Co-authored-by: BrooksCunningham <22921241+BrooksCunningham@users.noreply.github.com>
@BrooksCunningham
Copy link
Copy Markdown
Collaborator

@rabdelazim Can you review this implementation?

@BrooksCunningham BrooksCunningham marked this pull request as ready for review April 2, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants