Skip to content

feat: added rules for classifying plugin behaviors - #189

Draft
saberzero1 wants to merge 1 commit into
masterfrom
feat/plugin-behavior-classification
Draft

saberzero1 wants to merge 1 commit into
masterfrom
feat/plugin-behavior-classification

Conversation

@saberzero1

Copy link
Copy Markdown
Collaborator

closes #186

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md and lib/index.ts (rules registry + recommended config defaults set to off).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore detecting plugin behavior in eslint

2 participants