net-snmp 3.26.3 → 3.28.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.
@@ -1,68 +0,0 @@
1
- ---
2
- name: publish-release
3
- description: Publish the currently-committed release by pushing master to origin, publishing to npm, tagging the commit with the package.json version, and pushing the tag. Use when the user asks to "publish the release", "push and publish", or invokes /publish-release. Stops immediately on any failure.
4
- ---
5
-
6
- # Publish Release
7
-
8
- ## When to use
9
-
10
- - After `/prepare-release` and the release commit have both been completed — this skill assumes the release commit (version bump + README entry + fix) is already `HEAD` on `master`.
11
- - User asks to publish / ship / release to npm.
12
- - User invokes `/publish-release`.
13
-
14
- Run after `/prepare-release` + `/git-commit`, never in place of them. This skill does not run lint, tests, or modify any files.
15
-
16
- ## Workflow
17
-
18
- Run steps in order. **If any step fails, stop immediately, report the failure, and do not proceed.** There is no rollback — each step is externally observable (a push, a publish, a tag on origin), so a mid-flight failure leaves the release in a partial state the user will need to reason about. Be explicit about which steps succeeded and which did not.
19
-
20
- ### 1. Pre-flight checks (parallel)
21
-
22
- - `git rev-parse --abbrev-ref HEAD` — confirm the current branch is `master`. If not, stop and ask the user.
23
- - `git status --short` — confirm the working tree is clean. If not, stop — the release commit must already exist as `HEAD`, with nothing else pending.
24
- - Read the current version from `package.json` (this becomes the tag name).
25
- - `git tag --list <version>` — confirm the tag does not already exist locally. If it does, stop.
26
- - `git ls-remote --tags origin refs/tags/<version>` — confirm the tag does not already exist on the remote. If it does, stop.
27
- - `git log -1 --format=%s` — capture the subject of the HEAD commit for the summary.
28
-
29
- ### 2. Push master to origin
30
-
31
- Run `git push origin master`. **Stop on non-zero exit.** Report the output.
32
-
33
- ### 3. Publish to npm
34
-
35
- Run `npm publish`. **Stop on non-zero exit.**
36
-
37
- Notes:
38
- - If the registry prompts for a one-time password (2FA OTP), relay the prompt to the user and wait for their input. Do not attempt to bypass 2FA.
39
- - If the registry rejects with `403` or `You do not have permission`, stop and surface the full error — the user may need to `npm login` or check their credentials.
40
- - If the registry rejects with `You cannot publish over the previously published versions`, stop — the version was not bumped correctly upstream of this skill.
41
-
42
- ### 4. Tag the release
43
-
44
- Tags in this repo are bare version numbers (no `v` prefix) — verified against the existing tag list.
45
-
46
- Run `git tag <version>` where `<version>` is the exact value read from `package.json` in step 1 (e.g., `3.26.2`, not `v3.26.2`).
47
-
48
- **Stop on non-zero exit.**
49
-
50
- ### 5. Push the tag
51
-
52
- Run `git push origin <version>`. **Stop on non-zero exit.**
53
-
54
- ### 6. Summary
55
-
56
- Report to the user, concisely:
57
- - The version that was published.
58
- - Confirmation of: master pushed, npm publish succeeded, tag created, tag pushed.
59
- - The release commit subject (from pre-flight).
60
- - The npm package URL, if it can be derived from `package.json` name (`https://www.npmjs.com/package/<name>`).
61
-
62
- ## Things to watch for
63
-
64
- - If step 2 (push master) succeeds but step 3 (npm publish) fails, the commit is on GitHub but not on npm. Do not tag — the user must either resolve the npm issue and re-run publish, or roll back the push.
65
- - If step 3 (npm publish) succeeds but step 4 (tag) or step 5 (tag push) fails, the package is on npm but not tagged. Surface this clearly — the user needs to manually create / push the tag, and an un-tagged published release is a fix-it-now situation, not something to leave for later.
66
- - Never use `--force`, `--no-verify`, or any flag that bypasses checks, even to recover from a mid-flight failure. Always ask the user.
67
- - Never create or push tags for versions other than the one in `package.json`.
68
- - Never run this skill on a branch other than `master` without explicit user confirmation.
@@ -1 +0,0 @@
1
- github: [markabrahams]
package/.travis.yml DELETED
@@ -1,13 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - lts/*
4
- - 20
5
- - 18
6
- - 16
7
- - 14
8
- - 12
9
- - 10
10
- - 8
11
-
12
- script:
13
- - npm run lint
@@ -1,249 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "node",
9
- "request": "launch",
10
- "name": "SNMP community get",
11
- "skipFiles": ["<node_internals>/**"],
12
- "program": "${workspaceFolder}/example/snmp-get.js",
13
- "args": ["-v", "2c", "-c", "public", "-s", "1162", "127.0.0.1", "1.3.6.1.2.1.31.1.1.1.6.1"]
14
- },
15
- {
16
- "type": "node",
17
- "request": "launch",
18
- "name": "SNMP user get",
19
- "skipFiles": ["<node_internals>/**"],
20
- "program": "${workspaceFolder}/example/snmp-get.js",
21
- "args": [
22
- "-d",
23
- "-v",
24
- "3",
25
- "-l",
26
- "authPriv",
27
- "-u",
28
- "wilma",
29
- "-a",
30
- "sha",
31
- "-A",
32
- "illhavesomeauth",
33
- "-x",
34
- "des",
35
- "-X",
36
- "andsomepriv",
37
- "127.0.0.1",
38
- "1.3.6.1.2.1.1.1.0"
39
- ]
40
- },
41
- {
42
- "type": "node",
43
- "request": "launch",
44
- "name": "SNMP community get bulk",
45
- "skipFiles": ["<node_internals>/**"],
46
- "program": "${workspaceFolder}/example/snmp-get-bulk.js",
47
- "args": ["-v", "2c", "-c", "public", "-o", "1", "-r", "20", "127.0.0.1", "1.3.6.1.2.1.1.9", "1.3.6.1.2.1.2"]
48
- },
49
- {
50
- "type": "node",
51
- "request": "launch",
52
- "name": "SNMP community subtree",
53
- "skipFiles": ["<node_internals>/**"],
54
- "program": "${workspaceFolder}/example/snmp-subtree.js",
55
- "args": ["-v", "2c", "-c", "public", "127.0.0.1", "1.3.6.1.6.3.16.1.5.2.1.6.9"]
56
- },
57
- {
58
- "type": "node",
59
- "request": "launch",
60
- "name": "SNMP community walk",
61
- "skipFiles": ["<node_internals>/**"],
62
- "program": "${workspaceFolder}/example/snmp-walk.js",
63
- "args": ["-v", "2c", "-c", "public", "127.0.0.1", "1.3.6.1.6.3.16.1.5.2.1.6.9"]
64
- },
65
- {
66
- "type": "node",
67
- "request": "launch",
68
- "name": "SNMP user walk",
69
- "skipFiles": ["<node_internals>/**"],
70
- "program": "${workspaceFolder}/example/snmp-walk.js",
71
- "args": ["-v", "3", "-u", "noauth", "-l", "noAuthNoPriv", "127.0.0.1", "1.3.6.1.6.3.16.1.5"]
72
- },
73
- {
74
- "type": "node",
75
- "request": "launch",
76
- "name": "SNMP community set",
77
- "skipFiles": ["<node_internals>/**"],
78
- "program": "${workspaceFolder}/example/snmp-set.js",
79
- "args": ["-v", "2c", "-c", "private", "127.0.0.1", "1.3.6.1.2.1.1.7.0", "Integer", "40"]
80
- },
81
- {
82
- "type": "node",
83
- "request": "launch",
84
- "name": "SNMP community trap",
85
- "skipFiles": ["<node_internals>/**"],
86
- "program": "${workspaceFolder}/example/snmp-trap.js",
87
- "args": ["-v", "2c", "-c", "public", "127.0.0.1", "1.3.6.1.6.3.1.1.5.1"]
88
- },
89
- {
90
- "type": "node",
91
- "request": "launch",
92
- "name": "SNMP user trap",
93
- "skipFiles": ["<node_internals>/**"],
94
- "program": "${workspaceFolder}/example/snmp-trap.js",
95
- "args": [
96
- "-e",
97
- "0x010203040a",
98
- "-v",
99
- "3",
100
- "-u",
101
- "barney",
102
- "-l",
103
- "authPriv",
104
- "-a",
105
- "sha",
106
- "-A",
107
- "illhavesomeauth",
108
- "-x",
109
- "aes",
110
- "-X",
111
- "andsomepriv",
112
- "127.0.0.1",
113
- "1.3.6.1.6.3.1.1.5.1"
114
- ]
115
- },
116
- {
117
- "type": "node",
118
- "request": "launch",
119
- "name": "SNMP user inform",
120
- "skipFiles": ["<node_internals>/**"],
121
- "program": "${workspaceFolder}/example/snmp-inform.js",
122
- "args": [
123
- "-v",
124
- "3",
125
- "-u",
126
- "informerpriv",
127
- "-l",
128
- "authPriv",
129
- "-a",
130
- "md5",
131
- "-A",
132
- "testing123",
133
- "-x",
134
- "des",
135
- "-X",
136
- "testing123",
137
- "127.0.0.1",
138
- "1.3.6.1.6.3.1.1.5.1"
139
- ]
140
- },
141
- {
142
- "type": "node",
143
- "request": "launch",
144
- "name": "SNMP user table columns",
145
- "skipFiles": ["<node_internals>/**"],
146
- "program": "${workspaceFolder}/example/snmp-table-columns.js",
147
- "args": [
148
- "-v",
149
- "3",
150
- "-u",
151
- "wilma",
152
- "-l",
153
- "authPriv",
154
- "-a",
155
- "sha",
156
- "-A",
157
- "illhavesomeauth",
158
- "-x",
159
- "des",
160
- "-X",
161
- "andsomepriv",
162
- "127.0.0.1",
163
- "1.3.6.1.2.1.2.2",
164
- "2"
165
- ]
166
- },
167
- {
168
- "type": "node",
169
- "request": "launch",
170
- "name": "SNMP receiver",
171
- "skipFiles": ["<node_internals>/**"],
172
- "program": "${workspaceFolder}/example/snmp-receiver.js",
173
- "args": ["-p", "162"]
174
- },
175
- {
176
- "type": "node",
177
- "request": "launch",
178
- "name": "Receiver LCD",
179
- "skipFiles": ["<node_internals>/**"],
180
- "program": "${workspaceFolder}/example/receiver-lcd.js"
181
- },
182
- {
183
- "type": "node",
184
- "request": "launch",
185
- "name": "AgentX subagent",
186
- "skipFiles": ["<node_internals>/**"],
187
- "program": "${workspaceFolder}/example/agentx-subagent.js",
188
- "args": ["-d"]
189
- },
190
- {
191
- "type": "node",
192
- "request": "launch",
193
- "name": "SNMP agent",
194
- "skipFiles": ["<node_internals>/**"],
195
- "program": "${workspaceFolder}/example/snmp-agent.js",
196
- "args": [
197
- //"-d",
198
- "-p",
199
- "1161"
200
- ]
201
- },
202
- {
203
- "type": "node",
204
- "request": "launch",
205
- "name": "MIB parser",
206
- "skipFiles": ["<node_internals>/**"],
207
- "program": "${workspaceFolder}/example/mib-parser.js",
208
- "args": ["-n", "-p", "1161"]
209
- },
210
- {
211
- "type": "node",
212
- "request": "launch",
213
- "name": "SNMP proxy",
214
- "skipFiles": ["<node_internals>/**"],
215
- "program": "${workspaceFolder}/example/snmp-proxy.js",
216
- "args": ["-p", "1161"]
217
- },
218
- {
219
- "type": "node",
220
- "request": "launch",
221
- "name": "test",
222
- "skipFiles": ["<node_internals>/**"],
223
- "program": "${workspaceFolder}/example/test.js",
224
- "args": ["-p", "1161"]
225
- },
226
- {
227
- "type": "node",
228
- "request": "attach",
229
- "name": "SNMP attach",
230
- "port": 9222,
231
- "skipFiles": ["<node_internals>/**"]
232
- },
233
- {
234
- "type": "node",
235
- "request": "launch",
236
- "name": "Mocha",
237
- "program": "${workspaceFolder}/node_modules/mocha/bin/mocha.js",
238
- "args": [
239
- "--timeout",
240
- "999999",
241
- "--colors",
242
- "${workspaceFolder}/test/**/*.test.js" // Adjust the test file pattern
243
- ],
244
- "internalConsoleOptions": "openOnSessionStart",
245
- "cwd": "${workspaceFolder}",
246
- "skipFiles": ["<node_internals>/**"]
247
- }
248
- ]
249
- }
package/eslint.config.js DELETED
@@ -1,98 +0,0 @@
1
- module.exports = [
2
- {
3
- files: ['**/*.js'],
4
- languageOptions: {
5
- ecmaVersion: 2020,
6
- sourceType: 'module',
7
- globals: {
8
- // Browser globals
9
- window: 'readonly',
10
- document: 'readonly',
11
- navigator: 'readonly',
12
-
13
- // Node.js globals
14
- require: 'readonly',
15
- module: 'readonly',
16
- process: 'readonly',
17
- __dirname: 'readonly',
18
- __filename: 'readonly',
19
- console: 'readonly',
20
- exports: 'readonly',
21
- Buffer: 'readonly',
22
- setInterval: 'readonly',
23
- setTimeout: 'readonly',
24
- clearInterval: 'readonly',
25
- clearTimeout: 'readonly',
26
- setImmediate: 'readonly',
27
- clearImmediate: 'readonly',
28
-
29
- // Mocha globals
30
- describe: 'readonly',
31
- it: 'readonly',
32
- xit: 'readonly',
33
- before: 'readonly',
34
- after: 'readonly',
35
- beforeEach: 'readonly',
36
- afterEach: 'readonly',
37
-
38
- // ES6 globals
39
- Promise: 'readonly',
40
- Set: 'readonly',
41
- Map: 'readonly',
42
-
43
- // User-defined globals
44
- $: 'readonly',
45
- System: 'readonly',
46
- expect: 'readonly',
47
- },
48
- },
49
- linterOptions: {
50
- reportUnusedDisableDirectives: true,
51
- },
52
- rules: {
53
- 'accessor-pairs': 'error',
54
- 'arrow-spacing': 'error',
55
- 'brace-style': ['error', '1tbs', { allowSingleLine: true }],
56
- camelcase: ['error', { properties: 'never' }],
57
- 'comma-spacing': ['error', { before: false, after: true }],
58
- 'eol-last': ['error', 'always'],
59
- 'key-spacing': ['error', { beforeColon: false, afterColon: true, mode: 'minimum' }],
60
- 'keyword-spacing': ['error', {}],
61
- 'no-cond-assign': 'error',
62
- 'no-console': ['off', { allow: ['warn', 'error'] }],
63
- 'no-constant-condition': ['error', { checkLoops: false }],
64
- 'no-eval': 'error',
65
- 'no-fallthrough': 'off',
66
- 'no-mixed-spaces-and-tabs': 'error',
67
- 'no-restricted-globals': ['error', 'event'],
68
- 'no-restricted-syntax': [
69
- 'error',
70
- {
71
- selector:
72
- "*:not(ExpressionStatement) > CallExpression[callee.property.name='sort']:not([callee.object.type='CallExpression']):not([callee.object.type='ArrayExpression']):not([callee.object.name='mongoUtil'])",
73
- message:
74
- 'Restricted Array Mutation: Use `array.slice().sort(...)` if mutation was not intended, otherwise place on own line.',
75
- },
76
- {
77
- selector:
78
- "*:not(ExpressionStatement) > CallExpression[callee.property.name='reverse']:not([callee.object.type='CallExpression']):not([callee.object.type='ArrayExpression'])",
79
- message:
80
- 'Restricted Array Mutation: Use `array.slice().reverse(...)` if mutation was not intended, otherwise place on own line.',
81
- },
82
- {
83
- selector: "*:not(ExpressionStatement) > CallExpression[callee.property.name='push']",
84
- message:
85
- 'Restricted Array Mutation: `array.push(...)` returns push count, not array reference, place statement on own line.',
86
- },
87
- ],
88
- 'no-undef': 'error',
89
- 'no-unused-expressions': 'error',
90
- 'no-unused-vars': ['error', { vars: 'all', args: 'none' }],
91
- 'no-useless-escape': 'off',
92
- 'no-with': 'error',
93
- 'padding-line-between-statements': ['error', { blankLine: 'always', prev: '*', next: 'function' }],
94
- semi: ['error', 'always'],
95
- 'space-before-blocks': ['error', 'always'],
96
- },
97
- },
98
- ];
package/example/test.js DELETED
@@ -1,70 +0,0 @@
1
- /* eslint-disable no-unused-vars */
2
-
3
- var snmp = require ("../");
4
- var getopts = require ("getopts");
5
-
6
- var options = getopts(process.argv.slice(2));
7
- var providers;
8
- var mibDir = '/var/tmp/mibs/';
9
-
10
- var counter64 = function (num) {
11
- var buf = Buffer.alloc (4);
12
- buf.writeUInt32BE (num);
13
- return buf;
14
- };
15
-
16
- var snmpOptions = {
17
- disableAuthorization: options.n,
18
- port: options.p,
19
- engineID: options.e,
20
- debug: options.d
21
- };
22
-
23
- var callback = function (error, data) {
24
- if ( error ) {
25
- console.error (error);
26
- } else {
27
- console.log (data.pdu.varbinds[0].oid);
28
- }
29
- };
30
-
31
- var store = snmp.createModuleStore ();
32
- var agent = snmp.createAgent (snmpOptions, callback);
33
- var mib = agent.getMib ();
34
-
35
- var authorizer = agent.getAuthorizer ();
36
- authorizer.addCommunity ("public");
37
-
38
- // IF-MIB load and providers registration
39
- store.loadFromFile (mibDir + "IANAifType-MIB.mib");
40
- store.loadFromFile (mibDir + "IF-MIB.mib");
41
- store.loadFromFile (mibDir + "HOST-RESOURCES-MIB.MIB");
42
- store.loadFromFile (mibDir + "IANA-PRINTER-MIB.mib");
43
- store.loadFromFile (mibDir + "IANA-CHARSET-MIB.mib");
44
- store.loadFromFile (mibDir + "PRINTER-MIBv1.mib");
45
- store.loadFromFile (mibDir + "JOB-MONITORING-MIB-RFC.mib");
46
- store.loadFromFile (mibDir + "NETSURE-MIB-001-B.mib");
47
-
48
- // const mibModuleOid = store.translate('1.3.6.1.4.1', snmp.OidFormat.module);
49
- // console.log('mibModuleOid: ', mibModuleOid);
50
- // const mibOid = store.translate('Job-Monitoring-MIB::jmJobTable', snmp.OidFormat.oid);
51
- // console.log('mibOid: ', mibOid);
52
- console.log(store.translate('Job-Monitoring-MIB::jmJobTable', snmp.OidFormat.oid));
53
- console.log(store.translate('Job-Monitoring-MIB::jmJobTable', snmp.OidFormat.path));
54
- console.log(store.translate('1.3.6.1.4.1.2699.1.1.1.3.1', snmp.OidFormat.path));
55
- console.log(store.translate('1.3.6.1.4.1.2699.1.1.1.3.1', snmp.OidFormat.module));
56
- console.log(store.translate('iso.org.dod.internet.private.enterprises.pwg.mibs.jobmonMIB.jobmonMIBObjects.jmJob.jmJobTable', snmp.OidFormat.oid));
57
- console.log(store.translate('iso.org.dod.internet.private.enterprises.pwg.mibs.jobmonMIB.jobmonMIBObjects.jmJob.jmJobTable', snmp.OidFormat.module));
58
-
59
- // ifNumber
60
- // Scalar type - setScalarValue() and getScalarValue() are the entire API for these
61
-
62
- // console.log("All modules: ", JSON.stringify(modules, '', 2));
63
- // const jobModule = store.getModule('Job-Monitoring-MIB');
64
- // console.log('jobModule: ', JSON.stringify(jobModule, null, 2));
65
-
66
- // print IF-MIB
67
- // const ifModule = store.getModule('IF-MIB');
68
- // console.log('ifModule: ', JSON.stringify(ifModule, null, 2));
69
- const nsModule = store.getModule('NETSURE-MIB-001-B');
70
- console.log('nsModule: ', JSON.stringify(nsModule, null, 2));
@@ -1,76 +0,0 @@
1
- # SNMPv3 Authentication Failure Handling Test Coverage (RFC 3414 §3.2)
2
-
3
- This document describes the test coverage added for PR #289 which implements RFC 3414 §3.2 compliant SNMPv3 authentication failure handling.
4
-
5
- ## Test File: `snmpv3-auth-failures.test.js`
6
-
7
- ### Coverage Areas
8
-
9
- #### 1. Report PDU Generation
10
- - ✅ Tests Report PDU creation with `UNKNOWN_USER_NAME` for unknown users
11
- - ✅ Tests Report PDU creation with `WRONG_DIGESTS` for authentication level mismatches
12
- - ✅ Tests Report PDU creation with `UNKNOWN_ENGINE_ID` for discovery requests
13
- - ✅ Verifies original message ID preservation in Report PDUs
14
- - ✅ Validates correct security parameters in Report PDUs
15
- - ✅ Tests graceful handling of missing/invalid error types
16
-
17
- #### 2. USM Statistics Counter Compliance
18
- - ✅ Verifies correct USM statistics OIDs (`1.3.6.1.6.3.15.1.1.X.0`)
19
- - ✅ Tests proper Counter32 type and value (1) in varbinds
20
- - ✅ Maps all RFC 3414 error types to correct OID suffixes
21
-
22
- #### 3. Reportable Flag Handling
23
- - ✅ Tests reportable flag setting and retrieval
24
- - ✅ Validates message flag bit manipulation (bit 2 = reportable)
25
-
26
- #### 4. Integration Testing
27
- - ✅ Tests receiver/authorizer setup with known users
28
- - ✅ Validates integration with existing authentication framework
29
-
30
- #### 5. Edge Cases
31
- - ✅ Empty user name handling
32
- - ✅ Authentication parameters in messages
33
- - ✅ Privacy parameters in messages
34
- - ✅ Error type constant definitions
35
-
36
- ### RFC 3414 §3.2 Compliance Verification
37
-
38
- The tests verify compliance with specific RFC 3414 requirements:
39
-
40
- | RFC Section | Requirement | Test Coverage |
41
- |------------|-------------|---------------|
42
- | §3.2 Step 4 | Use `usmStatsUnknownUserNames` for unknown users | ✅ |
43
- | §3.2 Step 5 | Use `usmStatsWrongDigests` for security level mismatches | ✅ |
44
- | Discovery | Use `usmStatsUnknownEngineIDs` for engine discovery | ✅ |
45
- | Report PDU | Include correct Counter32 OID and value | ✅ |
46
- | Message ID | Preserve original message ID in reports | ✅ |
47
- | Security | Use empty security parameters in reports | ✅ |
48
-
49
- ### Test Strategy
50
-
51
- The tests use a mock-based approach since many internal classes (`UsmErrorType`, `Authorizer`, etc.) are not exported by the module. This approach:
52
-
53
- 1. **Mirrors actual implementation** - Uses the same constants and logic as PR #289
54
- 2. **Tests public interface** - Works with exported functions like `createReceiver`
55
- 3. **Validates RFC compliance** - Ensures correct OID construction and counter values
56
- 4. **Covers edge cases** - Tests error conditions and boundary cases
57
-
58
- ### Usage
59
-
60
- Run the specific tests:
61
- ```bash
62
- npm test -- --grep "SNMPv3 Authentication Failure Handling"
63
- ```
64
-
65
- Run all tests to ensure no regressions:
66
- ```bash
67
- npm test
68
- ```
69
-
70
- ### Benefits
71
-
72
- These tests provide:
73
- - **Regression prevention** - Catches changes that break RFC compliance
74
- - **Documentation** - Shows how the authentication failure handling works
75
- - **Quality assurance** - Ensures proper error reporting to SNMP managers
76
- - **Maintenance confidence** - Allows safe refactoring of authentication code