@wtasnorg/node-lib 0.0.7 → 0.0.9
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/changelog.txt +26 -0
- package/dev_checklist.txt +56 -0
- package/docs/README.md +15 -32
- package/docs/docs.json +916 -240
- package/docs/functions/createFindDirectories.md +2 -2
- package/docs/functions/decode.md +49 -0
- package/docs/functions/encode.md +45 -0
- package/docs/functions/hello.md +2 -2
- package/docs/functions/parseUserAgent.md +42 -0
- package/docs/functions/pojo.md +2 -2
- package/docs/interfaces/FileSystemDependencies.md +9 -9
- package/docs/interfaces/FindDirectoriesOptions.md +8 -8
- package/docs/interfaces/UserAgentInfo.md +61 -0
- package/docs/type-aliases/Base64CharsetType.md +13 -0
- package/docs/variables/Base64Charset.md +17 -0
- package/eslint.config.js +7 -2
- package/gen-docs/001_base64_refine.txt +50 -0
- package/gen-docs/001_commands.txt +44 -0
- package/gen-docs/001_coverage.txt +43 -0
- package/gen-docs/001_env.txt +33 -0
- package/gen-docs/001_lint.txt +40 -0
- package/gen-docs/001_state.txt +58 -0
- package/gen-docs/002_api.txt +34 -0
- package/gen-docs/002_deps.txt +46 -0
- package/gen-docs/002_errors.txt +34 -0
- package/gen-docs/002_naming.txt +36 -0
- package/gen-docs/002_notes.txt +20 -0
- package/gen-docs/002_purity.txt +36 -0
- package/gen-docs/002_scope.txt +28 -0
- package/gen-docs/002_srp.txt +34 -0
- package/gen-sec/001_base64_security.txt +75 -0
- package/gen-sec/001_commands.txt +65 -0
- package/gen-sec/001_env.txt +28 -0
- package/gen-sec/001_findings.txt +63 -0
- package/gen-sec/001_inventory.txt +41 -0
- package/gen-sec/001_owasp.txt +78 -0
- package/gen-sec/001_scope.txt +44 -0
- package/package.json +3 -2
- package/{README.md → readme.txt} +3 -1
- package/src/base64.d.ts +58 -0
- package/src/base64.js +138 -0
- package/src/base64.test.d.ts +2 -0
- package/src/base64.test.js +106 -0
- package/src/base64.test.ts +125 -0
- package/src/base64.ts +163 -0
- package/src/find.d.ts +4 -4
- package/src/find.js +12 -6
- package/src/find.ts +10 -10
- package/src/index.d.ts +6 -2
- package/src/index.js +3 -1
- package/src/index.ts +11 -1
- package/src/pojo.js +1 -1
- package/src/pojo.test.js +1 -3
- package/src/pojo.test.ts +2 -1
- package/src/pojo.ts +1 -1
- package/src/user-agent.d.ts +48 -0
- package/src/user-agent.js +189 -0
- package/src/user-agent.test.d.ts +2 -0
- package/src/user-agent.test.js +54 -0
- package/src/user-agent.test.ts +60 -0
- package/src/user-agent.ts +199 -0
- package/DEV_CHECKLIST.md +0 -15
- package/docs/_media/LICENSE +0 -21
- package/docs/globals.md +0 -16
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 002 API Surface Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Public Exports (index.ts)
|
|
5
|
+
|
|
6
|
+
- hello
|
|
7
|
+
- pojo
|
|
8
|
+
- createFindDirectories
|
|
9
|
+
- FindDirectoriesOptions (type)
|
|
10
|
+
- FileSystemDependencies (type)
|
|
11
|
+
|
|
12
|
+
## Issues Found
|
|
13
|
+
|
|
14
|
+
### [ISSUE] user-agent.ts - parseUserAgent not exported from index.ts
|
|
15
|
+
|
|
16
|
+
The main UA parsing function is exported from user-agent.ts but NOT re-exported from index.ts.
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
// index.ts - missing:
|
|
20
|
+
import { parseUserAgent, UserAgentInfo } from "./user-agent.js";
|
|
21
|
+
export { parseUserAgent };
|
|
22
|
+
export type { UserAgentInfo };
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Recommendation: Add to public API.
|
|
26
|
+
|
|
27
|
+
### [MINOR] user-agent.ts - Helper functions not exported
|
|
28
|
+
|
|
29
|
+
detectBrowser, detectOS, detectDeviceType, detectEngine are private.
|
|
30
|
+
This is correct - they are implementation details.
|
|
31
|
+
|
|
32
|
+
## Status
|
|
33
|
+
|
|
34
|
+
FAIL - parseUserAgent not in public API.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 002 Dependency Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
Dependencies flow correctly. No circular dependencies. Clean architecture.
|
|
7
|
+
|
|
8
|
+
## Per-Module Analysis
|
|
9
|
+
|
|
10
|
+
### find.ts ✅
|
|
11
|
+
- Imports: node:path (resolve, join)
|
|
12
|
+
- Dependencies injected via factory pattern
|
|
13
|
+
- No framework coupling
|
|
14
|
+
|
|
15
|
+
### hello.ts ✅
|
|
16
|
+
- No imports
|
|
17
|
+
- Uses only global console (acceptable)
|
|
18
|
+
|
|
19
|
+
### pojo.ts ✅
|
|
20
|
+
- No imports
|
|
21
|
+
- Pure utility function
|
|
22
|
+
|
|
23
|
+
### user-agent.ts ✅
|
|
24
|
+
- No imports
|
|
25
|
+
- Pure parsing logic
|
|
26
|
+
|
|
27
|
+
### index.ts ✅
|
|
28
|
+
- Re-exports from modules
|
|
29
|
+
- Clean public API surface
|
|
30
|
+
|
|
31
|
+
## Issues Found
|
|
32
|
+
|
|
33
|
+
### [MINOR] find.ts - Unused `stat` dependency
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
interface FileSystemDependencies {
|
|
37
|
+
readdir: ...
|
|
38
|
+
stat: ... // Declared but never used
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Recommendation: Remove if not planned for use.
|
|
43
|
+
|
|
44
|
+
## Status
|
|
45
|
+
|
|
46
|
+
PASS - Minor cleanup opportunity.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 002 Error Handling Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
Minimal error handling needed. Functions are defensive.
|
|
7
|
+
|
|
8
|
+
## Per-Module Analysis
|
|
9
|
+
|
|
10
|
+
### find.ts ⚠️
|
|
11
|
+
- No explicit error handling for readdir failures
|
|
12
|
+
- Errors will propagate as Promise rejection
|
|
13
|
+
- Acceptable for utility library
|
|
14
|
+
|
|
15
|
+
### hello.ts ✅
|
|
16
|
+
- Guards console access: `if (console?.log)`
|
|
17
|
+
- No errors expected
|
|
18
|
+
|
|
19
|
+
### pojo.ts ✅
|
|
20
|
+
- Pure function, no errors expected
|
|
21
|
+
- Handles non-objects via Object.entries (returns [])
|
|
22
|
+
|
|
23
|
+
### user-agent.ts ✅
|
|
24
|
+
- Defensive null check: `if (!ua) { return defaults }`
|
|
25
|
+
- Optional chaining on split: `?.split(" ")[0] || "0"`
|
|
26
|
+
- All branches return valid defaults
|
|
27
|
+
|
|
28
|
+
## Issues Found
|
|
29
|
+
|
|
30
|
+
None requiring action.
|
|
31
|
+
|
|
32
|
+
## Status
|
|
33
|
+
|
|
34
|
+
PASS - Error handling appropriate for library scope.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 002 Naming Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
Generally good naming. A few opportunities for improvement.
|
|
7
|
+
|
|
8
|
+
## Issues Found
|
|
9
|
+
|
|
10
|
+
### [MINOR] user-agent.ts:193-194 - Unreachable condition
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
if (ua.includes("AppleWebKit")) {return "WebKit";}
|
|
14
|
+
if (ua.includes("Blink") || (ua.includes("Chrome/") && ua.includes("AppleWebKit/"))) {return "Blink";}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The second condition can never be fully reached because "AppleWebKit" already returns "WebKit".
|
|
18
|
+
Chrome uses AppleWebKit but should return "Blink".
|
|
19
|
+
|
|
20
|
+
Recommendation: Reorder conditions - check for Chrome/AppleWebKit combo first.
|
|
21
|
+
|
|
22
|
+
### [OK] find.ts - createFindDirectories
|
|
23
|
+
|
|
24
|
+
Factory name is accurate. Returns findDirectories function.
|
|
25
|
+
|
|
26
|
+
### [OK] pojo.ts - pojo
|
|
27
|
+
|
|
28
|
+
Short but descriptive. Common abbreviation.
|
|
29
|
+
|
|
30
|
+
### [OK] user-agent.ts - detectBrowser, detectOS, etc.
|
|
31
|
+
|
|
32
|
+
Verb prefix indicates action. Clear intent.
|
|
33
|
+
|
|
34
|
+
## Status
|
|
35
|
+
|
|
36
|
+
PASS with one logic issue noted.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 002 Refinement Notes
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Action Items
|
|
5
|
+
|
|
6
|
+
1. **[API]** Export parseUserAgent and UserAgentInfo from index.ts
|
|
7
|
+
2. **[BUG]** Fix detectEngine logic - "Blink" never returned due to ordering
|
|
8
|
+
3. **[CLEANUP]** Consider removing unused `stat` from FileSystemDependencies
|
|
9
|
+
|
|
10
|
+
## Deferred
|
|
11
|
+
|
|
12
|
+
- Coverage improvements (find.js 64.71%) - separate iteration
|
|
13
|
+
|
|
14
|
+
## Summary
|
|
15
|
+
|
|
16
|
+
Code quality is high. Two issues found:
|
|
17
|
+
1. Missing public export (API gap)
|
|
18
|
+
2. Logic bug in detectEngine (Blink detection)
|
|
19
|
+
|
|
20
|
+
Both are low-effort fixes.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 002 Purity & Side-Effect Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
Excellent purity. Side effects isolated and intentional.
|
|
7
|
+
|
|
8
|
+
## Per-Module Analysis
|
|
9
|
+
|
|
10
|
+
### find.ts ✅
|
|
11
|
+
- I/O injected, not hardcoded
|
|
12
|
+
- Pure computation inside walk()
|
|
13
|
+
- Side effects (readdir) at boundary via dependency injection
|
|
14
|
+
|
|
15
|
+
### hello.ts ⚠️
|
|
16
|
+
- console.log is a side effect
|
|
17
|
+
- Mitigated: guarded with `if (console?.log)`
|
|
18
|
+
- Acceptable: function purpose is verification output
|
|
19
|
+
|
|
20
|
+
### pojo.ts ✅
|
|
21
|
+
- Pure function
|
|
22
|
+
- No side effects
|
|
23
|
+
- Deterministic output
|
|
24
|
+
|
|
25
|
+
### user-agent.ts ✅
|
|
26
|
+
- All functions pure
|
|
27
|
+
- String parsing only
|
|
28
|
+
- No I/O, no mutation
|
|
29
|
+
|
|
30
|
+
## Issues Found
|
|
31
|
+
|
|
32
|
+
None requiring action.
|
|
33
|
+
|
|
34
|
+
## Status
|
|
35
|
+
|
|
36
|
+
PASS - Side effects appropriately isolated.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# 002 Scope - Refinement Iteration
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## In Scope
|
|
5
|
+
|
|
6
|
+
Modules:
|
|
7
|
+
- find.ts - Directory traversal factory
|
|
8
|
+
- hello.ts - Library health check
|
|
9
|
+
- pojo.ts - Object conversion utility
|
|
10
|
+
- user-agent.ts - UA string parser
|
|
11
|
+
- index.ts - Public exports
|
|
12
|
+
|
|
13
|
+
## Out of Scope
|
|
14
|
+
|
|
15
|
+
- Test files (*.test.ts)
|
|
16
|
+
- Generated files (*.js, *.d.ts)
|
|
17
|
+
- Build/tooling configuration
|
|
18
|
+
|
|
19
|
+
## Assumptions
|
|
20
|
+
|
|
21
|
+
- Library is functional; tests pass
|
|
22
|
+
- No breaking API changes desired
|
|
23
|
+
- Focus: code quality, not features
|
|
24
|
+
|
|
25
|
+
## Constraints
|
|
26
|
+
|
|
27
|
+
- Must maintain backward compatibility
|
|
28
|
+
- All changes require passing tests
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 002 SRP Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
All modules have good single responsibility. No major violations.
|
|
7
|
+
|
|
8
|
+
## Per-Module Analysis
|
|
9
|
+
|
|
10
|
+
### find.ts ✅
|
|
11
|
+
- Single concern: directory traversal with filtering
|
|
12
|
+
- Pure factory pattern isolates FS dependencies
|
|
13
|
+
- Helper functions (isAllowed, isBlocked) are cohesive
|
|
14
|
+
|
|
15
|
+
### hello.ts ✅
|
|
16
|
+
- Single concern: library health check
|
|
17
|
+
- Minor: console.log side effect is appropriate for purpose
|
|
18
|
+
|
|
19
|
+
### pojo.ts ✅
|
|
20
|
+
- Single concern: class-to-POJO conversion
|
|
21
|
+
- Pure function, no side effects
|
|
22
|
+
|
|
23
|
+
### user-agent.ts ✅
|
|
24
|
+
- Single concern: UA string parsing
|
|
25
|
+
- Well-decomposed: detectBrowser, detectOS, detectDeviceType, detectEngine
|
|
26
|
+
- Each sub-function has single responsibility
|
|
27
|
+
|
|
28
|
+
## Issues Found
|
|
29
|
+
|
|
30
|
+
None requiring action.
|
|
31
|
+
|
|
32
|
+
## Status
|
|
33
|
+
|
|
34
|
+
PASS - All modules satisfy SRP.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Base64 Module Security Assessment
|
|
2
|
+
# Date: 2026-01-19
|
|
3
|
+
# Scope: src/base64.ts
|
|
4
|
+
|
|
5
|
+
## Attack Surface Inventory
|
|
6
|
+
- encode(input: string, charset): accepts user-controlled string
|
|
7
|
+
- decode(input: string, charset): accepts user-controlled Base64 string
|
|
8
|
+
- No network I/O, no file I/O, no exec
|
|
9
|
+
|
|
10
|
+
## Threat Model
|
|
11
|
+
- Attacker model: untrusted string input
|
|
12
|
+
- Assets: application stability, memory
|
|
13
|
+
- Trust boundary: function input parameters
|
|
14
|
+
|
|
15
|
+
## OWASP Top 10 Review
|
|
16
|
+
|
|
17
|
+
### A01 - Broken Access Control
|
|
18
|
+
- N/A: Pure computation, no access control
|
|
19
|
+
|
|
20
|
+
### A02 - Cryptographic Failures
|
|
21
|
+
- N/A: Not a cryptographic function (encoding != encryption)
|
|
22
|
+
- Note: radix64 is named for OpenPGP but is just Base64 alphabet
|
|
23
|
+
|
|
24
|
+
### A03 - Injection
|
|
25
|
+
- N/A: No SQL, command, or template execution
|
|
26
|
+
- Output is string manipulation only
|
|
27
|
+
|
|
28
|
+
### A04 - Insecure Design
|
|
29
|
+
- PASS: Input validation on decode via lookup table
|
|
30
|
+
- PASS: Invalid characters throw explicit error
|
|
31
|
+
|
|
32
|
+
### A05 - Security Misconfiguration
|
|
33
|
+
- N/A: No configuration, pure library code
|
|
34
|
+
|
|
35
|
+
### A06 - Vulnerable Components
|
|
36
|
+
- N/A: No external dependencies
|
|
37
|
+
|
|
38
|
+
### A07 - Identification & Authentication
|
|
39
|
+
- N/A: No auth logic
|
|
40
|
+
|
|
41
|
+
### A08 - Software & Data Integrity
|
|
42
|
+
- N/A: No deserialization or external data
|
|
43
|
+
|
|
44
|
+
### A09 - Logging & Monitoring
|
|
45
|
+
- N/A: Library code, no logging (appropriate)
|
|
46
|
+
|
|
47
|
+
### A10 - SSRF
|
|
48
|
+
- N/A: No URL handling
|
|
49
|
+
|
|
50
|
+
## Denial of Service Analysis
|
|
51
|
+
- Large input: TextEncoder/TextDecoder handle arbitrary sizes
|
|
52
|
+
- Memory: proportional to input size (expected for encoding)
|
|
53
|
+
- No regex catastrophic backtracking (simple /=+$/ pattern)
|
|
54
|
+
- No infinite loops: bounded by input length
|
|
55
|
+
|
|
56
|
+
## Input Validation
|
|
57
|
+
- encode(): accepts any valid JS string, converts via TextEncoder
|
|
58
|
+
- decode(): validates each character against charset lookup table
|
|
59
|
+
- Invalid input: throws Error immediately (fail-fast)
|
|
60
|
+
|
|
61
|
+
## Memory Safety
|
|
62
|
+
- Uses Uint8Array and standard JS arrays
|
|
63
|
+
- No buffer overflows possible in JS/TS
|
|
64
|
+
- No manual memory management
|
|
65
|
+
|
|
66
|
+
## Findings
|
|
67
|
+
Severity: NONE
|
|
68
|
+
|
|
69
|
+
## Summary
|
|
70
|
+
No security issues identified. The module is a pure computation library with:
|
|
71
|
+
- No external I/O
|
|
72
|
+
- No dangerous operations
|
|
73
|
+
- Proper input validation
|
|
74
|
+
- Explicit error handling
|
|
75
|
+
- Bounded resource usage
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# 001 Commands Executed
|
|
2
|
+
Generated: 2026-01-19T20:46:44+05:30
|
|
3
|
+
|
|
4
|
+
## Environment Verification
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
which npm node semgrep
|
|
8
|
+
# /home/anubhav/.nvm/versions/node/v24.5.0/bin/npm
|
|
9
|
+
# /home/anubhav/.nvm/versions/node/v24.5.0/bin/node
|
|
10
|
+
# semgrep not found
|
|
11
|
+
|
|
12
|
+
npm --version
|
|
13
|
+
# 11.7.0
|
|
14
|
+
|
|
15
|
+
node --version
|
|
16
|
+
# v24.5.0
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Dependency Audit
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm audit --json
|
|
23
|
+
# 0 vulnerabilities
|
|
24
|
+
# 131 dependencies (1 prod, 130 dev)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Static Pattern Analysis
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Command injection patterns
|
|
31
|
+
grep -rE 'eval|Function\(|exec|spawn|child_process' src/*.ts
|
|
32
|
+
# No results
|
|
33
|
+
|
|
34
|
+
# Secret patterns
|
|
35
|
+
grep -riE 'password|secret|api.?key|token|credential' src/*.ts
|
|
36
|
+
# Found: pojo.test.ts (test data only)
|
|
37
|
+
|
|
38
|
+
# XSS patterns
|
|
39
|
+
grep -rE 'innerHTML|outerHTML|document\.write' src/*.ts
|
|
40
|
+
# No results
|
|
41
|
+
|
|
42
|
+
# File operation patterns
|
|
43
|
+
grep -rE 'fs\.|readFile|writeFile|unlink|rmdir' src/*.ts
|
|
44
|
+
# No results
|
|
45
|
+
|
|
46
|
+
# Network patterns
|
|
47
|
+
grep -riE 'http|fetch|axios|request' src/*.ts
|
|
48
|
+
# No results
|
|
49
|
+
|
|
50
|
+
# Crypto patterns
|
|
51
|
+
grep -riE 'crypto|hash|md5|sha1|sha256' src/*.ts
|
|
52
|
+
# No results
|
|
53
|
+
|
|
54
|
+
# SQL patterns
|
|
55
|
+
grep -riE 'sql|query|database|db\.' src/*.ts
|
|
56
|
+
# No results
|
|
57
|
+
|
|
58
|
+
# Deserialization patterns
|
|
59
|
+
grep -rE 'JSON\.parse|deserialize|pickle' src/*.ts
|
|
60
|
+
# No results
|
|
61
|
+
|
|
62
|
+
# Prototype pollution patterns
|
|
63
|
+
grep -rE 'prototype|__proto__|constructor\[' src/*.ts
|
|
64
|
+
# Found: pojo.ts, pojo.test.ts (documentation/test only)
|
|
65
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# 001 Environment Verification
|
|
2
|
+
Generated: 2026-01-19T20:46:44+05:30
|
|
3
|
+
|
|
4
|
+
## Tooling Status
|
|
5
|
+
|
|
6
|
+
| Tool | Status | Version | Path |
|
|
7
|
+
|----------|-----------|-----------|----------------------------------------|
|
|
8
|
+
| node | ✅ OK | v24.5.0 | /home/anubhav/.nvm/versions/node/... |
|
|
9
|
+
| npm | ✅ OK | 11.7.0 | /home/anubhav/.nvm/versions/node/... |
|
|
10
|
+
| semgrep | ❌ MISSING| - | - |
|
|
11
|
+
|
|
12
|
+
## npm audit
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
Vulnerabilities: 0
|
|
16
|
+
- Critical: 0
|
|
17
|
+
- High: 0
|
|
18
|
+
- Moderate: 0
|
|
19
|
+
- Low: 0
|
|
20
|
+
- Info: 0
|
|
21
|
+
|
|
22
|
+
Dependencies: 131 (1 prod, 130 dev)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Notes
|
|
26
|
+
|
|
27
|
+
- Semgrep not installed; manual pattern analysis performed
|
|
28
|
+
- All dev dependencies, minimal prod footprint
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# 001 Security Findings
|
|
2
|
+
Generated: 2026-01-19T20:46:44+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
| Severity | Count |
|
|
7
|
+
|----------|-------|
|
|
8
|
+
| Critical | 0 |
|
|
9
|
+
| High | 0 |
|
|
10
|
+
| Medium | 0 |
|
|
11
|
+
| Low | 1 |
|
|
12
|
+
| Info | 1 |
|
|
13
|
+
|
|
14
|
+
## Findings
|
|
15
|
+
|
|
16
|
+
### [LOW] F001 - Path Traversal Potential in find.ts
|
|
17
|
+
|
|
18
|
+
**Location:** find.ts:23-26, createFindDirectories()
|
|
19
|
+
|
|
20
|
+
**Description:**
|
|
21
|
+
The `root` parameter is passed to `resolve()` without validation.
|
|
22
|
+
If a consumer passes user-controlled input, path traversal is possible.
|
|
23
|
+
|
|
24
|
+
**Impact:** Directory enumeration outside intended scope.
|
|
25
|
+
|
|
26
|
+
**Exploitability:** LOW - Requires consumer misuse.
|
|
27
|
+
|
|
28
|
+
**CWE:** CWE-22 (Path Traversal)
|
|
29
|
+
|
|
30
|
+
**OWASP:** A01 (Broken Access Control)
|
|
31
|
+
|
|
32
|
+
**Confidence:** LOW - Library design expects trusted input.
|
|
33
|
+
|
|
34
|
+
**Recommendation:**
|
|
35
|
+
- Document that `root` must be trusted input
|
|
36
|
+
- Optionally add: validate root is within allowed base path
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### [INFO] F002 - "secret" String in Test File
|
|
41
|
+
|
|
42
|
+
**Location:** pojo.test.ts:54-65
|
|
43
|
+
|
|
44
|
+
**Description:**
|
|
45
|
+
String "secret" appears in test data (SecretBox class).
|
|
46
|
+
|
|
47
|
+
**Impact:** None - test data only.
|
|
48
|
+
|
|
49
|
+
**Confidence:** HIGH - Verified as test fixture.
|
|
50
|
+
|
|
51
|
+
**Recommendation:** No action needed.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Residual Risk
|
|
56
|
+
|
|
57
|
+
**MINIMAL** - This is a stateless utility library with:
|
|
58
|
+
- No network exposure
|
|
59
|
+
- No database access
|
|
60
|
+
- No authentication
|
|
61
|
+
- No user input handling
|
|
62
|
+
|
|
63
|
+
Security posture depends on consumer implementation.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# 001 Attack Surface Inventory
|
|
2
|
+
Generated: 2026-01-19T20:46:44+05:30
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This is a pure utility library with NO:
|
|
7
|
+
- HTTP endpoints
|
|
8
|
+
- CLI interfaces
|
|
9
|
+
- Database access
|
|
10
|
+
- Authentication
|
|
11
|
+
- Network I/O
|
|
12
|
+
|
|
13
|
+
## Entry Points
|
|
14
|
+
|
|
15
|
+
### find.ts - createFindDirectories()
|
|
16
|
+
|
|
17
|
+
- Input: FileSystemDependencies (injected), root path, options
|
|
18
|
+
- Operations: Directory traversal via injected readdir
|
|
19
|
+
- Trust boundary: Consumer provides FS functions
|
|
20
|
+
|
|
21
|
+
### hello.ts - hello()
|
|
22
|
+
|
|
23
|
+
- Input: None
|
|
24
|
+
- Operations: Returns static string, logs to console
|
|
25
|
+
- Trust boundary: None
|
|
26
|
+
|
|
27
|
+
### pojo.ts - pojo()
|
|
28
|
+
|
|
29
|
+
- Input: Object instance
|
|
30
|
+
- Operations: Object.entries, Object.fromEntries
|
|
31
|
+
- Trust boundary: Consumer provides object
|
|
32
|
+
|
|
33
|
+
### user-agent.ts - parseUserAgent()
|
|
34
|
+
|
|
35
|
+
- Input: String (user-agent)
|
|
36
|
+
- Operations: String parsing (split, includes)
|
|
37
|
+
- Trust boundary: Consumer provides UA string
|
|
38
|
+
|
|
39
|
+
## Attack Surface Rating
|
|
40
|
+
|
|
41
|
+
**MINIMAL** - Pure functions, no I/O, no state, no network.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# 001 OWASP Top 10 Assessment
|
|
2
|
+
Generated: 2026-01-19T20:46:44+05:30
|
|
3
|
+
|
|
4
|
+
## A01 - Broken Access Control
|
|
5
|
+
|
|
6
|
+
**N/A** - No authentication, authorization, or access control.
|
|
7
|
+
|
|
8
|
+
## A02 - Cryptographic Failures
|
|
9
|
+
|
|
10
|
+
**N/A** - No cryptographic operations.
|
|
11
|
+
- No passwords, tokens, or secrets
|
|
12
|
+
- No hashing or encryption
|
|
13
|
+
|
|
14
|
+
## A03 - Injection
|
|
15
|
+
|
|
16
|
+
**LOW RISK** - Pattern analysis performed:
|
|
17
|
+
|
|
18
|
+
| Pattern | Found | Files |
|
|
19
|
+
|---------------------|-------|-------|
|
|
20
|
+
| eval() | ❌ No | - |
|
|
21
|
+
| Function() | ❌ No | - |
|
|
22
|
+
| exec/spawn | ❌ No | - |
|
|
23
|
+
| child_process | ❌ No | - |
|
|
24
|
+
| SQL | ❌ No | - |
|
|
25
|
+
| innerHTML | ❌ No | - |
|
|
26
|
+
|
|
27
|
+
## A04 - Insecure Design
|
|
28
|
+
|
|
29
|
+
**N/A** - Simple utility library.
|
|
30
|
+
- No business logic
|
|
31
|
+
- No rate limiting needed
|
|
32
|
+
- No trust assumptions
|
|
33
|
+
|
|
34
|
+
## A05 - Security Misconfiguration
|
|
35
|
+
|
|
36
|
+
**N/A** - No configuration surface.
|
|
37
|
+
- No debug modes
|
|
38
|
+
- No CORS
|
|
39
|
+
- No credentials
|
|
40
|
+
|
|
41
|
+
## A06 - Vulnerable Components
|
|
42
|
+
|
|
43
|
+
**PASS** - npm audit: 0 vulnerabilities
|
|
44
|
+
- 131 dependencies scanned
|
|
45
|
+
- No known CVEs
|
|
46
|
+
|
|
47
|
+
## A07 - Identification & Authentication Failures
|
|
48
|
+
|
|
49
|
+
**N/A** - No authentication.
|
|
50
|
+
|
|
51
|
+
## A08 - Software & Data Integrity Failures
|
|
52
|
+
|
|
53
|
+
**LOW RISK** - Analyzed for deserialization:
|
|
54
|
+
|
|
55
|
+
| Pattern | Found | Notes |
|
|
56
|
+
|---------------------|-------|--------------------------|
|
|
57
|
+
| JSON.parse | ❌ No | - |
|
|
58
|
+
| Prototype pollution | ❌ No | pojo() uses safe methods |
|
|
59
|
+
|
|
60
|
+
pojo() uses Object.entries/fromEntries which are safe.
|
|
61
|
+
|
|
62
|
+
## A09 - Logging & Monitoring Failures
|
|
63
|
+
|
|
64
|
+
**N/A** - Library code, not service.
|
|
65
|
+
- console.log in hello() is benign
|
|
66
|
+
|
|
67
|
+
## A10 - SSRF
|
|
68
|
+
|
|
69
|
+
**N/A** - No network I/O.
|
|
70
|
+
- No fetch, axios, http
|
|
71
|
+
- No URL handling
|
|
72
|
+
|
|
73
|
+
## Summary
|
|
74
|
+
|
|
75
|
+
| Category | Status |
|
|
76
|
+
|----------|--------|
|
|
77
|
+
| A01-A10 | N/A or PASS |
|
|
78
|
+
| Overall | **LOW RISK** |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# 001 Scope - Security Assessment
|
|
2
|
+
Generated: 2026-01-19T20:46:44+05:30
|
|
3
|
+
|
|
4
|
+
## Target
|
|
5
|
+
|
|
6
|
+
- Package: @wtasnorg/node-lib@0.0.8
|
|
7
|
+
- Type: TypeScript utility library
|
|
8
|
+
- Platform: Node.js
|
|
9
|
+
|
|
10
|
+
## In Scope
|
|
11
|
+
|
|
12
|
+
- src/*.ts (source files)
|
|
13
|
+
- Dependencies (package.json)
|
|
14
|
+
- Build artifacts
|
|
15
|
+
|
|
16
|
+
## Out of Scope
|
|
17
|
+
|
|
18
|
+
- Test files (contain mock data only)
|
|
19
|
+
- Documentation
|
|
20
|
+
- CI/CD configuration
|
|
21
|
+
|
|
22
|
+
## Sensitive Data Classes
|
|
23
|
+
|
|
24
|
+
None identified. Library is stateless and handles:
|
|
25
|
+
- File paths (find.ts)
|
|
26
|
+
- String parsing (user-agent.ts, pojo.ts)
|
|
27
|
+
- No PII, credentials, or financial data
|
|
28
|
+
|
|
29
|
+
## Allowed Techniques
|
|
30
|
+
|
|
31
|
+
- Static code analysis
|
|
32
|
+
- Dependency auditing
|
|
33
|
+
- Pattern matching for dangerous APIs
|
|
34
|
+
|
|
35
|
+
## Forbidden Techniques
|
|
36
|
+
|
|
37
|
+
- Network scanning (N/A - no network exposure)
|
|
38
|
+
- Dynamic exploitation (N/A - library code)
|
|
39
|
+
|
|
40
|
+
## Assumptions
|
|
41
|
+
|
|
42
|
+
- Library runs in trusted Node.js environment
|
|
43
|
+
- Consumers provide trusted inputs
|
|
44
|
+
- No direct user input handling
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wtasnorg/node-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "node library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"docs": "./node_modules/.bin/typedoc",
|
|
9
9
|
"docs:json": "./node_modules/.bin/typedoc --json docs/docs.json",
|
|
10
10
|
"docs:watch": "./node_modules/.bin/typedoc --watch",
|
|
11
|
-
"test": "bash -c 'node --test src/**/*.test.js'"
|
|
11
|
+
"test": "bash -c 'node --test src/**/*.test.js'",
|
|
12
|
+
"lint": "npx eslint src/*.ts --no-warn-ignored"
|
|
12
13
|
},
|
|
13
14
|
"keywords": [
|
|
14
15
|
"library"
|