@lannguyensi/harness 0.48.0 → 0.50.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/CHANGELOG.md +825 -0
- package/dist/cli/add/index.js +15 -3
- package/dist/cli/add/index.js.map +1 -1
- package/dist/cli/apply/apply.js +19 -3
- package/dist/cli/apply/apply.js.map +1 -1
- package/dist/cli/approve/risk.d.ts +28 -2
- package/dist/cli/approve/risk.js +14 -4
- package/dist/cli/approve/risk.js.map +1 -1
- package/dist/cli/diff/index.js +22 -1
- package/dist/cli/diff/index.js.map +1 -1
- package/dist/cli/doctor/format.js +29 -2
- package/dist/cli/doctor/format.js.map +1 -1
- package/dist/cli/doctor/index.js +62 -3
- package/dist/cli/doctor/index.js.map +1 -1
- package/dist/cli/doctor/types.d.ts +57 -0
- package/dist/cli/explain-policy.d.ts +4 -1
- package/dist/cli/explain-policy.js +12 -2
- package/dist/cli/explain-policy.js.map +1 -1
- package/dist/cli/export.js +12 -1
- package/dist/cli/export.js.map +1 -1
- package/dist/cli/index.js +29 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/templates.d.ts +34 -1
- package/dist/cli/init/templates.js +137 -3
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/list.js +6 -0
- package/dist/cli/list.js.map +1 -1
- package/dist/cli/loader.js +15 -0
- package/dist/cli/loader.js.map +1 -1
- package/dist/cli/pack/hook-codex-pre-tool-use.js +11 -6
- package/dist/cli/pack/hook-codex-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-post-tool-use.d.ts +6 -4
- package/dist/cli/pack/hook-post-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-pre-tool-use.js +23 -22
- package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
- package/dist/cli/policy/intercept.js +59 -9
- package/dist/cli/policy/intercept.js.map +1 -1
- package/dist/cli/remove/index.d.ts +12 -0
- package/dist/cli/remove/index.js +89 -0
- package/dist/cli/remove/index.js.map +1 -1
- package/dist/cli/validate/checks.d.ts +49 -0
- package/dist/cli/validate/checks.js +416 -9
- package/dist/cli/validate/checks.js.map +1 -1
- package/dist/cli/validate/index.js +11 -0
- package/dist/cli/validate/index.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +2 -2
- package/dist/policy-packs/builtin/understanding-before-execution/index.js +33 -27
- package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js +2 -2
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +46 -8
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +71 -12
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +6 -3
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution.js +9 -8
- package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
- package/dist/runtime/bash-prefix-parse.d.ts +12 -1
- package/dist/runtime/bash-prefix-parse.js +2 -2
- package/dist/runtime/bash-prefix-parse.js.map +1 -1
- package/dist/runtime/command-normalize.d.ts +112 -0
- package/dist/runtime/command-normalize.js +169 -55
- package/dist/runtime/command-normalize.js.map +1 -1
- package/dist/runtime/deletion-target-resolve.d.ts +28 -0
- package/dist/runtime/deletion-target-resolve.js +1055 -0
- package/dist/runtime/deletion-target-resolve.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/intercept.js +17 -1
- package/dist/runtime/intercept.js.map +1 -1
- package/dist/runtime/kubectl-target-parse.d.ts +31 -0
- package/dist/runtime/kubectl-target-parse.js +249 -0
- package/dist/runtime/kubectl-target-parse.js.map +1 -0
- package/dist/runtime/read-only-bash.d.ts +11 -0
- package/dist/runtime/read-only-bash.js +288 -7
- package/dist/runtime/read-only-bash.js.map +1 -1
- package/dist/runtime/risk-classifier.js +14 -1
- package/dist/runtime/risk-classifier.js.map +1 -1
- package/dist/runtime/when-eval.d.ts +11 -2
- package/dist/runtime/when-eval.js +25 -0
- package/dist/runtime/when-eval.js.map +1 -1
- package/dist/runtime/workflow-policies.d.ts +164 -0
- package/dist/runtime/workflow-policies.js +439 -0
- package/dist/runtime/workflow-policies.js.map +1 -0
- package/dist/schema/index.d.ts +24 -0
- package/dist/schema/policies.d.ts +25 -0
- package/dist/schema/policies.js +29 -0
- package/dist/schema/policies.js.map +1 -1
- package/dist/schema/risk.d.ts +6 -0
- package/dist/schema/risk.js +80 -0
- package/dist/schema/risk.js.map +1 -1
- package/package.json +1 -1
package/dist/schema/index.d.ts
CHANGED
|
@@ -574,26 +574,31 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
574
574
|
"risk.category_in": z.ZodOptional<z.ZodArray<z.ZodEnum<["destructive", "data_loss", "production_mutation", "credential_access", "secret_exfiltration", "network_exfiltration", "deployment_change", "infrastructure_change", "privilege_escalation", "irreversible_action", "mass_update"]>, "many">>;
|
|
575
575
|
"environment.name": z.ZodOptional<z.ZodEnum<["production", "staging", "dev", "local", "unknown"]>>;
|
|
576
576
|
"action.reversible": z.ZodOptional<z.ZodBoolean>;
|
|
577
|
+
"action.deletion_target_unresolvable": z.ZodOptional<z.ZodLiteral<true>>;
|
|
577
578
|
}, "strict", z.ZodTypeAny, {
|
|
578
579
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
579
580
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
580
581
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
581
582
|
"action.reversible"?: boolean | undefined;
|
|
583
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
582
584
|
}, {
|
|
583
585
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
584
586
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
585
587
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
586
588
|
"action.reversible"?: boolean | undefined;
|
|
589
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
587
590
|
}>, {
|
|
588
591
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
589
592
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
590
593
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
591
594
|
"action.reversible"?: boolean | undefined;
|
|
595
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
592
596
|
}, {
|
|
593
597
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
594
598
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
595
599
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
596
600
|
"action.reversible"?: boolean | undefined;
|
|
601
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
597
602
|
}>>;
|
|
598
603
|
}, "strict", z.ZodTypeAny, {
|
|
599
604
|
name: string;
|
|
@@ -642,6 +647,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
642
647
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
643
648
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
644
649
|
"action.reversible"?: boolean | undefined;
|
|
650
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
645
651
|
} | undefined;
|
|
646
652
|
}, {
|
|
647
653
|
name: string;
|
|
@@ -690,6 +696,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
690
696
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
691
697
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
692
698
|
"action.reversible"?: boolean | undefined;
|
|
699
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
693
700
|
} | undefined;
|
|
694
701
|
}>, {
|
|
695
702
|
name: string;
|
|
@@ -738,6 +745,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
738
745
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
739
746
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
740
747
|
"action.reversible"?: boolean | undefined;
|
|
748
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
741
749
|
} | undefined;
|
|
742
750
|
}, {
|
|
743
751
|
name: string;
|
|
@@ -786,6 +794,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
786
794
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
787
795
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
788
796
|
"action.reversible"?: boolean | undefined;
|
|
797
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
789
798
|
} | undefined;
|
|
790
799
|
}>, "many">, {
|
|
791
800
|
name: string;
|
|
@@ -834,6 +843,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
834
843
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
835
844
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
836
845
|
"action.reversible"?: boolean | undefined;
|
|
846
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
837
847
|
} | undefined;
|
|
838
848
|
}[], {
|
|
839
849
|
name: string;
|
|
@@ -882,6 +892,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
882
892
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
883
893
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
884
894
|
"action.reversible"?: boolean | undefined;
|
|
895
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
885
896
|
} | undefined;
|
|
886
897
|
}[]>>;
|
|
887
898
|
policy_packs: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
@@ -963,6 +974,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
963
974
|
tool: string;
|
|
964
975
|
}>, "many">>;
|
|
965
976
|
degraded_fail_posture: z.ZodDefault<z.ZodEnum<["preserve_enforcement", "fail_open"]>>;
|
|
977
|
+
safe_deletion_roots: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
966
978
|
}, "strict", z.ZodTypeAny, {
|
|
967
979
|
classifiers: {
|
|
968
980
|
patterns: {
|
|
@@ -974,6 +986,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
974
986
|
tool: string;
|
|
975
987
|
}[];
|
|
976
988
|
degraded_fail_posture: "preserve_enforcement" | "fail_open";
|
|
989
|
+
safe_deletion_roots: string[];
|
|
977
990
|
}, {
|
|
978
991
|
classifiers?: {
|
|
979
992
|
patterns: {
|
|
@@ -985,6 +998,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
985
998
|
tool: string;
|
|
986
999
|
}[] | undefined;
|
|
987
1000
|
degraded_fail_posture?: "preserve_enforcement" | "fail_open" | undefined;
|
|
1001
|
+
safe_deletion_roots?: string[] | undefined;
|
|
988
1002
|
}>, {
|
|
989
1003
|
classifiers: {
|
|
990
1004
|
patterns: {
|
|
@@ -996,6 +1010,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
996
1010
|
tool: string;
|
|
997
1011
|
}[];
|
|
998
1012
|
degraded_fail_posture: "preserve_enforcement" | "fail_open";
|
|
1013
|
+
safe_deletion_roots: string[];
|
|
999
1014
|
}, {
|
|
1000
1015
|
classifiers?: {
|
|
1001
1016
|
patterns: {
|
|
@@ -1007,6 +1022,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1007
1022
|
tool: string;
|
|
1008
1023
|
}[] | undefined;
|
|
1009
1024
|
degraded_fail_posture?: "preserve_enforcement" | "fail_open" | undefined;
|
|
1025
|
+
safe_deletion_roots?: string[] | undefined;
|
|
1010
1026
|
}>>;
|
|
1011
1027
|
environments: z.ZodDefault<z.ZodEffects<z.ZodObject<{
|
|
1012
1028
|
resolvers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -2660,6 +2676,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2660
2676
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
2661
2677
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
2662
2678
|
"action.reversible"?: boolean | undefined;
|
|
2679
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
2663
2680
|
} | undefined;
|
|
2664
2681
|
}[];
|
|
2665
2682
|
policy_packs: {
|
|
@@ -2681,6 +2698,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2681
2698
|
tool: string;
|
|
2682
2699
|
}[];
|
|
2683
2700
|
degraded_fail_posture: "preserve_enforcement" | "fail_open";
|
|
2701
|
+
safe_deletion_roots: string[];
|
|
2684
2702
|
};
|
|
2685
2703
|
environments: {
|
|
2686
2704
|
resolvers: {
|
|
@@ -2974,6 +2992,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2974
2992
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
2975
2993
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
2976
2994
|
"action.reversible"?: boolean | undefined;
|
|
2995
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
2977
2996
|
} | undefined;
|
|
2978
2997
|
}[] | undefined;
|
|
2979
2998
|
policy_packs?: {
|
|
@@ -2995,6 +3014,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2995
3014
|
tool: string;
|
|
2996
3015
|
}[] | undefined;
|
|
2997
3016
|
degraded_fail_posture?: "preserve_enforcement" | "fail_open" | undefined;
|
|
3017
|
+
safe_deletion_roots?: string[] | undefined;
|
|
2998
3018
|
} | undefined;
|
|
2999
3019
|
environments?: {
|
|
3000
3020
|
resolvers?: {
|
|
@@ -3288,6 +3308,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3288
3308
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
3289
3309
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
3290
3310
|
"action.reversible"?: boolean | undefined;
|
|
3311
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
3291
3312
|
} | undefined;
|
|
3292
3313
|
}[];
|
|
3293
3314
|
policy_packs: {
|
|
@@ -3309,6 +3330,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3309
3330
|
tool: string;
|
|
3310
3331
|
}[];
|
|
3311
3332
|
degraded_fail_posture: "preserve_enforcement" | "fail_open";
|
|
3333
|
+
safe_deletion_roots: string[];
|
|
3312
3334
|
};
|
|
3313
3335
|
environments: {
|
|
3314
3336
|
resolvers: {
|
|
@@ -3602,6 +3624,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3602
3624
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
3603
3625
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
3604
3626
|
"action.reversible"?: boolean | undefined;
|
|
3627
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
3605
3628
|
} | undefined;
|
|
3606
3629
|
}[] | undefined;
|
|
3607
3630
|
policy_packs?: {
|
|
@@ -3623,6 +3646,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3623
3646
|
tool: string;
|
|
3624
3647
|
}[] | undefined;
|
|
3625
3648
|
degraded_fail_posture?: "preserve_enforcement" | "fail_open" | undefined;
|
|
3649
|
+
safe_deletion_roots?: string[] | undefined;
|
|
3626
3650
|
} | undefined;
|
|
3627
3651
|
environments?: {
|
|
3628
3652
|
resolvers?: {
|
|
@@ -77,26 +77,31 @@ export declare const PolicyWhenSchema: z.ZodEffects<z.ZodObject<{
|
|
|
77
77
|
"risk.category_in": z.ZodOptional<z.ZodArray<z.ZodEnum<["destructive", "data_loss", "production_mutation", "credential_access", "secret_exfiltration", "network_exfiltration", "deployment_change", "infrastructure_change", "privilege_escalation", "irreversible_action", "mass_update"]>, "many">>;
|
|
78
78
|
"environment.name": z.ZodOptional<z.ZodEnum<["production", "staging", "dev", "local", "unknown"]>>;
|
|
79
79
|
"action.reversible": z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
"action.deletion_target_unresolvable": z.ZodOptional<z.ZodLiteral<true>>;
|
|
80
81
|
}, "strict", z.ZodTypeAny, {
|
|
81
82
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
82
83
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
83
84
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
84
85
|
"action.reversible"?: boolean | undefined;
|
|
86
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
85
87
|
}, {
|
|
86
88
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
87
89
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
88
90
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
89
91
|
"action.reversible"?: boolean | undefined;
|
|
92
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
90
93
|
}>, {
|
|
91
94
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
92
95
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
93
96
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
94
97
|
"action.reversible"?: boolean | undefined;
|
|
98
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
95
99
|
}, {
|
|
96
100
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
97
101
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
98
102
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
99
103
|
"action.reversible"?: boolean | undefined;
|
|
104
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
100
105
|
}>;
|
|
101
106
|
export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
102
107
|
name: z.ZodString;
|
|
@@ -249,26 +254,31 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
249
254
|
"risk.category_in": z.ZodOptional<z.ZodArray<z.ZodEnum<["destructive", "data_loss", "production_mutation", "credential_access", "secret_exfiltration", "network_exfiltration", "deployment_change", "infrastructure_change", "privilege_escalation", "irreversible_action", "mass_update"]>, "many">>;
|
|
250
255
|
"environment.name": z.ZodOptional<z.ZodEnum<["production", "staging", "dev", "local", "unknown"]>>;
|
|
251
256
|
"action.reversible": z.ZodOptional<z.ZodBoolean>;
|
|
257
|
+
"action.deletion_target_unresolvable": z.ZodOptional<z.ZodLiteral<true>>;
|
|
252
258
|
}, "strict", z.ZodTypeAny, {
|
|
253
259
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
254
260
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
255
261
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
256
262
|
"action.reversible"?: boolean | undefined;
|
|
263
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
257
264
|
}, {
|
|
258
265
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
259
266
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
260
267
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
261
268
|
"action.reversible"?: boolean | undefined;
|
|
269
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
262
270
|
}>, {
|
|
263
271
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
264
272
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
265
273
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
266
274
|
"action.reversible"?: boolean | undefined;
|
|
275
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
267
276
|
}, {
|
|
268
277
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
269
278
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
270
279
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
271
280
|
"action.reversible"?: boolean | undefined;
|
|
281
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
272
282
|
}>>;
|
|
273
283
|
}, "strict", z.ZodTypeAny, {
|
|
274
284
|
name: string;
|
|
@@ -317,6 +327,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
317
327
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
318
328
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
319
329
|
"action.reversible"?: boolean | undefined;
|
|
330
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
320
331
|
} | undefined;
|
|
321
332
|
}, {
|
|
322
333
|
name: string;
|
|
@@ -365,6 +376,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
365
376
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
366
377
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
367
378
|
"action.reversible"?: boolean | undefined;
|
|
379
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
368
380
|
} | undefined;
|
|
369
381
|
}>, {
|
|
370
382
|
name: string;
|
|
@@ -413,6 +425,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
413
425
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
414
426
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
415
427
|
"action.reversible"?: boolean | undefined;
|
|
428
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
416
429
|
} | undefined;
|
|
417
430
|
}, {
|
|
418
431
|
name: string;
|
|
@@ -461,6 +474,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
461
474
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
462
475
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
463
476
|
"action.reversible"?: boolean | undefined;
|
|
477
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
464
478
|
} | undefined;
|
|
465
479
|
}>;
|
|
466
480
|
export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
@@ -614,26 +628,31 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
614
628
|
"risk.category_in": z.ZodOptional<z.ZodArray<z.ZodEnum<["destructive", "data_loss", "production_mutation", "credential_access", "secret_exfiltration", "network_exfiltration", "deployment_change", "infrastructure_change", "privilege_escalation", "irreversible_action", "mass_update"]>, "many">>;
|
|
615
629
|
"environment.name": z.ZodOptional<z.ZodEnum<["production", "staging", "dev", "local", "unknown"]>>;
|
|
616
630
|
"action.reversible": z.ZodOptional<z.ZodBoolean>;
|
|
631
|
+
"action.deletion_target_unresolvable": z.ZodOptional<z.ZodLiteral<true>>;
|
|
617
632
|
}, "strict", z.ZodTypeAny, {
|
|
618
633
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
619
634
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
620
635
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
621
636
|
"action.reversible"?: boolean | undefined;
|
|
637
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
622
638
|
}, {
|
|
623
639
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
624
640
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
625
641
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
626
642
|
"action.reversible"?: boolean | undefined;
|
|
643
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
627
644
|
}>, {
|
|
628
645
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
629
646
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
630
647
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
631
648
|
"action.reversible"?: boolean | undefined;
|
|
649
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
632
650
|
}, {
|
|
633
651
|
"risk.severity_at_least"?: "low" | "medium" | "high" | "critical" | undefined;
|
|
634
652
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
635
653
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
636
654
|
"action.reversible"?: boolean | undefined;
|
|
655
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
637
656
|
}>>;
|
|
638
657
|
}, "strict", z.ZodTypeAny, {
|
|
639
658
|
name: string;
|
|
@@ -682,6 +701,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
682
701
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
683
702
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
684
703
|
"action.reversible"?: boolean | undefined;
|
|
704
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
685
705
|
} | undefined;
|
|
686
706
|
}, {
|
|
687
707
|
name: string;
|
|
@@ -730,6 +750,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
730
750
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
731
751
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
732
752
|
"action.reversible"?: boolean | undefined;
|
|
753
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
733
754
|
} | undefined;
|
|
734
755
|
}>, {
|
|
735
756
|
name: string;
|
|
@@ -778,6 +799,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
778
799
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
779
800
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
780
801
|
"action.reversible"?: boolean | undefined;
|
|
802
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
781
803
|
} | undefined;
|
|
782
804
|
}, {
|
|
783
805
|
name: string;
|
|
@@ -826,6 +848,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
826
848
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
827
849
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
828
850
|
"action.reversible"?: boolean | undefined;
|
|
851
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
829
852
|
} | undefined;
|
|
830
853
|
}>, "many">, {
|
|
831
854
|
name: string;
|
|
@@ -874,6 +897,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
874
897
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
875
898
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
876
899
|
"action.reversible"?: boolean | undefined;
|
|
900
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
877
901
|
} | undefined;
|
|
878
902
|
}[], {
|
|
879
903
|
name: string;
|
|
@@ -922,6 +946,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
922
946
|
"risk.category_in"?: ("destructive" | "data_loss" | "production_mutation" | "credential_access" | "secret_exfiltration" | "network_exfiltration" | "deployment_change" | "infrastructure_change" | "privilege_escalation" | "irreversible_action" | "mass_update")[] | undefined;
|
|
923
947
|
"environment.name"?: "production" | "staging" | "dev" | "local" | "unknown" | undefined;
|
|
924
948
|
"action.reversible"?: boolean | undefined;
|
|
949
|
+
"action.deletion_target_unresolvable"?: true | undefined;
|
|
925
950
|
} | undefined;
|
|
926
951
|
}[]>;
|
|
927
952
|
export type Policy = z.infer<typeof PolicySchema>;
|
package/dist/schema/policies.js
CHANGED
|
@@ -111,6 +111,34 @@ export const PolicyUxSchema = z
|
|
|
111
111
|
// (`unknown` is matchable: unknown is not
|
|
112
112
|
// safe).
|
|
113
113
|
// action.reversible — envelope action reversibility flag.
|
|
114
|
+
// action.deletion_target_unresolvable — a deletion-verb command (`rm
|
|
115
|
+
// -r*`/`-f*`, `find ... -delete`, `git clean
|
|
116
|
+
// -f*`) whose target(s) could not be
|
|
117
|
+
// statically proven inside a declared
|
|
118
|
+
// `risk.safe_deletion_roots` entry. UNLIKE the
|
|
119
|
+
// four clauses above, this one is NEVER
|
|
120
|
+
// subject to the "unknown is not safe"
|
|
121
|
+
// fail-close: an action the deletion resolver
|
|
122
|
+
// does not recognize as a deletion verb at
|
|
123
|
+
// all does not satisfy this clause, so a
|
|
124
|
+
// policy gated purely on it does not need an
|
|
125
|
+
// `environment.name` scope to avoid firing on
|
|
126
|
+
// every unrelated unclassified command — see
|
|
127
|
+
// src/runtime/when-eval.ts and
|
|
128
|
+
// src/runtime/deletion-target-resolve.ts.
|
|
129
|
+
// ONLY `true` is a meaningful value (task
|
|
130
|
+
// d03af8f6, review round 2): a resolver
|
|
131
|
+
// verdict is either `unresolvable: true` (gate
|
|
132
|
+
// it) or the action never reaches this clause
|
|
133
|
+
// at all (a resolved-safe target or a
|
|
134
|
+
// non-deletion command both simply fail to
|
|
135
|
+
// match `true`) — `false` would match every
|
|
136
|
+
// non-deletion-verb command in the manifest
|
|
137
|
+
// (verdict `null` -> "actual" false -> equals
|
|
138
|
+
// declared `false`), which is never the
|
|
139
|
+
// intent of a `when:` clause naming this key.
|
|
140
|
+
// The schema accepts only the literal `true`;
|
|
141
|
+
// `false` is a validate-time error.
|
|
114
142
|
// An empty `when: {}` is rejected: it would be a silent no-op.
|
|
115
143
|
export const PolicyWhenSchema = z
|
|
116
144
|
.object({
|
|
@@ -118,6 +146,7 @@ export const PolicyWhenSchema = z
|
|
|
118
146
|
"risk.category_in": z.array(RiskCategorySchema).min(1).optional(),
|
|
119
147
|
"environment.name": MatchableEnvironmentSchema.optional(),
|
|
120
148
|
"action.reversible": z.boolean().optional(),
|
|
149
|
+
"action.deletion_target_unresolvable": z.literal(true).optional(),
|
|
121
150
|
})
|
|
122
151
|
.strict()
|
|
123
152
|
.superRefine((when, ctx) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../src/schema/policies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxC,U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EAAE;aAC5C,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/schema/risk.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare const RiskClassifierSchema: z.ZodObject<{
|
|
|
43
43
|
tool: string;
|
|
44
44
|
}>;
|
|
45
45
|
export declare const DegradedFailPostureSchema: z.ZodEnum<["preserve_enforcement", "fail_open"]>;
|
|
46
|
+
export declare const DEFAULT_SAFE_DELETION_ROOTS: string[];
|
|
46
47
|
export declare const RiskSchema: z.ZodEffects<z.ZodObject<{
|
|
47
48
|
classifiers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
48
49
|
name: z.ZodString;
|
|
@@ -86,6 +87,7 @@ export declare const RiskSchema: z.ZodEffects<z.ZodObject<{
|
|
|
86
87
|
tool: string;
|
|
87
88
|
}>, "many">>;
|
|
88
89
|
degraded_fail_posture: z.ZodDefault<z.ZodEnum<["preserve_enforcement", "fail_open"]>>;
|
|
90
|
+
safe_deletion_roots: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
89
91
|
}, "strict", z.ZodTypeAny, {
|
|
90
92
|
classifiers: {
|
|
91
93
|
patterns: {
|
|
@@ -97,6 +99,7 @@ export declare const RiskSchema: z.ZodEffects<z.ZodObject<{
|
|
|
97
99
|
tool: string;
|
|
98
100
|
}[];
|
|
99
101
|
degraded_fail_posture: "preserve_enforcement" | "fail_open";
|
|
102
|
+
safe_deletion_roots: string[];
|
|
100
103
|
}, {
|
|
101
104
|
classifiers?: {
|
|
102
105
|
patterns: {
|
|
@@ -108,6 +111,7 @@ export declare const RiskSchema: z.ZodEffects<z.ZodObject<{
|
|
|
108
111
|
tool: string;
|
|
109
112
|
}[] | undefined;
|
|
110
113
|
degraded_fail_posture?: "preserve_enforcement" | "fail_open" | undefined;
|
|
114
|
+
safe_deletion_roots?: string[] | undefined;
|
|
111
115
|
}>, {
|
|
112
116
|
classifiers: {
|
|
113
117
|
patterns: {
|
|
@@ -119,6 +123,7 @@ export declare const RiskSchema: z.ZodEffects<z.ZodObject<{
|
|
|
119
123
|
tool: string;
|
|
120
124
|
}[];
|
|
121
125
|
degraded_fail_posture: "preserve_enforcement" | "fail_open";
|
|
126
|
+
safe_deletion_roots: string[];
|
|
122
127
|
}, {
|
|
123
128
|
classifiers?: {
|
|
124
129
|
patterns: {
|
|
@@ -130,6 +135,7 @@ export declare const RiskSchema: z.ZodEffects<z.ZodObject<{
|
|
|
130
135
|
tool: string;
|
|
131
136
|
}[] | undefined;
|
|
132
137
|
degraded_fail_posture?: "preserve_enforcement" | "fail_open" | undefined;
|
|
138
|
+
safe_deletion_roots?: string[] | undefined;
|
|
133
139
|
}>;
|
|
134
140
|
export type DegradedFailPosture = z.infer<typeof DegradedFailPostureSchema>;
|
|
135
141
|
export type RiskSeverity = z.infer<typeof RiskSeveritySchema>;
|
package/dist/schema/risk.js
CHANGED
|
@@ -92,10 +92,40 @@ export const DegradedFailPostureSchema = z.enum([
|
|
|
92
92
|
"preserve_enforcement",
|
|
93
93
|
"fail_open",
|
|
94
94
|
]);
|
|
95
|
+
// Safe-deletion-root allowlist (task d03af8f6). `src/runtime/
|
|
96
|
+
// deletion-target-resolve.ts` statically resolves the target(s) of a
|
|
97
|
+
// deletion-verb command (`rm -r*`/`-f*`, `find ... -delete`/`-exec*`/
|
|
98
|
+
// `-execdir` with an `rm` payload, `git clean -f*`) and treats a target
|
|
99
|
+
// as safe only when it is an ABSOLUTE path that lies STRICTLY INSIDE one
|
|
100
|
+
// of these roots (a plain directory-prefix match against `root + "/"`;
|
|
101
|
+
// the root itself does not count, for EVERY verb alike — `find`'s own
|
|
102
|
+
// start point is removed by `-delete`/`-exec` the same way `rm`'s
|
|
103
|
+
// operand is, so it gets no root-equality exception either). An
|
|
104
|
+
// optional trailing `/**` or `/*` on an entry is stripped
|
|
105
|
+
// as documentation sugar before matching — it is not a real glob
|
|
106
|
+
// engine. A target the
|
|
107
|
+
// resolver cannot statically prove absolute and prefix-matched — an
|
|
108
|
+
// unexpanded `$VAR`/`${VAR}` reference, a `~`-relative path, a relative
|
|
109
|
+
// path, or a `..`-traversal that normalizes outside every root — is
|
|
110
|
+
// treated as UNRESOLVABLE, never guessed safe. The defaults cover the
|
|
111
|
+
// two spellings this harness's own scratchpad convention can use: a
|
|
112
|
+
// symlinked `/tmp` and its `/private/tmp` realpath (macOS); an operator
|
|
113
|
+
// who overrides this list REPLACES it, it does not merge with the
|
|
114
|
+
// default. See docs/risk-gate.md.
|
|
115
|
+
// Exported (not just used as the schema `.default()`) so runtime call
|
|
116
|
+
// sites can fall back to the same list for a hand-built `Manifest` that
|
|
117
|
+
// bypassed schema parsing entirely (every test fixture that constructs
|
|
118
|
+
// `{ risk: { classifiers: [...] } }` directly, without going through
|
|
119
|
+
// `RiskSchema.parse`) — see `src/runtime/intercept.ts` and
|
|
120
|
+
// `src/cli/explain-policy.ts`.
|
|
121
|
+
export const DEFAULT_SAFE_DELETION_ROOTS = ["/tmp", "/private/tmp"];
|
|
95
122
|
export const RiskSchema = z
|
|
96
123
|
.object({
|
|
97
124
|
classifiers: z.array(RiskClassifierSchema).default([]),
|
|
98
125
|
degraded_fail_posture: DegradedFailPostureSchema.default("preserve_enforcement"),
|
|
126
|
+
safe_deletion_roots: z
|
|
127
|
+
.array(z.string().min(1))
|
|
128
|
+
.default(DEFAULT_SAFE_DELETION_ROOTS),
|
|
99
129
|
})
|
|
100
130
|
.strict()
|
|
101
131
|
.superRefine((risk, ctx) => {
|
|
@@ -110,5 +140,55 @@ export const RiskSchema = z
|
|
|
110
140
|
}
|
|
111
141
|
seen.add(c.name);
|
|
112
142
|
});
|
|
143
|
+
// A filesystem-root entry — bare `/`, or anything that lexically
|
|
144
|
+
// NORMALIZES to `/` (`/.`, `/./`, `/tmp/..` — task d03af8f6, review
|
|
145
|
+
// round 3, LOW (d), widening review round 2 LOW (a)'s bare-`/`-only
|
|
146
|
+
// check) — would match every absolute path as "inside" it via the
|
|
147
|
+
// resolver's own `target.startsWith(root + "/")` prefix check —
|
|
148
|
+
// silently defeating the entire point of an allowlist. Rejected at
|
|
149
|
+
// parse time with a message rather than special-cased to "matches
|
|
150
|
+
// everything" at runtime, since an operator who wrote one of these
|
|
151
|
+
// spellings almost certainly meant a specific subdirectory.
|
|
152
|
+
// Non-absolute entries and ones containing `$`/`~` are a `harness
|
|
153
|
+
// validate` LINT instead (a warning, not a parse-time error) — see
|
|
154
|
+
// `checkSafeDeletionRootsSyntax` in `src/cli/validate/checks.ts`.
|
|
155
|
+
risk.safe_deletion_roots.forEach((root, i) => {
|
|
156
|
+
if (normalizesToFilesystemRoot(root)) {
|
|
157
|
+
ctx.addIssue({
|
|
158
|
+
code: z.ZodIssueCode.custom,
|
|
159
|
+
path: ["safe_deletion_roots", i],
|
|
160
|
+
message: `risk.safe_deletion_roots entry "${root}" normalizes to the filesystem root and can ` +
|
|
161
|
+
`never be a meaningful allowlist entry: every absolute deletion target would match ` +
|
|
162
|
+
`it as "inside," defeating the allowlist. Declare specific subdirectories instead ` +
|
|
163
|
+
`(e.g. "/tmp").`,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
});
|
|
113
167
|
});
|
|
168
|
+
/**
|
|
169
|
+
* `true` when `root` (trimmed) lexically collapses to the filesystem
|
|
170
|
+
* root `/` — bare `/`, any run of bare `/` characters, `/.`, `/./`, or a
|
|
171
|
+
* `..`-traversal that pops back to `/` (`/tmp/..`). Lexical only (no
|
|
172
|
+
* filesystem I/O, mirrors `deletion-target-resolve.ts`'s own
|
|
173
|
+
* `normalizePosixPath` in spirit — not imported from there: this is a
|
|
174
|
+
* schema-time validation, `deletion-target-resolve.ts` is a runtime
|
|
175
|
+
* module, and neither layer should depend on the other for a check this
|
|
176
|
+
* small).
|
|
177
|
+
*/
|
|
178
|
+
function normalizesToFilesystemRoot(root) {
|
|
179
|
+
const trimmed = root.trim();
|
|
180
|
+
if (!trimmed.startsWith("/"))
|
|
181
|
+
return false;
|
|
182
|
+
const out = [];
|
|
183
|
+
for (const part of trimmed.split("/")) {
|
|
184
|
+
if (part === "" || part === ".")
|
|
185
|
+
continue;
|
|
186
|
+
if (part === "..") {
|
|
187
|
+
out.pop();
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
out.push(part);
|
|
191
|
+
}
|
|
192
|
+
return out.length === 0;
|
|
193
|
+
}
|
|
114
194
|
//# sourceMappingURL=risk.js.map
|
package/dist/schema/risk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"risk.js","sourceRoot":"","sources":["../../src/schema/risk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4CAA4C;AAC5C,EAAE;AACF,iEAAiE;AACjE,qEAAqE;AACrE,oEAAoE;AACpE,uEAAuE;AACvE,kEAAkE;AAClE,mEAAmE;AACnE,wEAAwE;AACxE,qEAAqE;AACrE,+DAA+D;AAC/D,qBAAqB;AACrB,EAAE;AACF,0EAA0E;AAE1E,uEAAuE;AACvE,uEAAuE;AACvE,sEAAsE;AACtE,qEAAqE;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAEhF,wEAAwE;AACxE,uEAAuE;AACvE,wEAAwE;AACxE,uEAAuE;AACvE,8DAA8D;AAC9D,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,aAAa;IACb,WAAW;IACX,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;IACtB,mBAAmB;IACnB,uBAAuB;IACvB,sBAAsB;IACtB,qBAAqB;IACrB,aAAa;CACd,CAAC,CAAC;AAEH,kEAAkE;AAClE,qEAAqE;A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AAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACtC,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG;YAAE,SAAS;QAC1C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,GAAG,CAAC,GAAG,EAAE,CAAC;YACV,SAAS;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lannguyensi/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"description": "Declarative control plane for agent harnesses — one YAML for grounding, tools, memory, and hooks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/LanNguyenSi/harness",
|