serceman / firewalker Goto Github PK
View Code? Open in Web Editor NEWTesting framework for Cloudflare Firewall rules
License: MIT License
Testing framework for Cloudflare Firewall rules
License: MIT License
When running firewalker on Node 14 or 16, firewalker will throw an error. Node <= 12 or >= 17.4.0 does not have this issue.
This is likely caused by node-ffi-napi/ref-napi#47.
Results of yarn test
:
qantas94heavy@MBP % yarn test
yarn run v1.22.18
$ jest
RUNS test/firewall.tests.ts
#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x7ff7bfef45d0
1: 0x100124c02 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
2: 0x10104fca3 V8_Fatal(char const*, ...) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
3: 0x1004ee80d v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
4: 0x100213a06 v8::ArrayBuffer::GetBackingStore() [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
5: 0x1000750ee napi_get_typedarray_info [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
6: 0x104a4a981 (anonymous namespace)::GetBufferData(Napi::Value) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
7: 0x104a4bdd5 (anonymous namespace)::AddressForArgs(Napi::CallbackInfo const&, unsigned long) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
8: 0x104a49072 (anonymous namespace)::WritePointer(Napi::CallbackInfo const&) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
9: 0x104a4c7ef napi_value__* Napi::details::WrapCallback<Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*)::'lambda'()>(Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*)::'lambda'()) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
10: 0x104a4c78d Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
11: 0x100076a08 v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
12: 0x100272048 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
13: 0x1002715dc v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
14: 0x100270d42 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
15: 0x100a8e8d9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
Either run yarn test
or (intermittently) the following script:
const { Firewall, Request } = require('firewalker');
const firewall = new Firewall();
const rule = firewall.createRule(`
http.host eq "www.example.org"
`);
// Expected: true
// Actual: Node.js crashes (intermittent)
rule.match(new Request('http://www.example.org'));
Related: node-ffi-napi/ref-napi#47
Related: nodejs/node#32463
Related: nodejs/node#43617
I'd love to use this tool, but I'm running into issues left and right (mostly around header value matching) - are the unit tests passing on your end? I'm not very familiar with yarn projects, so maybe it's a misconfiguration in my local setup.
I cloned down the repo and get these results when running the test suite:
Test Suites: 1 failed, 1 total
Tests: 26 failed, 17 passed, 43 total
Snapshots: 0 total
Time: 35.312 s
Ran all test suites.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.