Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit cc5e123

Browse files
committed
Merge remote-tracking branch 'origin/topic/timw/include-zeekjs-in-docs-by-default'
* origin/topic/timw/include-zeekjs-in-docs-by-default: Ignore double-backtick warning from ZeekJS __load__.zeek.rst Update docs to add ZeekJS
2 parents e6d259b + 2973abd commit cc5e123

File tree

12 files changed

+175
-2
lines changed

12 files changed

+175
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ repos:
1515
stages: ["pre-commit"]
1616
- id: rst-backticks
1717
stages: ["pre-commit"]
18+
exclude: 'scripts/builtin-plugins/Zeek_JavaScript/__load__.zeek.rst'

script-reference/autogenerated-package-index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@
393393
:doc:`builtin-plugins/Zeek_AF_Packet </scripts/builtin-plugins/Zeek_AF_Packet/index>`
394394

395395

396+
:doc:`builtin-plugins/Zeek_JavaScript </scripts/builtin-plugins/Zeek_JavaScript/index>`
397+
398+
396399
:doc:`zeekygen </scripts/zeekygen/index>`
397400

398401
This package is loaded during the process which automatically generates

script-reference/autogenerated-protocol-analyzer-index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5411,6 +5411,16 @@ Events
54115411

54125412
:param c: The connection.
54135413

5414+
.. _plugin-zeek-javascript:
5415+
5416+
Zeek::JavaScript
5417+
----------------
5418+
5419+
Experimental JavaScript support for Zeek
5420+
5421+
Components
5422+
++++++++++
5423+
54145424
.. _plugin-zeek-krb:
54155425

54165426
Zeek::KRB

script-reference/autogenerated-script-index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@
283283
base/bif/plugins/Zeek_NoneWriter.none.bif.zeek </scripts/base/bif/plugins/Zeek_NoneWriter.none.bif.zeek>
284284
base/bif/plugins/Zeek_SQLiteWriter.sqlite.bif.zeek </scripts/base/bif/plugins/Zeek_SQLiteWriter.sqlite.bif.zeek>
285285
base/bif/plugins/Zeek_AF_Packet.af_packet.bif.zeek </scripts/base/bif/plugins/Zeek_AF_Packet.af_packet.bif.zeek>
286+
base/bif/plugins/Zeek_JavaScript.zeekjs.bif.zeek </scripts/base/bif/plugins/Zeek_JavaScript.zeekjs.bif.zeek>
286287
base/frameworks/spicy/init-framework.zeek </scripts/base/frameworks/spicy/init-framework.zeek>
287288
base/init-default.zeek </scripts/base/init-default.zeek>
288289
base/utils/active-http.zeek </scripts/base/utils/active-http.zeek>
@@ -504,6 +505,7 @@
504505
builtin-plugins/__load__.zeek </scripts/builtin-plugins/__load__.zeek>
505506
builtin-plugins/Zeek_AF_Packet/__load__.zeek </scripts/builtin-plugins/Zeek_AF_Packet/__load__.zeek>
506507
builtin-plugins/Zeek_AF_Packet/init.zeek </scripts/builtin-plugins/Zeek_AF_Packet/init.zeek>
508+
builtin-plugins/Zeek_JavaScript/__load__.zeek </scripts/builtin-plugins/Zeek_JavaScript/__load__.zeek>
507509
zeekygen/__load__.zeek </scripts/zeekygen/__load__.zeek>
508510
test-all-policy.zeek </scripts/test-all-policy.zeek>
509511
policy/frameworks/cluster/backend/zeromq/__load__.zeek </scripts/policy/frameworks/cluster/backend/zeromq/__load__.zeek>

scripts/base/bif/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,3 +555,6 @@ Package: base/bif
555555
:doc:`/scripts/base/bif/plugins/Zeek_AF_Packet.af_packet.bif.zeek`
556556

557557

558+
:doc:`/scripts/base/bif/plugins/Zeek_JavaScript.zeekjs.bif.zeek`
559+
560+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
:tocdepth: 3
2+
3+
base/bif/plugins/Zeek_JavaScript.zeekjs.bif.zeek
4+
================================================
5+
.. zeek:namespace:: GLOBAL
6+
7+
8+
:Namespace: GLOBAL
9+
10+
Summary
11+
~~~~~~~
12+
13+
Detailed Interface
14+
~~~~~~~~~~~~~~~~~~
15+

scripts/base/bif/plugins/__load__.zeek.rst

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

scripts/base/bif/plugins/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,6 @@ Package: base/bif/plugins
401401
:doc:`/scripts/base/bif/plugins/Zeek_AF_Packet.af_packet.bif.zeek`
402402

403403

404+
:doc:`/scripts/base/bif/plugins/Zeek_JavaScript.zeekjs.bif.zeek`
405+
406+
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
:tocdepth: 3
2+
3+
builtin-plugins/Zeek_JavaScript/__load__.zeek
4+
=============================================
5+
.. zeek:namespace:: JavaScript
6+
7+
8+
:Namespace: JavaScript
9+
10+
Summary
11+
~~~~~~~
12+
Redefinable Options
13+
###################
14+
========================================================================================= =====================================================================
15+
:zeek:id:`JavaScript::exit_on_uncaught_exceptions`: :zeek:type:`bool` :zeek:attr:`&redef` Node.js default behavior is to exit a process on uncaught exceptions.
16+
:zeek:id:`JavaScript::files`: :zeek:type:`vector` :zeek:attr:`&redef` Vector of filenames to compile/execute after the bootstrap file.
17+
:zeek:id:`JavaScript::initial_heap_size_in_bytes`: :zeek:type:`count` :zeek:attr:`&redef` Be very conservative.
18+
:zeek:id:`JavaScript::main_script_source`: :zeek:type:`string` :zeek:attr:`&redef` The Javascript code executed for bootstrapping.
19+
:zeek:id:`JavaScript::maximum_heap_size_in_bytes`: :zeek:type:`count` :zeek:attr:`&redef`
20+
:zeek:id:`JavaScript::owns_node_inspector`: :zeek:type:`bool` :zeek:attr:`&redef` If set to T, installs a SIGUSR1 handler and thread to
21+
start the Node.js / V8 inspector.
22+
:zeek:id:`JavaScript::owns_process_state`: :zeek:type:`bool` :zeek:attr:`&redef` Allows to change process state (uid, title, cwd, ...).
23+
:zeek:id:`JavaScript::thread_pool_size`: :zeek:type:`count` :zeek:attr:`&redef`
24+
========================================================================================= =====================================================================
25+
26+
27+
Detailed Interface
28+
~~~~~~~~~~~~~~~~~~
29+
Redefinable Options
30+
###################
31+
.. zeek:id:: JavaScript::exit_on_uncaught_exceptions
32+
:source-code: builtin-plugins/Zeek_JavaScript/__load__.zeek 62 62
33+
34+
:Type: :zeek:type:`bool`
35+
:Attributes: :zeek:attr:`&redef`
36+
:Default: ``T``
37+
38+
Node.js default behavior is to exit a process on uncaught exceptions.
39+
Specifically exceptions in timer callbacks are problematic as a throwing
40+
timer callback may break subsequently scheduled timers.
41+
42+
Set this to F in order to just keep going when errors happen. Note,
43+
if you see any Uncaught errors, this likely means the Javascript
44+
state is corrupt.
45+
46+
.. zeek:id:: JavaScript::files
47+
:source-code: builtin-plugins/Zeek_JavaScript/__load__.zeek 48 48
48+
49+
:Type: :zeek:type:`vector` of :zeek:type:`string`
50+
:Attributes: :zeek:attr:`&redef`
51+
:Default:
52+
53+
::
54+
55+
[]
56+
57+
58+
Vector of filenames to compile/execute after the bootstrap file.
59+
60+
.. zeek:id:: JavaScript::initial_heap_size_in_bytes
61+
:source-code: builtin-plugins/Zeek_JavaScript/__load__.zeek 51 51
62+
63+
:Type: :zeek:type:`count`
64+
:Attributes: :zeek:attr:`&redef`
65+
:Default: ``67108864``
66+
67+
Be very conservative.
68+
69+
.. zeek:id:: JavaScript::main_script_source
70+
:source-code: builtin-plugins/Zeek_JavaScript/__load__.zeek 12 12
71+
72+
:Type: :zeek:type:`string`
73+
:Attributes: :zeek:attr:`&redef`
74+
:Default: ``"const module_mod = require('module')\x0aconst publicRequire = module_mod.createRequire(process.cwd() + '/');\x0aglobalThis.require = publicRequire;\x0a\x0aglobalThis.zeek_javascript_init = async () => {\x0a const zeek = process._linkedBinding('zeekjs').zeek;\x0a // Helper for zeek record rendering.\x0a zeek.flatten = (obj, prefix, res) => {\x0a res = res || {}\x0a for (const k in obj) {\x0a const nk = prefix ? `${prefix}.${k}` : k\x0a const v = obj[k]\x0a\x0a // Recurse for objects, unless it's actually an array, or has a\x0a // custom toJSON() method (which is true for the port objects).\x0a if (v !== null && typeof(v) == 'object' && !Array.isArray(v) && !('toJSON' in v)) {\x0a zeek.flatten(v, nk, res)\x0a } else {\x0a res[nk] = v\x0a }\x0a }\x0a return res\x0a }\x0a\x0a const m = new module_mod();\x0a // Compile a new module that imports all .js files found using import().\x0a //\x0a // https://stackoverflow.com/a/17585470/9044112\x0a return m._compile('const ps = []; zeek.__zeek_javascript_files.forEach((fn) => { ps.push(import(fn)); }); return Promise.all(ps);', process.cwd() + '/');\x0a};\x0a// Add a global zeek object from the linked zeekjs binding\x0aglobalThis.zeek = process._linkedBinding('zeekjs').zeek;\x0a"``
75+
76+
The Javascript code executed for bootstrapping.
77+
This comes fairly straight from the embedding guide to support using
78+
require() with filesystem paths in the process working directory.
79+
80+
https://docs.w3cub.com/node~14_lts/embedding
81+
82+
83+
.. zeek:id:: JavaScript::maximum_heap_size_in_bytes
84+
:source-code: builtin-plugins/Zeek_JavaScript/__load__.zeek 52 52
85+
86+
:Type: :zeek:type:`count`
87+
:Attributes: :zeek:attr:`&redef`
88+
:Default: ``134217728``
89+
90+
91+
.. zeek:id:: JavaScript::owns_node_inspector
92+
:source-code: builtin-plugins/Zeek_JavaScript/__load__.zeek 75 75
93+
94+
:Type: :zeek:type:`bool`
95+
:Attributes: :zeek:attr:`&redef`
96+
:Default: ``F``
97+
98+
If set to T, installs a SIGUSR1 handler and thread to
99+
start the Node.js / V8 inspector.
100+
101+
See Node.js EnvironmentFlags API documentation for details.
102+
https://github.com/nodejs/node/blob/v22.11.0/src/node.h#L631
103+
104+
.. zeek:id:: JavaScript::owns_process_state
105+
:source-code: builtin-plugins/Zeek_JavaScript/__load__.zeek 68 68
106+
107+
:Type: :zeek:type:`bool`
108+
:Attributes: :zeek:attr:`&redef`
109+
:Default: ``F``
110+
111+
Allows to change process state (uid, title, cwd, ...).
112+
113+
See Node.js EnvironmentFlags API documentation for details.
114+
https://github.com/nodejs/node/blob/v22.11.0/src/node.h#L627
115+
116+
.. zeek:id:: JavaScript::thread_pool_size
117+
:source-code: builtin-plugins/Zeek_JavaScript/__load__.zeek 53 53
118+
119+
:Type: :zeek:type:`count`
120+
:Attributes: :zeek:attr:`&redef`
121+
:Default: ``4``
122+
123+
124+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:orphan:
2+
3+
Package: builtin-plugins/Zeek_JavaScript
4+
========================================
5+
6+
7+
:doc:`/scripts/builtin-plugins/Zeek_JavaScript/__load__.zeek`
8+
9+

0 commit comments

Comments
 (0)