@greenarmor/ges-core 0.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.
- package/LICENSE +21 -0
- package/dist/constants/index.d.ts +28 -0
- package/dist/constants/index.js +69 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +660 -0
- package/dist/schemas/index.js +102 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/types/index.d.ts +105 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +26 -0
- package/src/constants/index.ts +83 -0
- package/src/index.ts +3 -0
- package/src/schemas/index.ts +112 -0
- package/src/types/index.ts +140 -0
- package/tsconfig.json +8 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ProjectTypeSchema = z.enum([
|
|
3
|
+
"saas",
|
|
4
|
+
"ai-application",
|
|
5
|
+
"mcp-server",
|
|
6
|
+
"blockchain",
|
|
7
|
+
"wallet",
|
|
8
|
+
"government-system",
|
|
9
|
+
"healthcare-system",
|
|
10
|
+
"event-platform",
|
|
11
|
+
"photo-storage-platform",
|
|
12
|
+
"vulnerability-scanner",
|
|
13
|
+
"generic-web-application",
|
|
14
|
+
"api-backend",
|
|
15
|
+
"mobile-application",
|
|
16
|
+
]);
|
|
17
|
+
export const FrameworkNameSchema = z.enum([
|
|
18
|
+
"GDPR",
|
|
19
|
+
"OWASP",
|
|
20
|
+
"CIS",
|
|
21
|
+
"NIST",
|
|
22
|
+
"ISO27001",
|
|
23
|
+
"ISO27701",
|
|
24
|
+
]);
|
|
25
|
+
export const DataClassificationSchema = z.enum([
|
|
26
|
+
"public",
|
|
27
|
+
"internal",
|
|
28
|
+
"confidential",
|
|
29
|
+
"restricted",
|
|
30
|
+
]);
|
|
31
|
+
export const ControlStatusSchema = z.enum([
|
|
32
|
+
"pass",
|
|
33
|
+
"fail",
|
|
34
|
+
"warning",
|
|
35
|
+
"not-applicable",
|
|
36
|
+
"not-implemented",
|
|
37
|
+
]);
|
|
38
|
+
export const ReportFormatSchema = z.enum(["markdown", "html", "pdf"]);
|
|
39
|
+
export const RequirementConfigSchema = z.object({
|
|
40
|
+
required: z.boolean(),
|
|
41
|
+
level: z.enum(["mandatory", "recommended", "optional"]).optional(),
|
|
42
|
+
notes: z.string().optional(),
|
|
43
|
+
});
|
|
44
|
+
export const ProjectConfigSchema = z.object({
|
|
45
|
+
project_name: z.string().min(1),
|
|
46
|
+
project_type: ProjectTypeSchema,
|
|
47
|
+
frameworks: z.array(FrameworkNameSchema).min(1),
|
|
48
|
+
requirements: z.object({
|
|
49
|
+
encryption: RequirementConfigSchema,
|
|
50
|
+
mfa: RequirementConfigSchema,
|
|
51
|
+
audit_logs: RequirementConfigSchema,
|
|
52
|
+
backups: RequirementConfigSchema,
|
|
53
|
+
retention_policy: RequirementConfigSchema,
|
|
54
|
+
vulnerability_scanning: RequirementConfigSchema,
|
|
55
|
+
authentication: RequirementConfigSchema,
|
|
56
|
+
authorization: RequirementConfigSchema,
|
|
57
|
+
secrets_management: RequirementConfigSchema,
|
|
58
|
+
logging: RequirementConfigSchema,
|
|
59
|
+
monitoring: RequirementConfigSchema,
|
|
60
|
+
data_classification: RequirementConfigSchema,
|
|
61
|
+
disaster_recovery: RequirementConfigSchema,
|
|
62
|
+
incident_response: RequirementConfigSchema,
|
|
63
|
+
privacy_controls: RequirementConfigSchema,
|
|
64
|
+
}),
|
|
65
|
+
created_at: z.string(),
|
|
66
|
+
version: z.string(),
|
|
67
|
+
});
|
|
68
|
+
export const ControlCheckSchema = z.object({
|
|
69
|
+
id: z.string(),
|
|
70
|
+
description: z.string(),
|
|
71
|
+
status: ControlStatusSchema,
|
|
72
|
+
evidence: z.string().optional(),
|
|
73
|
+
});
|
|
74
|
+
export const ControlSchema = z.object({
|
|
75
|
+
id: z.string(),
|
|
76
|
+
name: z.string(),
|
|
77
|
+
description: z.string(),
|
|
78
|
+
category: z.string(),
|
|
79
|
+
framework: FrameworkNameSchema,
|
|
80
|
+
article: z.string().optional(),
|
|
81
|
+
status: ControlStatusSchema.default("not-implemented"),
|
|
82
|
+
severity: z.enum(["critical", "high", "medium", "low"]),
|
|
83
|
+
implementation_guidance: z.string(),
|
|
84
|
+
checks: z.array(ControlCheckSchema),
|
|
85
|
+
});
|
|
86
|
+
export const AuditEntrySchema = z.object({
|
|
87
|
+
userId: z.string(),
|
|
88
|
+
action: z.string(),
|
|
89
|
+
resource: z.string(),
|
|
90
|
+
timestamp: z.string(),
|
|
91
|
+
ipAddress: z.string(),
|
|
92
|
+
metadata: z.record(z.unknown()).optional(),
|
|
93
|
+
});
|
|
94
|
+
export const ReportOptionsSchema = z.object({
|
|
95
|
+
format: ReportFormatSchema,
|
|
96
|
+
title: z.string(),
|
|
97
|
+
include_executive_summary: z.boolean(),
|
|
98
|
+
include_risk_assessment: z.boolean(),
|
|
99
|
+
include_compliance: z.boolean(),
|
|
100
|
+
include_security: z.boolean(),
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC;IACtC,MAAM;IACN,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,wBAAwB;IACxB,uBAAuB;IACvB,yBAAyB;IACzB,aAAa;IACb,oBAAoB;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC;IACxC,MAAM;IACN,OAAO;I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G,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,kBAAkB;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,yBAAyB,EAAE,CAAC,CAAC,OAAO,EAAE;IACtC,uBAAuB,EAAE,CAAC,CAAC,OAAO,EAAE;IACpC,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC/B,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;CAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export type ProjectType = "saas" | "ai-application" | "mcp-server" | "blockchain" | "wallet" | "government-system" | "healthcare-system" | "event-platform" | "photo-storage-platform" | "vulnerability-scanner" | "generic-web-application" | "api-backend" | "mobile-application";
|
|
2
|
+
export type FrameworkName = "GDPR" | "OWASP" | "CIS" | "NIST" | "ISO27001" | "ISO27701";
|
|
3
|
+
export type DataClassification = "public" | "internal" | "confidential" | "restricted";
|
|
4
|
+
export type ControlStatus = "pass" | "fail" | "warning" | "not-applicable" | "not-implemented";
|
|
5
|
+
export type ReportFormat = "markdown" | "html" | "pdf";
|
|
6
|
+
export interface ProjectConfig {
|
|
7
|
+
project_name: string;
|
|
8
|
+
project_type: ProjectType;
|
|
9
|
+
frameworks: FrameworkName[];
|
|
10
|
+
requirements: Requirements;
|
|
11
|
+
created_at: string;
|
|
12
|
+
version: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Requirements {
|
|
15
|
+
encryption: RequirementConfig;
|
|
16
|
+
mfa: RequirementConfig;
|
|
17
|
+
audit_logs: RequirementConfig;
|
|
18
|
+
backups: RequirementConfig;
|
|
19
|
+
retention_policy: RequirementConfig;
|
|
20
|
+
vulnerability_scanning: RequirementConfig;
|
|
21
|
+
authentication: RequirementConfig;
|
|
22
|
+
authorization: RequirementConfig;
|
|
23
|
+
secrets_management: RequirementConfig;
|
|
24
|
+
logging: RequirementConfig;
|
|
25
|
+
monitoring: RequirementConfig;
|
|
26
|
+
data_classification: RequirementConfig;
|
|
27
|
+
disaster_recovery: RequirementConfig;
|
|
28
|
+
incident_response: RequirementConfig;
|
|
29
|
+
privacy_controls: RequirementConfig;
|
|
30
|
+
}
|
|
31
|
+
export interface RequirementConfig {
|
|
32
|
+
required: boolean;
|
|
33
|
+
level?: "mandatory" | "recommended" | "optional";
|
|
34
|
+
notes?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface Control {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
category: string;
|
|
41
|
+
framework: FrameworkName;
|
|
42
|
+
article?: string;
|
|
43
|
+
status: ControlStatus;
|
|
44
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
45
|
+
implementation_guidance: string;
|
|
46
|
+
checks: ControlCheck[];
|
|
47
|
+
}
|
|
48
|
+
export interface ControlCheck {
|
|
49
|
+
id: string;
|
|
50
|
+
description: string;
|
|
51
|
+
status: ControlStatus;
|
|
52
|
+
evidence?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ComplianceScore {
|
|
55
|
+
framework: FrameworkName;
|
|
56
|
+
score: number;
|
|
57
|
+
total_controls: number;
|
|
58
|
+
passed_controls: number;
|
|
59
|
+
failed_controls: number;
|
|
60
|
+
warning_controls: number;
|
|
61
|
+
not_applicable: number;
|
|
62
|
+
evaluated_at: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ScoreFile {
|
|
65
|
+
overall: number;
|
|
66
|
+
frameworks: Record<string, ComplianceScore>;
|
|
67
|
+
evaluated_at: string;
|
|
68
|
+
}
|
|
69
|
+
export interface AuditEntry {
|
|
70
|
+
userId: string;
|
|
71
|
+
action: string;
|
|
72
|
+
resource: string;
|
|
73
|
+
timestamp: string;
|
|
74
|
+
ipAddress: string;
|
|
75
|
+
metadata?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
export interface PolicyPack {
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
description: string;
|
|
81
|
+
version: string;
|
|
82
|
+
project_types: ProjectType[];
|
|
83
|
+
controls: Control[];
|
|
84
|
+
frameworks: FrameworkName[];
|
|
85
|
+
}
|
|
86
|
+
export interface FrameworkVersion {
|
|
87
|
+
gesf_version: string;
|
|
88
|
+
packs: Record<string, string>;
|
|
89
|
+
}
|
|
90
|
+
export interface Metadata {
|
|
91
|
+
project_name: string;
|
|
92
|
+
project_type: ProjectType;
|
|
93
|
+
initialized_at: string;
|
|
94
|
+
gesf_version: string;
|
|
95
|
+
last_audit?: string;
|
|
96
|
+
last_score?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ReportOptions {
|
|
99
|
+
format: ReportFormat;
|
|
100
|
+
title: string;
|
|
101
|
+
include_executive_summary: boolean;
|
|
102
|
+
include_risk_assessment: boolean;
|
|
103
|
+
include_compliance: boolean;
|
|
104
|
+
include_security: boolean;
|
|
105
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@greenarmor/ges-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "GESF Core - Types, schemas, and constants",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"zod": "^3.23.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^6.0.0",
|
|
19
|
+
"@types/node": "^22.0.0"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
24
|
+
"test": "echo \"no tests yet\""
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ProjectType, FrameworkName } from "../types/index.js";
|
|
2
|
+
|
|
3
|
+
export const GESF_VERSION = "0.1.0";
|
|
4
|
+
|
|
5
|
+
export const PROJECT_TYPES: { value: ProjectType; label: string }[] = [
|
|
6
|
+
{ value: "saas", label: "SaaS" },
|
|
7
|
+
{ value: "ai-application", label: "AI Application" },
|
|
8
|
+
{ value: "mcp-server", label: "MCP Server" },
|
|
9
|
+
{ value: "blockchain", label: "Blockchain" },
|
|
10
|
+
{ value: "wallet", label: "Wallet" },
|
|
11
|
+
{ value: "government-system", label: "Government System" },
|
|
12
|
+
{ value: "healthcare-system", label: "Healthcare System" },
|
|
13
|
+
{ value: "event-platform", label: "Event Platform" },
|
|
14
|
+
{ value: "photo-storage-platform", label: "Photo Storage Platform" },
|
|
15
|
+
{ value: "vulnerability-scanner", label: "Vulnerability Scanner" },
|
|
16
|
+
{ value: "generic-web-application", label: "Generic Web Application" },
|
|
17
|
+
{ value: "api-backend", label: "API Backend" },
|
|
18
|
+
{ value: "mobile-application", label: "Mobile Application" },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
export const FRAMEWORKS: { value: FrameworkName; label: string }[] = [
|
|
22
|
+
{ value: "GDPR", label: "GDPR" },
|
|
23
|
+
{ value: "OWASP", label: "OWASP ASVS / Top 10" },
|
|
24
|
+
{ value: "CIS", label: "CIS Controls" },
|
|
25
|
+
{ value: "NIST", label: "NIST Cybersecurity Framework" },
|
|
26
|
+
{ value: "ISO27001", label: "ISO 27001" },
|
|
27
|
+
{ value: "ISO27701", label: "ISO 27701" },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export const DEFAULT_FRAMEWORKS: FrameworkName[] = ["GDPR", "OWASP", "CIS", "NIST"];
|
|
31
|
+
|
|
32
|
+
export const PROJECT_TYPE_PACKS: Record<ProjectType, string[]> = {
|
|
33
|
+
"saas": ["gdpr", "owasp", "cis", "nist"],
|
|
34
|
+
"ai-application": ["gdpr", "owasp", "ai"],
|
|
35
|
+
"mcp-server": ["gdpr", "ai"],
|
|
36
|
+
"blockchain": ["gdpr", "blockchain"],
|
|
37
|
+
"wallet": ["gdpr", "blockchain"],
|
|
38
|
+
"government-system": ["gdpr", "government"],
|
|
39
|
+
"healthcare-system": ["gdpr", "owasp", "cis"],
|
|
40
|
+
"event-platform": ["gdpr", "owasp"],
|
|
41
|
+
"photo-storage-platform": ["gdpr", "owasp"],
|
|
42
|
+
"vulnerability-scanner": ["gdpr", "owasp"],
|
|
43
|
+
"generic-web-application": ["gdpr", "owasp", "cis"],
|
|
44
|
+
"api-backend": ["gdpr", "owasp"],
|
|
45
|
+
"mobile-application": ["gdpr", "owasp"],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const DATA_CLASSIFICATIONS = ["public", "internal", "confidential", "restricted"] as const;
|
|
49
|
+
|
|
50
|
+
export const APPROVED_ENCRYPTION = ["AES-256-GCM", "ChaCha20-Poly1305", "TLS 1.3", "TLS 1.2"] as const;
|
|
51
|
+
|
|
52
|
+
export const APPROVED_HASHING = ["Argon2id", "bcrypt", "scrypt"] as const;
|
|
53
|
+
|
|
54
|
+
export const REJECTED_HASHING = ["MD5", "SHA1", "plain-text"] as const;
|
|
55
|
+
|
|
56
|
+
export const AUDIT_LOG_FIELDS = ["userId", "action", "resource", "timestamp", "ipAddress"] as const;
|
|
57
|
+
|
|
58
|
+
export const MUST_LOG_EVENTS = [
|
|
59
|
+
"authentication",
|
|
60
|
+
"authorization",
|
|
61
|
+
"data_export",
|
|
62
|
+
"role_changes",
|
|
63
|
+
"administrative_actions",
|
|
64
|
+
] as const;
|
|
65
|
+
|
|
66
|
+
export const MUST_NOT_LOG = ["passwords", "tokens", "private_keys", "sensitive_personal_data"] as const;
|
|
67
|
+
|
|
68
|
+
export const DB_AUDIT_COLUMNS = [
|
|
69
|
+
"created_at",
|
|
70
|
+
"updated_at",
|
|
71
|
+
"deleted_at",
|
|
72
|
+
"created_by",
|
|
73
|
+
"updated_by",
|
|
74
|
+
] as const;
|
|
75
|
+
|
|
76
|
+
export const GES_DIR = ".ges";
|
|
77
|
+
export const COMPLIANCE_DIR = "compliance";
|
|
78
|
+
export const SECURITY_DIR = "security";
|
|
79
|
+
export const CONTROLS_DIR = "controls";
|
|
80
|
+
export const POLICIES_DIR = "policies";
|
|
81
|
+
export const CHECKLISTS_DIR = "checklists";
|
|
82
|
+
export const DOCS_DIR = "docs";
|
|
83
|
+
export const REPORTS_DIR = "reports";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ProjectTypeSchema = z.enum([
|
|
4
|
+
"saas",
|
|
5
|
+
"ai-application",
|
|
6
|
+
"mcp-server",
|
|
7
|
+
"blockchain",
|
|
8
|
+
"wallet",
|
|
9
|
+
"government-system",
|
|
10
|
+
"healthcare-system",
|
|
11
|
+
"event-platform",
|
|
12
|
+
"photo-storage-platform",
|
|
13
|
+
"vulnerability-scanner",
|
|
14
|
+
"generic-web-application",
|
|
15
|
+
"api-backend",
|
|
16
|
+
"mobile-application",
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
export const FrameworkNameSchema = z.enum([
|
|
20
|
+
"GDPR",
|
|
21
|
+
"OWASP",
|
|
22
|
+
"CIS",
|
|
23
|
+
"NIST",
|
|
24
|
+
"ISO27001",
|
|
25
|
+
"ISO27701",
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
export const DataClassificationSchema = z.enum([
|
|
29
|
+
"public",
|
|
30
|
+
"internal",
|
|
31
|
+
"confidential",
|
|
32
|
+
"restricted",
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
export const ControlStatusSchema = z.enum([
|
|
36
|
+
"pass",
|
|
37
|
+
"fail",
|
|
38
|
+
"warning",
|
|
39
|
+
"not-applicable",
|
|
40
|
+
"not-implemented",
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
export const ReportFormatSchema = z.enum(["markdown", "html", "pdf"]);
|
|
44
|
+
|
|
45
|
+
export const RequirementConfigSchema = z.object({
|
|
46
|
+
required: z.boolean(),
|
|
47
|
+
level: z.enum(["mandatory", "recommended", "optional"]).optional(),
|
|
48
|
+
notes: z.string().optional(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const ProjectConfigSchema = z.object({
|
|
52
|
+
project_name: z.string().min(1),
|
|
53
|
+
project_type: ProjectTypeSchema,
|
|
54
|
+
frameworks: z.array(FrameworkNameSchema).min(1),
|
|
55
|
+
requirements: z.object({
|
|
56
|
+
encryption: RequirementConfigSchema,
|
|
57
|
+
mfa: RequirementConfigSchema,
|
|
58
|
+
audit_logs: RequirementConfigSchema,
|
|
59
|
+
backups: RequirementConfigSchema,
|
|
60
|
+
retention_policy: RequirementConfigSchema,
|
|
61
|
+
vulnerability_scanning: RequirementConfigSchema,
|
|
62
|
+
authentication: RequirementConfigSchema,
|
|
63
|
+
authorization: RequirementConfigSchema,
|
|
64
|
+
secrets_management: RequirementConfigSchema,
|
|
65
|
+
logging: RequirementConfigSchema,
|
|
66
|
+
monitoring: RequirementConfigSchema,
|
|
67
|
+
data_classification: RequirementConfigSchema,
|
|
68
|
+
disaster_recovery: RequirementConfigSchema,
|
|
69
|
+
incident_response: RequirementConfigSchema,
|
|
70
|
+
privacy_controls: RequirementConfigSchema,
|
|
71
|
+
}),
|
|
72
|
+
created_at: z.string(),
|
|
73
|
+
version: z.string(),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const ControlCheckSchema = z.object({
|
|
77
|
+
id: z.string(),
|
|
78
|
+
description: z.string(),
|
|
79
|
+
status: ControlStatusSchema,
|
|
80
|
+
evidence: z.string().optional(),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const ControlSchema = z.object({
|
|
84
|
+
id: z.string(),
|
|
85
|
+
name: z.string(),
|
|
86
|
+
description: z.string(),
|
|
87
|
+
category: z.string(),
|
|
88
|
+
framework: FrameworkNameSchema,
|
|
89
|
+
article: z.string().optional(),
|
|
90
|
+
status: ControlStatusSchema.default("not-implemented"),
|
|
91
|
+
severity: z.enum(["critical", "high", "medium", "low"]),
|
|
92
|
+
implementation_guidance: z.string(),
|
|
93
|
+
checks: z.array(ControlCheckSchema),
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const AuditEntrySchema = z.object({
|
|
97
|
+
userId: z.string(),
|
|
98
|
+
action: z.string(),
|
|
99
|
+
resource: z.string(),
|
|
100
|
+
timestamp: z.string(),
|
|
101
|
+
ipAddress: z.string(),
|
|
102
|
+
metadata: z.record(z.unknown()).optional(),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const ReportOptionsSchema = z.object({
|
|
106
|
+
format: ReportFormatSchema,
|
|
107
|
+
title: z.string(),
|
|
108
|
+
include_executive_summary: z.boolean(),
|
|
109
|
+
include_risk_assessment: z.boolean(),
|
|
110
|
+
include_compliance: z.boolean(),
|
|
111
|
+
include_security: z.boolean(),
|
|
112
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export type ProjectType =
|
|
2
|
+
| "saas"
|
|
3
|
+
| "ai-application"
|
|
4
|
+
| "mcp-server"
|
|
5
|
+
| "blockchain"
|
|
6
|
+
| "wallet"
|
|
7
|
+
| "government-system"
|
|
8
|
+
| "healthcare-system"
|
|
9
|
+
| "event-platform"
|
|
10
|
+
| "photo-storage-platform"
|
|
11
|
+
| "vulnerability-scanner"
|
|
12
|
+
| "generic-web-application"
|
|
13
|
+
| "api-backend"
|
|
14
|
+
| "mobile-application";
|
|
15
|
+
|
|
16
|
+
export type FrameworkName =
|
|
17
|
+
| "GDPR"
|
|
18
|
+
| "OWASP"
|
|
19
|
+
| "CIS"
|
|
20
|
+
| "NIST"
|
|
21
|
+
| "ISO27001"
|
|
22
|
+
| "ISO27701";
|
|
23
|
+
|
|
24
|
+
export type DataClassification = "public" | "internal" | "confidential" | "restricted";
|
|
25
|
+
|
|
26
|
+
export type ControlStatus = "pass" | "fail" | "warning" | "not-applicable" | "not-implemented";
|
|
27
|
+
|
|
28
|
+
export type ReportFormat = "markdown" | "html" | "pdf";
|
|
29
|
+
|
|
30
|
+
export interface ProjectConfig {
|
|
31
|
+
project_name: string;
|
|
32
|
+
project_type: ProjectType;
|
|
33
|
+
frameworks: FrameworkName[];
|
|
34
|
+
requirements: Requirements;
|
|
35
|
+
created_at: string;
|
|
36
|
+
version: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Requirements {
|
|
40
|
+
encryption: RequirementConfig;
|
|
41
|
+
mfa: RequirementConfig;
|
|
42
|
+
audit_logs: RequirementConfig;
|
|
43
|
+
backups: RequirementConfig;
|
|
44
|
+
retention_policy: RequirementConfig;
|
|
45
|
+
vulnerability_scanning: RequirementConfig;
|
|
46
|
+
authentication: RequirementConfig;
|
|
47
|
+
authorization: RequirementConfig;
|
|
48
|
+
secrets_management: RequirementConfig;
|
|
49
|
+
logging: RequirementConfig;
|
|
50
|
+
monitoring: RequirementConfig;
|
|
51
|
+
data_classification: RequirementConfig;
|
|
52
|
+
disaster_recovery: RequirementConfig;
|
|
53
|
+
incident_response: RequirementConfig;
|
|
54
|
+
privacy_controls: RequirementConfig;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface RequirementConfig {
|
|
58
|
+
required: boolean;
|
|
59
|
+
level?: "mandatory" | "recommended" | "optional";
|
|
60
|
+
notes?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface Control {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
category: string;
|
|
68
|
+
framework: FrameworkName;
|
|
69
|
+
article?: string;
|
|
70
|
+
status: ControlStatus;
|
|
71
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
72
|
+
implementation_guidance: string;
|
|
73
|
+
checks: ControlCheck[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ControlCheck {
|
|
77
|
+
id: string;
|
|
78
|
+
description: string;
|
|
79
|
+
status: ControlStatus;
|
|
80
|
+
evidence?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface ComplianceScore {
|
|
84
|
+
framework: FrameworkName;
|
|
85
|
+
score: number;
|
|
86
|
+
total_controls: number;
|
|
87
|
+
passed_controls: number;
|
|
88
|
+
failed_controls: number;
|
|
89
|
+
warning_controls: number;
|
|
90
|
+
not_applicable: number;
|
|
91
|
+
evaluated_at: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface ScoreFile {
|
|
95
|
+
overall: number;
|
|
96
|
+
frameworks: Record<string, ComplianceScore>;
|
|
97
|
+
evaluated_at: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface AuditEntry {
|
|
101
|
+
userId: string;
|
|
102
|
+
action: string;
|
|
103
|
+
resource: string;
|
|
104
|
+
timestamp: string;
|
|
105
|
+
ipAddress: string;
|
|
106
|
+
metadata?: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface PolicyPack {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
description: string;
|
|
113
|
+
version: string;
|
|
114
|
+
project_types: ProjectType[];
|
|
115
|
+
controls: Control[];
|
|
116
|
+
frameworks: FrameworkName[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface FrameworkVersion {
|
|
120
|
+
gesf_version: string;
|
|
121
|
+
packs: Record<string, string>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface Metadata {
|
|
125
|
+
project_name: string;
|
|
126
|
+
project_type: ProjectType;
|
|
127
|
+
initialized_at: string;
|
|
128
|
+
gesf_version: string;
|
|
129
|
+
last_audit?: string;
|
|
130
|
+
last_score?: string;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ReportOptions {
|
|
134
|
+
format: ReportFormat;
|
|
135
|
+
title: string;
|
|
136
|
+
include_executive_summary: boolean;
|
|
137
|
+
include_risk_assessment: boolean;
|
|
138
|
+
include_compliance: boolean;
|
|
139
|
+
include_security: boolean;
|
|
140
|
+
}
|