gog-safe 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/README.md +148 -0
- package/dist/audit.d.ts +10 -0
- package/dist/audit.js +9 -0
- package/dist/audit.js.map +1 -0
- package/dist/command-control.d.ts +12 -0
- package/dist/command-control.js +49 -0
- package/dist/command-control.js.map +1 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/matching.d.ts +11 -0
- package/dist/matching.js +118 -0
- package/dist/matching.js.map +1 -0
- package/dist/policy.d.ts +4 -0
- package/dist/policy.js +310 -0
- package/dist/policy.js.map +1 -0
- package/dist/process.d.ts +13 -0
- package/dist/process.js +113 -0
- package/dist/process.js.map +1 -0
- package/dist/run.d.ts +8 -0
- package/dist/run.js +282 -0
- package/dist/run.js.map +1 -0
- package/dist/types.d.ts +88 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validators.d.ts +7 -0
- package/dist/validators.js +92 -0
- package/dist/validators.js.map +1 -0
- package/package.json +36 -0
package/dist/run.js
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { appendAuditLog } from "./audit.js";
|
|
2
|
+
import { buildForcedArgs, decideCommandAllowance, findForbiddenOverride, } from "./command-control.js";
|
|
3
|
+
import { parseArgv, resolveValidatorsForCommand } from "./matching.js";
|
|
4
|
+
import { loadEffectivePolicy } from "./policy.js";
|
|
5
|
+
import { runCommand } from "./process.js";
|
|
6
|
+
import { runValidator } from "./validators.js";
|
|
7
|
+
function buildBaseOutput(command, version, allowed) {
|
|
8
|
+
return {
|
|
9
|
+
ok: false,
|
|
10
|
+
allowed,
|
|
11
|
+
command,
|
|
12
|
+
safety: {
|
|
13
|
+
action: "block",
|
|
14
|
+
reasons: [],
|
|
15
|
+
},
|
|
16
|
+
data: null,
|
|
17
|
+
meta: {
|
|
18
|
+
policy_version: version,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function asErrorMessage(error) {
|
|
23
|
+
if (error instanceof Error) {
|
|
24
|
+
return error.message;
|
|
25
|
+
}
|
|
26
|
+
return String(error);
|
|
27
|
+
}
|
|
28
|
+
function isObject(value) {
|
|
29
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30
|
+
}
|
|
31
|
+
async function finalizeWithAudit(outcome, auditFile, requireAuditSuccess, metadata) {
|
|
32
|
+
try {
|
|
33
|
+
await appendAuditLog(auditFile, {
|
|
34
|
+
timestamp: new Date().toISOString(),
|
|
35
|
+
command: outcome.output.command,
|
|
36
|
+
allowed: outcome.output.allowed,
|
|
37
|
+
ok: outcome.output.ok,
|
|
38
|
+
action: outcome.output.safety.action,
|
|
39
|
+
reasons: [...outcome.output.safety.reasons],
|
|
40
|
+
metadata,
|
|
41
|
+
});
|
|
42
|
+
return outcome;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
const updated = {
|
|
46
|
+
...outcome,
|
|
47
|
+
output: {
|
|
48
|
+
...outcome.output,
|
|
49
|
+
safety: {
|
|
50
|
+
...outcome.output.safety,
|
|
51
|
+
reasons: [...outcome.output.safety.reasons, "audit_log_write_failed"],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
stderrWarnings: [
|
|
55
|
+
...outcome.stderrWarnings,
|
|
56
|
+
`audit log write failed: ${asErrorMessage(error)}`,
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
if (!requireAuditSuccess) {
|
|
60
|
+
return updated;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
...updated,
|
|
64
|
+
exitCode: 2,
|
|
65
|
+
output: {
|
|
66
|
+
...updated.output,
|
|
67
|
+
ok: false,
|
|
68
|
+
safety: {
|
|
69
|
+
...updated.output.safety,
|
|
70
|
+
action: "block",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export async function executeRun(policyPath, userArgv) {
|
|
77
|
+
let loaded;
|
|
78
|
+
try {
|
|
79
|
+
loaded = await loadEffectivePolicy(policyPath);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return {
|
|
83
|
+
exitCode: 3,
|
|
84
|
+
output: {
|
|
85
|
+
ok: false,
|
|
86
|
+
allowed: false,
|
|
87
|
+
command: `gog ${userArgv.join(" ")}`.trim(),
|
|
88
|
+
safety: {
|
|
89
|
+
action: "block",
|
|
90
|
+
reasons: [`policy_error:${asErrorMessage(error)}`],
|
|
91
|
+
},
|
|
92
|
+
data: null,
|
|
93
|
+
meta: {
|
|
94
|
+
policy_version: 1,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
stderrWarnings: [],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const { effective } = loaded;
|
|
101
|
+
const command = `${effective.gog.binary} ${userArgv.join(" ")}`.trim();
|
|
102
|
+
const analyzed = parseArgv(userArgv);
|
|
103
|
+
const decision = decideCommandAllowance(analyzed.positionals, effective.commands.allow, effective.commands.deny);
|
|
104
|
+
let base = buildBaseOutput(command, effective.version, decision.allowed);
|
|
105
|
+
if (!decision.allowed) {
|
|
106
|
+
base.safety.reasons = decision.reasons;
|
|
107
|
+
const outcome = {
|
|
108
|
+
exitCode: 2,
|
|
109
|
+
output: base,
|
|
110
|
+
stderrWarnings: [],
|
|
111
|
+
};
|
|
112
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
113
|
+
phase: "allow_deny",
|
|
114
|
+
policyPath: loaded.policyPath,
|
|
115
|
+
homeConfigPath: loaded.homeConfigPath,
|
|
116
|
+
projectConfigPath: loaded.projectConfigPath,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const forbidden = findForbiddenOverride(userArgv);
|
|
120
|
+
if (forbidden) {
|
|
121
|
+
base.safety.reasons = [`forbidden_option_override:${forbidden}`];
|
|
122
|
+
const outcome = {
|
|
123
|
+
exitCode: 2,
|
|
124
|
+
output: base,
|
|
125
|
+
stderrWarnings: [],
|
|
126
|
+
};
|
|
127
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
128
|
+
phase: "override_guard",
|
|
129
|
+
forbidden,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const gogArgs = buildForcedArgs(userArgv, {
|
|
133
|
+
enforceJson: effective.execution.enforce_json,
|
|
134
|
+
enforceNoInput: effective.execution.enforce_no_input,
|
|
135
|
+
account: effective.gog.account,
|
|
136
|
+
client: effective.gog.client,
|
|
137
|
+
});
|
|
138
|
+
const commandResult = await runCommand(effective.gog.binary, gogArgs, effective.execution.timeout_ms);
|
|
139
|
+
if (commandResult.timedOut) {
|
|
140
|
+
base.safety.reasons = ["gog_timeout"];
|
|
141
|
+
const outcome = {
|
|
142
|
+
exitCode: 3,
|
|
143
|
+
output: base,
|
|
144
|
+
stderrWarnings: commandResult.stderr ? [commandResult.stderr.trim()] : [],
|
|
145
|
+
};
|
|
146
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
147
|
+
phase: "gog_execution",
|
|
148
|
+
timedOut: true,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
if (commandResult.spawnError) {
|
|
152
|
+
base.safety.reasons = ["gog_spawn_error"];
|
|
153
|
+
const outcome = {
|
|
154
|
+
exitCode: 3,
|
|
155
|
+
output: base,
|
|
156
|
+
stderrWarnings: [asErrorMessage(commandResult.spawnError)],
|
|
157
|
+
};
|
|
158
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
159
|
+
phase: "gog_execution",
|
|
160
|
+
spawnError: asErrorMessage(commandResult.spawnError),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (commandResult.exitCode !== 0) {
|
|
164
|
+
base.safety.reasons = [`gog_exit_${commandResult.exitCode ?? "unknown"}`];
|
|
165
|
+
const outcome = {
|
|
166
|
+
exitCode: 3,
|
|
167
|
+
output: {
|
|
168
|
+
...base,
|
|
169
|
+
data: {
|
|
170
|
+
stderr: commandResult.stderr.trim(),
|
|
171
|
+
stdout: commandResult.stdout.trim(),
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
stderrWarnings: commandResult.stderr ? [commandResult.stderr.trim()] : [],
|
|
175
|
+
};
|
|
176
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
177
|
+
phase: "gog_execution",
|
|
178
|
+
exitCode: commandResult.exitCode,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
let parsedOutput;
|
|
182
|
+
try {
|
|
183
|
+
parsedOutput = JSON.parse(commandResult.stdout);
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
base.safety.reasons = ["gog_output_invalid_json"];
|
|
187
|
+
const outcome = {
|
|
188
|
+
exitCode: 3,
|
|
189
|
+
output: {
|
|
190
|
+
...base,
|
|
191
|
+
data: {
|
|
192
|
+
stdout: commandResult.stdout,
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
stderrWarnings: [],
|
|
196
|
+
};
|
|
197
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
198
|
+
phase: "gog_output_parse",
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (!isObject(parsedOutput)) {
|
|
202
|
+
base.safety.reasons = ["gog_output_invalid_schema"];
|
|
203
|
+
const outcome = {
|
|
204
|
+
exitCode: 3,
|
|
205
|
+
output: {
|
|
206
|
+
...base,
|
|
207
|
+
data: parsedOutput,
|
|
208
|
+
},
|
|
209
|
+
stderrWarnings: [],
|
|
210
|
+
};
|
|
211
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
212
|
+
phase: "gog_output_schema",
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
const validatorNames = resolveValidatorsForCommand(effective.validation.rules, analyzed);
|
|
216
|
+
const validatorReasons = [];
|
|
217
|
+
for (const validatorName of validatorNames) {
|
|
218
|
+
const validatorConfig = effective.validation.validators[validatorName];
|
|
219
|
+
if (!validatorConfig) {
|
|
220
|
+
const outcome = {
|
|
221
|
+
exitCode: 2,
|
|
222
|
+
output: {
|
|
223
|
+
...base,
|
|
224
|
+
safety: {
|
|
225
|
+
action: "block",
|
|
226
|
+
reasons: [`validator_missing:${validatorName}`],
|
|
227
|
+
},
|
|
228
|
+
data: parsedOutput,
|
|
229
|
+
},
|
|
230
|
+
stderrWarnings: [],
|
|
231
|
+
};
|
|
232
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
233
|
+
phase: "validator",
|
|
234
|
+
validatorName,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
const validatorDecision = await runValidator(validatorName, validatorConfig, {
|
|
238
|
+
command,
|
|
239
|
+
argv: userArgv,
|
|
240
|
+
output: parsedOutput,
|
|
241
|
+
policy_version: effective.version,
|
|
242
|
+
});
|
|
243
|
+
validatorReasons.push(`validator:${validatorName}:${validatorDecision.reason}`);
|
|
244
|
+
if (validatorDecision.decision === "block") {
|
|
245
|
+
const outcome = {
|
|
246
|
+
exitCode: 2,
|
|
247
|
+
output: {
|
|
248
|
+
...base,
|
|
249
|
+
safety: {
|
|
250
|
+
action: "block",
|
|
251
|
+
reasons: [...validatorReasons],
|
|
252
|
+
},
|
|
253
|
+
data: parsedOutput,
|
|
254
|
+
},
|
|
255
|
+
stderrWarnings: [],
|
|
256
|
+
};
|
|
257
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
258
|
+
phase: "validator",
|
|
259
|
+
validatorName,
|
|
260
|
+
decision: "block",
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const outcome = {
|
|
265
|
+
exitCode: 0,
|
|
266
|
+
output: {
|
|
267
|
+
...base,
|
|
268
|
+
ok: true,
|
|
269
|
+
safety: {
|
|
270
|
+
action: "allow",
|
|
271
|
+
reasons: validatorReasons,
|
|
272
|
+
},
|
|
273
|
+
data: parsedOutput,
|
|
274
|
+
},
|
|
275
|
+
stderrWarnings: [],
|
|
276
|
+
};
|
|
277
|
+
return await finalizeWithAudit(outcome, effective.logging.audit_file, effective.logging.require_audit_success, {
|
|
278
|
+
phase: "completed",
|
|
279
|
+
validators: validatorNames,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C,SAAS,eAAe,CAAC,OAAe,EAAE,OAAe,EAAE,OAAgB;IACzE,OAAO;QACL,EAAE,EAAE,KAAK;QACT,OAAO;QACP,OAAO;QACP,MAAM,EAAE;YACN,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,EAAE;SACZ;QACD,IAAI,EAAE,IAAI;QACV,IAAI,EAAE;YACJ,cAAc,EAAE,OAAO;SACxB;KACF,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,YAAY,KAAK,EAAE,C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,CAAC,UAAU,EAC5B,SAAS,CAAC,OAAO,CAAC,qBAAqB,EACvC;QACE,KAAK,EAAE,WAAW;QAClB,UAAU,EAAE,cAAc;KAC3B,CACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export type SafetyAction = "allow" | "block";
|
|
2
|
+
export interface SafetySummary {
|
|
3
|
+
action: SafetyAction;
|
|
4
|
+
reasons: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface RunOutput {
|
|
7
|
+
ok: boolean;
|
|
8
|
+
allowed: boolean;
|
|
9
|
+
command: string;
|
|
10
|
+
safety: SafetySummary;
|
|
11
|
+
data: unknown;
|
|
12
|
+
meta: {
|
|
13
|
+
policy_version: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface GogConfig {
|
|
17
|
+
binary: string;
|
|
18
|
+
account: string;
|
|
19
|
+
client: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ExecutionConfig {
|
|
22
|
+
enforce_json: boolean;
|
|
23
|
+
enforce_no_input: boolean;
|
|
24
|
+
timeout_ms: number;
|
|
25
|
+
}
|
|
26
|
+
export interface CommandsConfig {
|
|
27
|
+
allow: string[];
|
|
28
|
+
deny: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface ValidationRule {
|
|
31
|
+
match: string;
|
|
32
|
+
validators: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface RegexValidatorConfig {
|
|
35
|
+
type: "regex";
|
|
36
|
+
config: {
|
|
37
|
+
patterns: string[];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface ExternalCommandValidatorConfig {
|
|
41
|
+
type: "external_command";
|
|
42
|
+
command: string;
|
|
43
|
+
args: string[];
|
|
44
|
+
timeout_ms: number;
|
|
45
|
+
}
|
|
46
|
+
export type ValidatorConfig = RegexValidatorConfig | ExternalCommandValidatorConfig;
|
|
47
|
+
export interface ValidationConfig {
|
|
48
|
+
rules: ValidationRule[];
|
|
49
|
+
validators: Record<string, ValidatorConfig>;
|
|
50
|
+
}
|
|
51
|
+
export interface LoggingConfig {
|
|
52
|
+
level: string;
|
|
53
|
+
audit_file: string;
|
|
54
|
+
require_audit_success: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface EffectivePolicy {
|
|
57
|
+
version: number;
|
|
58
|
+
gog: GogConfig;
|
|
59
|
+
execution: ExecutionConfig;
|
|
60
|
+
commands: CommandsConfig;
|
|
61
|
+
validation: ValidationConfig;
|
|
62
|
+
logging: LoggingConfig;
|
|
63
|
+
}
|
|
64
|
+
export interface PartialConfig {
|
|
65
|
+
version?: unknown;
|
|
66
|
+
gog?: Partial<GogConfig>;
|
|
67
|
+
execution?: Partial<ExecutionConfig>;
|
|
68
|
+
commands?: Partial<CommandsConfig>;
|
|
69
|
+
validation?: {
|
|
70
|
+
rules?: ValidationRule[];
|
|
71
|
+
validators?: Record<string, ValidatorConfig>;
|
|
72
|
+
};
|
|
73
|
+
logging?: Partial<LoggingConfig>;
|
|
74
|
+
}
|
|
75
|
+
export interface ArgvAnalysis {
|
|
76
|
+
positionals: string[];
|
|
77
|
+
options: Set<string>;
|
|
78
|
+
}
|
|
79
|
+
export interface ValidatorDecision {
|
|
80
|
+
decision: SafetyAction;
|
|
81
|
+
reason: string;
|
|
82
|
+
}
|
|
83
|
+
export interface LoadedConfigSet {
|
|
84
|
+
policyPath: string;
|
|
85
|
+
homeConfigPath?: string;
|
|
86
|
+
projectConfigPath?: string;
|
|
87
|
+
effective: EffectivePolicy;
|
|
88
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidatorConfig, ValidatorDecision } from "./types.js";
|
|
2
|
+
export declare function runValidator(validatorName: string, config: ValidatorConfig, context: {
|
|
3
|
+
command: string;
|
|
4
|
+
argv: string[];
|
|
5
|
+
output: unknown;
|
|
6
|
+
policy_version: number;
|
|
7
|
+
}): Promise<ValidatorDecision>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { runCommandWithJsonInput } from "./process.js";
|
|
2
|
+
function isObject(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
async function runRegexValidator(config, output) {
|
|
6
|
+
const serialized = JSON.stringify(output);
|
|
7
|
+
for (const pattern of config.config.patterns) {
|
|
8
|
+
try {
|
|
9
|
+
const re = new RegExp(pattern);
|
|
10
|
+
if (re.test(serialized)) {
|
|
11
|
+
return {
|
|
12
|
+
decision: "block",
|
|
13
|
+
reason: `regex_matched:${pattern}`,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return {
|
|
19
|
+
decision: "block",
|
|
20
|
+
reason: `regex_invalid:${pattern}`,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
decision: "allow",
|
|
26
|
+
reason: "regex_no_match",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async function runExternalValidator(config, payload) {
|
|
30
|
+
const result = await runCommandWithJsonInput(config.command, config.args, payload, config.timeout_ms);
|
|
31
|
+
if (result.timedOut) {
|
|
32
|
+
return {
|
|
33
|
+
decision: "block",
|
|
34
|
+
reason: "external_validator_timeout",
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (result.spawnError || result.writeError) {
|
|
38
|
+
return {
|
|
39
|
+
decision: "block",
|
|
40
|
+
reason: "external_validator_spawn_error",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (result.exitCode !== 0) {
|
|
44
|
+
return {
|
|
45
|
+
decision: "block",
|
|
46
|
+
reason: `external_validator_exit_${result.exitCode}`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
let parsed;
|
|
50
|
+
try {
|
|
51
|
+
parsed = JSON.parse(result.stdout);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return {
|
|
55
|
+
decision: "block",
|
|
56
|
+
reason: "external_validator_non_json_output",
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (!isObject(parsed)) {
|
|
60
|
+
return {
|
|
61
|
+
decision: "block",
|
|
62
|
+
reason: "external_validator_invalid_contract",
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const decision = parsed.decision;
|
|
66
|
+
const reason = parsed.reason;
|
|
67
|
+
if ((decision !== "allow" && decision !== "block")
|
|
68
|
+
|| typeof reason !== "string"
|
|
69
|
+
|| reason.trim().length === 0) {
|
|
70
|
+
return {
|
|
71
|
+
decision: "block",
|
|
72
|
+
reason: "external_validator_invalid_contract",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
decision,
|
|
77
|
+
reason,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export async function runValidator(validatorName, config, context) {
|
|
81
|
+
if (config.type === "regex") {
|
|
82
|
+
return await runRegexValidator(config, context.output);
|
|
83
|
+
}
|
|
84
|
+
if (config.type === "external_command") {
|
|
85
|
+
return await runExternalValidator(config, context);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
decision: "block",
|
|
89
|
+
reason: `unsupported_validator_type:${validatorName}`,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAQvD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;A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;QACjB,MAAM,EAAE,8BAA8B,aAAa,EAAE;KACtD,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gog-safe",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Policy-enforced wrapper for gog",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"gog-safe": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p tsconfig.json",
|
|
12
|
+
"dev": "tsx src/index.ts",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"typecheck": "tsc --noEmit"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=24"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"yaml": "^2.8.1"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^24.3.0",
|
|
24
|
+
"tsx": "^4.20.6",
|
|
25
|
+
"typescript": "^5.9.2",
|
|
26
|
+
"vitest": "^2.1.9"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [],
|
|
29
|
+
"author": "catnose <hello@catnose.me> (https://catnose.me)",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
]
|
|
36
|
+
}
|