feat(node-plugins): add abuse blocker configuration schema - #207
feat(node-plugins): add abuse blocker configuration schema#207l0nelynx wants to merge 2 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
PR Summary
|
Greptile SummaryThe PR adds the optional
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "test(node-plugins): validate abuse block..." | Re-trigger Greptile |
162f4e6 to
5242089
Compare
Suggested PR title
feat(node-plugins): add abuse blocker configuration schemaSummary
This PR introduces the public configuration contract for a new optional Node plugin named
abuseBlockerand bumps@remnawave/node-pluginsfrom0.6.3to0.7.0.The plugin is intended to detect scan-like abuse per user on Remnawave Node, maintain a short-lived local score, report suspicious activity to the backend, and temporarily block the current source IP when the configured score threshold is reached.
This is the first PR in a staged implementation. It adds only the shared schema and its tests. It does not yet change Node runtime behavior, Xray routing, nftables, database models, or user status handling.
Motivation
torrentBlockercan react to a single protocol classification emitted by Xray. Scan detection requires configurable aggregation across multiple connections belonging to the same user.The new schema establishes a versioned contract between the backend, frontend schema consumers, and Node before the runtime implementation is introduced. Making the contract available first allows the Node PR to depend on a published package instead of duplicating configuration types.
Planned detection and scoring model
The runtime implementation built on this schema will process TCP routing events that contain a user ID, source IP, destination IP, and destination port. Domain-only destinations will not be counted.
Two detectors are enabled by default:
Horizontal scan
/24or IPv6/64prefix.Destination sweep
Ports 80 and 443 are excluded by default.
The default score bands are:
The backend follow-up will escalate repeated blocking incidents within seven days to a one-hour block and then to account disablement with manual review.
Configuration reference
All values below are defaults unless noted otherwise.
General settings
enabledexcludedPorts[80, 443]scoreWindowSeconds3600incidentCooldownSeconds300suspiciousScore50alertScore100blockScore150initialBlockSeconds600repeatBlockSeconds3600repeatWindowSeconds604800evidenceLimit10enhancedEvidenceLimit50maxTrackedUsers50000maxKeysPerUser256reportBufferSize10000Cross-field validation requires:
suspiciousScore < alertScore < blockScore;initialBlockSeconds <= repeatBlockSeconds;evidenceLimit <= enhancedEvidenceLimit.Ignore lists
ignoreLists.userId[]ignoreLists.sourceIp[]ext:list_nameignoreLists.destinationIp[]ext:list_nameThe IP lists reuse the existing
sharedLists/ext:contract.horizontalScanenabledtruewindowSeconds60uniqueDestinations20ipv4Prefix24ipv6Prefix64score100destinationSweepenabledtruewindowSeconds60uniqueDestinations50score50Compatibility
abuseBlockeris optional inNodePluginSchema.Tests
Added Node test coverage for:
abuseBlockeris absent.Validation performed locally:
All five schema tests pass, and both backend and frontend package builds succeed.
Implementation roadmap
abuseBlockerschema, validation, defaults, tests, and publish@remnawave/node-plugins@0.7.0.@remnawave/node-plugins@0.7.0and add Xray observation, local detection/scoring, report buffering, health state, nftables enforcement, and the extended@remnawave/node-contract. The Draft uses the locally packed schema until the package is published; its final contract version bump and lockfile remain release-gated.All three PRs target the
devbranches and remain Draft until the cross-repository package versions are published, registry dependencies and lockfiles are finalized, and the complete test suites are green.