feat: added rules for classifying plugin behaviors - #189
Draft
saberzero1 wants to merge 1 commit into
Draft
saberzero1 wants to merge 1 commit into
saberzero1 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new behavior/* rule set to classify potentially sensitive Obsidian plugin behaviors (privacy/security-relevant capabilities) and documents/tests those rules, wiring them into the plugin export surface while keeping them disabled in the recommended configs.
Changes:
- Added multiple new
behavior/*ESLint rules (vault read/write/enumeration, clipboard access, filesystem/shell usage, identity/fingerprinting, self-update/self-restart, periodic network). - Added RuleTester coverage for each new behavior rule.
- Added end-user documentation and surfaced the rules in
README.mdandlib/index.ts(rules registry + recommended config defaults set tooff).
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/behavior/vaultWrite.test.ts | Adds tests for detecting vault write operations and adapter writes. |
| tests/behavior/vaultRead.test.ts | Adds tests for detecting vault read operations and adapter reads. |
| tests/behavior/vaultEnumeration.test.ts | Adds tests for detecting vault-wide enumeration APIs and getMarkdownFiles(). |
| tests/behavior/noSystemIdentity.test.ts | Adds tests for detecting OS identity calls and sensitive env var reads. |
| tests/behavior/noShellExecution.test.ts | Adds tests for detecting child_process usage and sync shell exec APIs. |
| tests/behavior/noSelfUpdate.test.ts | Adds tests for detecting self-update-like patterns (plugin files + writes + zip). |
| tests/behavior/noSelfDisableEnable.test.ts | Adds tests for detecting disable+enable plugin patterns in the same file. |
| tests/behavior/noPeriodicNetwork.test.ts | Adds tests for detecting setInterval callbacks that perform network calls. |
| tests/behavior/noLocalStorage.test.ts | Adds tests for detecting localStorage/sessionStorage persistence API usage. |
| tests/behavior/noHardwareFingerprinting.test.ts | Adds tests for detecting node-machine-id usage and machineId* calls. |
| tests/behavior/noFilesystemAccess.test.ts | Adds tests for detecting fs module imports/requires/dynamic imports. |
| tests/behavior/noElectronIpc.test.ts | Adds tests for detecting Electron IPC API usage (ipcRenderer/ipcMain). |
| tests/behavior/clipboardAccess.test.ts | Adds tests for detecting clipboard access via navigator/electron/remote. |
| tests/behavior/index.ts | Aggregates imports for the behavior test suite. |
| README.md | Documents the new behavior rules in the auto-generated rules list table. |
| lib/rules/behavior/vaultWrite.ts | Implements vault write detection (vault.* write APIs + adapter.write()). |
| lib/rules/behavior/vaultRead.ts | Implements vault read detection (vault.read/cachedRead + adapter.read). |
| lib/rules/behavior/vaultEnumeration.ts | Implements vault enumeration detection (bulk list APIs + getMarkdownFiles()). |
| lib/rules/behavior/noSystemIdentity.ts | Implements detection for identity-relevant OS APIs and env var reads. |
| lib/rules/behavior/noShellExecution.ts | Implements detection for child_process imports/loads and sync exec calls. |
| lib/rules/behavior/noSelfUpdate.ts | Implements heuristic for self-update behavior (plugin file refs + writes + zip). |
| lib/rules/behavior/noSelfDisableEnable.ts | Implements heuristic for disable+enable plugin behavior in a file. |
| lib/rules/behavior/noPeriodicNetwork.ts | Implements detection for periodic background network via setInterval callbacks. |
| lib/rules/behavior/noLocalStorage.ts | Implements detection for storage persistence via localStorage/sessionStorage. |
| lib/rules/behavior/noHardwareFingerprinting.ts | Implements detection for node-machine-id usage and its common function calls. |
| lib/rules/behavior/noFilesystemAccess.ts | Implements detection for fs module usage via import/require/dynamic import. |
| lib/rules/behavior/noElectronIpc.ts | Implements detection for Electron IPC APIs via imports and member access. |
| lib/rules/behavior/clipboardAccess.ts | Implements detection for clipboard access via *.clipboard member access. |
| lib/rules/behavior/index.ts | Exposes the new behavior rules under a single behavior export. |
| lib/index.ts | Registers the new rules and disables them by default in recommended configs. |
| docs/rules/behavior/vault-write.md | Documents the vault write behavior rule with examples. |
| docs/rules/behavior/vault-read.md | Documents the vault read behavior rule with examples. |
| docs/rules/behavior/vault-enumeration.md | Documents the vault enumeration behavior rule with examples. |
| docs/rules/behavior/no-system-identity.md | Documents the system identity behavior rule with examples. |
| docs/rules/behavior/no-shell-execution.md | Documents the shell execution behavior rule with examples/limitations. |
| docs/rules/behavior/no-self-update.md | Documents the self-update behavior rule and its heuristic. |
| docs/rules/behavior/no-self-disable-enable.md | Documents the self disable/enable behavior rule and rationale. |
| docs/rules/behavior/no-periodic-network.md | Documents the periodic network behavior rule and its limitation. |
| docs/rules/behavior/no-local-storage.md | Documents the local/session storage behavior rule with examples. |
| docs/rules/behavior/no-hardware-fingerprinting.md | Documents the hardware fingerprinting behavior rule with examples. |
| docs/rules/behavior/no-filesystem-access.md | Documents the filesystem access behavior rule and rationale. |
| docs/rules/behavior/no-electron-ipc.md | Documents the Electron IPC behavior rule with examples. |
| docs/rules/behavior/clipboard-access.md | Documents the clipboard access behavior rule with examples. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #186