verdaccio-security-filter 0.0.0 → 1.1.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.
@@ -0,0 +1,119 @@
1
+ import { Config, Version } from '@verdaccio/types';
2
+ export interface VersionRangeRule {
3
+ package: string;
4
+ range: string;
5
+ strategy: 'block' | 'fallback';
6
+ fallbackVersion?: string;
7
+ reason?: string;
8
+ }
9
+ export interface CVECheckConfig {
10
+ enabled: boolean;
11
+ databases: ('osv' | 'snyk' | 'github')[];
12
+ severity: ('low' | 'medium' | 'high' | 'critical')[];
13
+ autoBlock: boolean;
14
+ updateInterval?: number;
15
+ cacheDir?: string;
16
+ }
17
+ export interface WhitelistConfig {
18
+ packages: string[];
19
+ patterns: string[];
20
+ versions?: Record<string, string>;
21
+ autoApprove?: {
22
+ minDownloads?: number;
23
+ minStars?: number;
24
+ verifiedPublisher?: boolean;
25
+ };
26
+ }
27
+ export interface LicenseConfig {
28
+ allowed: string[];
29
+ blocked: string[];
30
+ requireLicense: boolean;
31
+ }
32
+ export interface LoggerConfig {
33
+ level: 'trace' | 'debug' | 'info' | 'warn' | 'error';
34
+ enabled: boolean;
35
+ includeTimestamp?: boolean;
36
+ }
37
+ export interface MetricsConfig {
38
+ enabled: boolean;
39
+ output?: 'stdout' | 'file';
40
+ filePath?: string;
41
+ }
42
+ export interface PackageAgeConfig {
43
+ enabled: boolean;
44
+ minPackageAgeDays: number;
45
+ minVersionAgeDays?: number;
46
+ warnOnly?: boolean;
47
+ }
48
+ export interface SecurityConfig extends Config {
49
+ blockedVersions?: string[];
50
+ blockedPatterns?: string[];
51
+ minPackageSize?: number;
52
+ maxPackageSize?: number;
53
+ allowedScopes?: string[];
54
+ blockedScopes?: string[];
55
+ enforceChecksum?: boolean;
56
+ versionRangeRules?: VersionRangeRule[];
57
+ mode?: 'blacklist' | 'whitelist';
58
+ whitelist?: WhitelistConfig;
59
+ licenses?: LicenseConfig;
60
+ cveCheck?: CVECheckConfig;
61
+ logger?: LoggerConfig;
62
+ metrics?: MetricsConfig;
63
+ packageAge?: PackageAgeConfig;
64
+ errorHandling?: {
65
+ onFilterError?: 'fail-open' | 'fail-closed';
66
+ onCveCheckError?: 'fail-open' | 'fail-closed';
67
+ onLicenseCheckError?: 'fail-open' | 'fail-closed';
68
+ };
69
+ }
70
+ export interface SecurityRules {
71
+ blockedVersions: string[];
72
+ blockedPatterns: string[];
73
+ minPackageSize: number;
74
+ maxPackageSize: number;
75
+ allowedScopes: string[];
76
+ blockedScopes: string[];
77
+ enforceChecksum: boolean;
78
+ versionRangeRules: VersionRangeRule[];
79
+ }
80
+ export interface VersionData extends Version {
81
+ /** Internal flag for fallback versions */
82
+ _fallback?: boolean;
83
+ /** Original version this is falling back from */
84
+ _fallbackFrom?: string;
85
+ /** Reason for fallback */
86
+ _fallbackReason?: string;
87
+ }
88
+ export interface FilterResult {
89
+ versions: Record<string, VersionData>;
90
+ blockedVersions: string[];
91
+ fallbacksApplied: Array<{
92
+ original: string;
93
+ fallback: string;
94
+ }>;
95
+ }
96
+ export interface CVEVulnerability {
97
+ id: string;
98
+ severity: 'low' | 'medium' | 'high' | 'critical';
99
+ summary: string;
100
+ affectedVersions: string[];
101
+ fixedVersion?: string;
102
+ publishedDate: string;
103
+ source: string;
104
+ }
105
+ export interface CVECheckResult {
106
+ package: string;
107
+ version: string;
108
+ vulnerabilities: CVEVulnerability[];
109
+ isVulnerable: boolean;
110
+ checkedAt: string;
111
+ }
112
+ export interface MetricsData {
113
+ timestamp: string;
114
+ event: 'block' | 'fallback' | 'publish_rejected' | 'cve_detected' | 'license_blocked' | 'package_too_new';
115
+ packageName: string;
116
+ version?: string;
117
+ reason: string;
118
+ metadata?: Record<string, any>;
119
+ }
package/build/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,8 +1,58 @@
1
1
  {
2
2
  "name": "verdaccio-security-filter",
3
- "version": "0.0.0",
4
- "description": "Package name reserved. Full implementation coming soon.",
5
- "main": "index.js",
3
+ "version": "1.1.0",
4
+ "description": "Advanced security filter plugin for Verdaccio with version range blocking and fallback strategies",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "keywords": [
8
+ "verdaccio",
9
+ "plugin",
10
+ "filter",
11
+ "security",
12
+ "npm",
13
+ "registry",
14
+ "vulnerability",
15
+ "semver",
16
+ "version-control"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "engines": {
22
+ "node": ">=22"
23
+ },
24
+ "scripts": {
25
+ "build": "tsc -p tsconfig.json",
26
+ "build:watch": "tsc -p tsconfig.json --watch",
27
+ "lint": "eslint src",
28
+ "test": "jest",
29
+ "test:watch": "jest --watch",
30
+ "test:coverage": "jest --coverage",
31
+ "debug:verdaccio": "node --inspect-brk $(which verdaccio)",
32
+ "debug:build": "npm run build && npm link",
33
+ "prepack": "npm run build",
34
+ "prepare": "npm run build",
35
+ "prepublishOnly": "npm test"
36
+ },
37
+ "peerDependencies": {
38
+ "verdaccio": ">=5.0.0"
39
+ },
40
+ "dependencies": {
41
+ "semver": "^7.7.0"
42
+ },
43
+ "devDependencies": {
44
+ "@eslint/js": "^9.0.0",
45
+ "@types/express": "^5.0.6",
46
+ "@types/jest": "^29.5.14",
47
+ "@types/node": "^22.19.1",
48
+ "@types/semver": "^7.0.0",
49
+ "@verdaccio/types": "^10.0.0",
50
+ "eslint": "^9.0.0",
51
+ "jest": "^29.7.0",
52
+ "ts-jest": "^29.2.5",
53
+ "typescript": "^5.9.3",
54
+ "typescript-eslint": "^8.0.0"
55
+ },
6
56
  "author": {
7
57
  "name": "Vitaliy Ponomarenko",
8
58
  "url": "https://github.com/ponomarenko"
@@ -12,7 +62,12 @@
12
62
  "type": "git",
13
63
  "url": "git+https://github.com/ponomarenko/verdaccio-security-filter.git"
14
64
  },
15
- "publishConfig": {
16
- "access": "public"
17
- }
65
+ "bugs": {
66
+ "url": "https://github.com/ponomarenko/verdaccio-security-filter/issues"
67
+ },
68
+ "homepage": "https://github.com/ponomarenko/verdaccio-security-filter#readme",
69
+ "files": [
70
+ "build/",
71
+ "README.md"
72
+ ]
18
73
  }
package/index.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = function() {
2
- throw new Error('This package is a placeholder. Full implementation coming soon.');
3
- };