pepr 0.42.1 → 0.42.3
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/dist/cli/build.helpers.d.ts +1 -1
- package/dist/cli/build.helpers.d.ts.map +1 -1
- package/dist/cli/deploy.d.ts +15 -0
- package/dist/cli/deploy.d.ts.map +1 -1
- package/dist/cli/dev.d.ts.map +1 -1
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.helpers.d.ts +3 -0
- package/dist/cli/format.helpers.d.ts.map +1 -0
- package/dist/cli/init/enums.d.ts +10 -0
- package/dist/cli/init/enums.d.ts.map +1 -0
- package/dist/cli/init/index.d.ts.map +1 -1
- package/dist/cli/init/templates.d.ts +15 -11
- package/dist/cli/init/templates.d.ts.map +1 -1
- package/dist/cli/init/utils.d.ts.map +1 -1
- package/dist/cli/init/walkthrough.d.ts +3 -2
- package/dist/cli/init/walkthrough.d.ts.map +1 -1
- package/dist/cli/kfc.d.ts.map +1 -1
- package/dist/cli/root.d.ts.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/uuid.d.ts.map +1 -1
- package/dist/cli.js +1073 -1220
- package/dist/controller.js +1 -195
- package/dist/fixtures/loader.d.ts.map +1 -1
- package/dist/lib/assets/assets.d.ts +27 -0
- package/dist/lib/assets/assets.d.ts.map +1 -0
- package/dist/lib/assets/deploy.d.ts +1 -1
- package/dist/lib/assets/deploy.d.ts.map +1 -1
- package/dist/lib/assets/index.d.ts +5 -24
- package/dist/lib/assets/index.d.ts.map +1 -1
- package/dist/lib/assets/pods.d.ts +2 -4
- package/dist/lib/assets/pods.d.ts.map +1 -1
- package/dist/lib/assets/rbac.d.ts.map +1 -1
- package/dist/lib/assets/webhooks.d.ts +1 -1
- package/dist/lib/assets/webhooks.d.ts.map +1 -1
- package/dist/lib/assets/yaml.d.ts +31 -5
- package/dist/lib/assets/yaml.d.ts.map +1 -1
- package/dist/lib/controller/index.d.ts +2 -2
- package/dist/lib/controller/index.d.ts.map +1 -1
- package/dist/lib/controller/store.d.ts +1 -1
- package/dist/lib/controller/store.d.ts.map +1 -1
- package/dist/lib/controller/storeCache.d.ts +1 -1
- package/dist/lib/controller/storeCache.d.ts.map +1 -1
- package/dist/lib/{capability.d.ts → core/capability.d.ts} +1 -1
- package/dist/lib/core/capability.d.ts.map +1 -0
- package/dist/lib/{module.d.ts → core/module.d.ts} +2 -2
- package/dist/lib/core/module.d.ts.map +1 -0
- package/dist/lib/core/queue.d.ts.map +1 -0
- package/dist/lib/{schedule.d.ts → core/schedule.d.ts} +0 -1
- package/dist/lib/core/schedule.d.ts.map +1 -0
- package/dist/lib/core/storage.d.ts.map +1 -0
- package/dist/lib/deploymentChecks.d.ts.map +1 -1
- package/dist/lib/errors.d.ts +0 -5
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/filesystemService.d.ts.map +1 -1
- package/dist/lib/filter/adjudicators/adjudicators.d.ts +5 -4
- package/dist/lib/filter/adjudicators/adjudicators.d.ts.map +1 -1
- package/dist/lib/filter/filter.d.ts +33 -1
- package/dist/lib/filter/filter.d.ts.map +1 -1
- package/dist/lib/finalizer.d.ts.map +1 -1
- package/dist/lib/helpers.d.ts +4 -9
- package/dist/lib/helpers.d.ts.map +1 -1
- package/dist/lib/included-files.d.ts.map +1 -1
- package/dist/lib/mutate-request.d.ts.map +1 -1
- package/dist/lib/processors/mutate-processor.d.ts +28 -0
- package/dist/lib/processors/mutate-processor.d.ts.map +1 -0
- package/dist/lib/{validate-processor.d.ts → processors/validate-processor.d.ts} +5 -5
- package/dist/lib/processors/validate-processor.d.ts.map +1 -0
- package/dist/lib/{watch-processor.d.ts → processors/watch-processor.d.ts} +2 -2
- package/dist/lib/processors/watch-processor.d.ts.map +1 -0
- package/dist/lib/telemetry/logger.d.ts.map +1 -1
- package/dist/lib/telemetry/metrics.d.ts.map +1 -1
- package/dist/lib/validate-request.d.ts +2 -2
- package/dist/lib/validate-request.d.ts.map +1 -1
- package/dist/lib.d.ts +2 -2
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +383 -243
- package/dist/lib.js.map +4 -4
- package/dist/sdk/heredoc.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/cli/build.helpers.ts +1 -1
- package/src/cli/build.ts +1 -1
- package/src/cli/deploy.ts +114 -75
- package/src/cli/dev.ts +3 -3
- package/src/cli/format.helpers.ts +27 -0
- package/src/cli/format.ts +4 -18
- package/src/cli/init/enums.ts +9 -0
- package/src/cli/init/index.ts +4 -3
- package/src/cli/init/templates.ts +30 -2
- package/src/cli/init/utils.ts +3 -3
- package/src/cli/init/walkthrough.ts +7 -8
- package/src/cli/kfc.ts +1 -1
- package/src/cli/root.ts +1 -1
- package/src/cli/update.ts +1 -1
- package/src/cli/uuid.ts +1 -1
- package/src/fixtures/loader.ts +2 -2
- package/src/lib/assets/assets.ts +176 -0
- package/src/lib/assets/deploy.ts +6 -6
- package/src/lib/assets/index.ts +10 -144
- package/src/lib/assets/pods.ts +2 -2
- package/src/lib/assets/webhooks.ts +32 -56
- package/src/lib/assets/yaml.ts +47 -25
- package/src/lib/controller/index.ts +4 -4
- package/src/lib/controller/store.ts +2 -2
- package/src/lib/controller/storeCache.ts +6 -2
- package/src/lib/{capability.ts → core/capability.ts} +4 -4
- package/src/lib/{module.ts → core/module.ts} +10 -10
- package/src/lib/{queue.ts → core/queue.ts} +1 -1
- package/src/lib/deploymentChecks.ts +2 -2
- package/src/lib/errors.ts +3 -8
- package/src/lib/filesystemService.ts +1 -1
- package/src/lib/filter/adjudicators/adjudicators.ts +40 -9
- package/src/lib/filter/filter.ts +204 -111
- package/src/lib/finalizer.ts +2 -2
- package/src/lib/helpers.ts +20 -133
- package/src/lib/included-files.ts +1 -1
- package/src/lib/processors/mutate-processor.ts +225 -0
- package/src/lib/{validate-processor.ts → processors/validate-processor.ts} +8 -8
- package/src/lib/{watch-processor.ts → processors/watch-processor.ts} +8 -8
- package/src/lib/telemetry/logger.ts +3 -1
- package/src/lib/tls.ts +5 -1
- package/src/lib/validate-request.ts +4 -4
- package/src/lib.ts +2 -2
- package/src/runtime/controller.ts +2 -2
- package/src/sdk/heredoc.ts +1 -1
- package/dist/lib/capability.d.ts.map +0 -1
- package/dist/lib/module.d.ts.map +0 -1
- package/dist/lib/mutate-processor.d.ts +0 -6
- package/dist/lib/mutate-processor.d.ts.map +0 -1
- package/dist/lib/queue.d.ts.map +0 -1
- package/dist/lib/schedule.d.ts.map +0 -1
- package/dist/lib/storage.d.ts.map +0 -1
- package/dist/lib/validate-processor.d.ts.map +0 -1
- package/dist/lib/watch-processor.d.ts.map +0 -1
- package/src/lib/mutate-processor.ts +0 -165
- /package/dist/lib/{queue.d.ts → core/queue.d.ts} +0 -0
- /package/dist/lib/{storage.d.ts → core/storage.d.ts} +0 -0
- /package/src/lib/{schedule.ts → core/schedule.ts} +0 -0
- /package/src/lib/{storage.ts → core/storage.ts} +0 -0
package/src/lib/helpers.ts
CHANGED
|
@@ -1,34 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
3
|
|
|
4
|
-
import { KubernetesObject } from "kubernetes-fluent-client";
|
|
5
4
|
import Log from "./telemetry/logger";
|
|
6
5
|
import { Binding, CapabilityExport } from "./types";
|
|
7
6
|
import { sanitizeResourceName } from "../sdk/sdk";
|
|
8
|
-
import {
|
|
9
|
-
carriedAnnotations,
|
|
10
|
-
carriedLabels,
|
|
11
|
-
carriedName,
|
|
12
|
-
carriedNamespace,
|
|
13
|
-
carriesIgnoredNamespace,
|
|
14
|
-
definedAnnotations,
|
|
15
|
-
definedLabels,
|
|
16
|
-
definedName,
|
|
17
|
-
definedNameRegex,
|
|
18
|
-
definedNamespaces,
|
|
19
|
-
definedNamespaceRegexes,
|
|
20
|
-
misboundNamespace,
|
|
21
|
-
mismatchedAnnotations,
|
|
22
|
-
mismatchedDeletionTimestamp,
|
|
23
|
-
mismatchedLabels,
|
|
24
|
-
mismatchedName,
|
|
25
|
-
mismatchedNameRegex,
|
|
26
|
-
mismatchedNamespace,
|
|
27
|
-
mismatchedNamespaceRegex,
|
|
28
|
-
missingCarriableNamespace,
|
|
29
|
-
unbindableNamespaces,
|
|
30
|
-
uncarryableNamespace,
|
|
31
|
-
} from "./filter/adjudicators/adjudicators";
|
|
32
7
|
|
|
33
8
|
export function matchesRegex(pattern: string, testString: string): boolean {
|
|
34
9
|
return new RegExp(pattern).test(testString);
|
|
@@ -55,100 +30,13 @@ export function validateHash(expectedHash: string): void {
|
|
|
55
30
|
}
|
|
56
31
|
}
|
|
57
32
|
|
|
58
|
-
|
|
33
|
+
type RBACMap = {
|
|
59
34
|
[key: string]: {
|
|
60
35
|
verbs: string[];
|
|
61
36
|
plural: string;
|
|
62
37
|
};
|
|
63
38
|
};
|
|
64
39
|
|
|
65
|
-
/**
|
|
66
|
-
* Decide to run callback after the event comes back from API Server
|
|
67
|
-
**/
|
|
68
|
-
export function filterNoMatchReason(
|
|
69
|
-
binding: Binding,
|
|
70
|
-
kubernetesObject: Partial<KubernetesObject>,
|
|
71
|
-
capabilityNamespaces: string[],
|
|
72
|
-
ignoredNamespaces?: string[],
|
|
73
|
-
): string {
|
|
74
|
-
const prefix = "Ignoring Watch Callback:";
|
|
75
|
-
|
|
76
|
-
// prettier-ignore
|
|
77
|
-
return (
|
|
78
|
-
mismatchedDeletionTimestamp(binding, kubernetesObject) ?
|
|
79
|
-
`${prefix} Binding defines deletionTimestamp but Object does not carry it.` :
|
|
80
|
-
|
|
81
|
-
mismatchedName(binding, kubernetesObject) ?
|
|
82
|
-
`${prefix} Binding defines name '${definedName(binding)}' but Object carries '${carriedName(kubernetesObject)}'.` :
|
|
83
|
-
|
|
84
|
-
misboundNamespace(binding) ?
|
|
85
|
-
`${prefix} Cannot use namespace filter on a namespace object.` :
|
|
86
|
-
|
|
87
|
-
mismatchedLabels(binding, kubernetesObject) ?
|
|
88
|
-
(
|
|
89
|
-
`${prefix} Binding defines labels '${JSON.stringify(definedLabels(binding))}' ` +
|
|
90
|
-
`but Object carries '${JSON.stringify(carriedLabels(kubernetesObject))}'.`
|
|
91
|
-
) :
|
|
92
|
-
|
|
93
|
-
mismatchedAnnotations(binding, kubernetesObject) ?
|
|
94
|
-
(
|
|
95
|
-
`${prefix} Binding defines annotations '${JSON.stringify(definedAnnotations(binding))}' ` +
|
|
96
|
-
`but Object carries '${JSON.stringify(carriedAnnotations(kubernetesObject))}'.`
|
|
97
|
-
) :
|
|
98
|
-
|
|
99
|
-
uncarryableNamespace(capabilityNamespaces, kubernetesObject) ?
|
|
100
|
-
(
|
|
101
|
-
`${prefix} Object carries namespace '${carriedNamespace(kubernetesObject)}' ` +
|
|
102
|
-
`but namespaces allowed by Capability are '${JSON.stringify(capabilityNamespaces)}'.`
|
|
103
|
-
) :
|
|
104
|
-
|
|
105
|
-
unbindableNamespaces(capabilityNamespaces, binding) ?
|
|
106
|
-
(
|
|
107
|
-
`${prefix} Binding defines namespaces ${JSON.stringify(definedNamespaces(binding))} ` +
|
|
108
|
-
`but namespaces allowed by Capability are '${JSON.stringify(capabilityNamespaces)}'.`
|
|
109
|
-
) :
|
|
110
|
-
|
|
111
|
-
mismatchedNamespace(binding, kubernetesObject) ?
|
|
112
|
-
(
|
|
113
|
-
`${prefix} Binding defines namespaces '${JSON.stringify(definedNamespaces(binding))}' ` +
|
|
114
|
-
`but Object carries '${carriedNamespace(kubernetesObject)}'.`
|
|
115
|
-
) :
|
|
116
|
-
|
|
117
|
-
mismatchedNamespaceRegex(binding, kubernetesObject) ?
|
|
118
|
-
(
|
|
119
|
-
`${prefix} Binding defines namespace regexes ` +
|
|
120
|
-
`'${JSON.stringify(definedNamespaceRegexes(binding))}' ` +
|
|
121
|
-
`but Object carries '${carriedNamespace(kubernetesObject)}'.`
|
|
122
|
-
) :
|
|
123
|
-
|
|
124
|
-
mismatchedNameRegex(binding, kubernetesObject) ?
|
|
125
|
-
(
|
|
126
|
-
`${prefix} Binding defines name regex '${definedNameRegex(binding)}' ` +
|
|
127
|
-
`but Object carries '${carriedName(kubernetesObject)}'.`
|
|
128
|
-
) :
|
|
129
|
-
|
|
130
|
-
carriesIgnoredNamespace(ignoredNamespaces, kubernetesObject) ?
|
|
131
|
-
(
|
|
132
|
-
`${prefix} Object carries namespace '${carriedNamespace(kubernetesObject)}' ` +
|
|
133
|
-
`but ignored namespaces include '${JSON.stringify(ignoredNamespaces)}'.`
|
|
134
|
-
) :
|
|
135
|
-
|
|
136
|
-
missingCarriableNamespace(capabilityNamespaces, kubernetesObject) ?
|
|
137
|
-
(
|
|
138
|
-
`${prefix} Object does not carry a namespace ` +
|
|
139
|
-
`but namespaces allowed by Capability are '${JSON.stringify(capabilityNamespaces)}'.`
|
|
140
|
-
) :
|
|
141
|
-
|
|
142
|
-
""
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export function addVerbIfNotExists(verbs: string[], verb: string) {
|
|
147
|
-
if (!verbs.includes(verb)) {
|
|
148
|
-
verbs.push(verb);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
40
|
export function createRBACMap(capabilities: CapabilityExport[]): RBACMap {
|
|
153
41
|
return capabilities.reduce((acc: RBACMap, capability: CapabilityExport) => {
|
|
154
42
|
capability.bindings.forEach(binding => {
|
|
@@ -200,11 +88,11 @@ export function hasAnyOverlap<T>(array1: T[], array2: T[]): boolean {
|
|
|
200
88
|
return array1.some(element => array2.includes(element));
|
|
201
89
|
}
|
|
202
90
|
|
|
203
|
-
export function ignoredNamespaceConflict(ignoreNamespaces: string[], bindingNamespaces: string[]) {
|
|
91
|
+
export function ignoredNamespaceConflict(ignoreNamespaces: string[], bindingNamespaces: string[]): boolean {
|
|
204
92
|
return hasAnyOverlap(bindingNamespaces, ignoreNamespaces);
|
|
205
93
|
}
|
|
206
94
|
|
|
207
|
-
export function bindingAndCapabilityNSConflict(bindingNamespaces: string[], capabilityNamespaces: string[]) {
|
|
95
|
+
export function bindingAndCapabilityNSConflict(bindingNamespaces: string[], capabilityNamespaces: string[]): boolean {
|
|
208
96
|
if (!capabilityNamespaces) {
|
|
209
97
|
return false;
|
|
210
98
|
}
|
|
@@ -215,7 +103,7 @@ export function generateWatchNamespaceError(
|
|
|
215
103
|
ignoredNamespaces: string[],
|
|
216
104
|
bindingNamespaces: string[],
|
|
217
105
|
capabilityNamespaces: string[],
|
|
218
|
-
) {
|
|
106
|
+
): string {
|
|
219
107
|
let err = "";
|
|
220
108
|
|
|
221
109
|
// check if binding uses an ignored namespace
|
|
@@ -237,7 +125,7 @@ export function generateWatchNamespaceError(
|
|
|
237
125
|
}
|
|
238
126
|
|
|
239
127
|
// namespaceComplianceValidator ensures that capability bindings respect ignored and capability namespaces
|
|
240
|
-
export function namespaceComplianceValidator(capability: CapabilityExport, ignoredNamespaces?: string[]) {
|
|
128
|
+
export function namespaceComplianceValidator(capability: CapabilityExport, ignoredNamespaces?: string[]): void {
|
|
241
129
|
const { namespaces: capabilityNamespaces, bindings, name } = capability;
|
|
242
130
|
const bindingNamespaces: string[] = bindings.flatMap((binding: Binding) => binding.filters.namespaces);
|
|
243
131
|
const bindingRegexNamespaces: string[] = bindings.flatMap(
|
|
@@ -256,13 +144,16 @@ export function namespaceComplianceValidator(capability: CapabilityExport, ignor
|
|
|
256
144
|
}
|
|
257
145
|
|
|
258
146
|
// Ensure that each regexNamespace matches a capabilityNamespace
|
|
147
|
+
matchRegexToCapababilityNamespace(bindingRegexNamespaces, capabilityNamespaces);
|
|
148
|
+
// ensure regexNamespaces do not match ignored ns
|
|
149
|
+
checkRegexNamespaces(bindingRegexNamespaces, ignoredNamespaces);
|
|
150
|
+
}
|
|
259
151
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
) {
|
|
152
|
+
const matchRegexToCapababilityNamespace = (
|
|
153
|
+
bindingRegexNamespaces: string[],
|
|
154
|
+
capabilityNamespaces: string[] | undefined,
|
|
155
|
+
): void => {
|
|
156
|
+
if (bindingRegexNamespaces.length > 0 && capabilityNamespaces && capabilityNamespaces.length > 0) {
|
|
266
157
|
for (const regexNamespace of bindingRegexNamespaces) {
|
|
267
158
|
let matches = false;
|
|
268
159
|
matches =
|
|
@@ -275,13 +166,10 @@ export function namespaceComplianceValidator(capability: CapabilityExport, ignor
|
|
|
275
166
|
}
|
|
276
167
|
}
|
|
277
168
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
ignoredNamespaces &&
|
|
283
|
-
ignoredNamespaces.length > 0
|
|
284
|
-
) {
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const checkRegexNamespaces = (bindingRegexNamespaces: string[], ignoredNamespaces: string[] | undefined): void => {
|
|
172
|
+
if (bindingRegexNamespaces.length > 0 && ignoredNamespaces && ignoredNamespaces.length > 0) {
|
|
285
173
|
for (const regexNamespace of bindingRegexNamespaces) {
|
|
286
174
|
const matchedNS = ignoredNamespaces.find(ignoredNS => matchesRegex(regexNamespace, ignoredNS));
|
|
287
175
|
if (matchedNS) {
|
|
@@ -291,7 +179,7 @@ export function namespaceComplianceValidator(capability: CapabilityExport, ignor
|
|
|
291
179
|
}
|
|
292
180
|
}
|
|
293
181
|
}
|
|
294
|
-
}
|
|
182
|
+
};
|
|
295
183
|
|
|
296
184
|
// check if secret is over the size limit
|
|
297
185
|
export function secretOverLimit(str: string): boolean {
|
|
@@ -302,8 +190,7 @@ export function secretOverLimit(str: string): boolean {
|
|
|
302
190
|
return sizeInBytes > oneMiBInBytes;
|
|
303
191
|
}
|
|
304
192
|
|
|
305
|
-
|
|
306
|
-
export const parseTimeout = (value: string, previous: unknown): number => {
|
|
193
|
+
export const parseTimeout = (value: string): number => {
|
|
307
194
|
const parsedValue = parseInt(value, 10);
|
|
308
195
|
const floatValue = parseFloat(value);
|
|
309
196
|
if (isNaN(parsedValue)) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { promises as fs } from "fs";
|
|
5
5
|
|
|
6
|
-
export async function createDockerfile(version: string, description: string, includedFiles: string[]) {
|
|
6
|
+
export async function createDockerfile(version: string, description: string, includedFiles: string[]): Promise<void> {
|
|
7
7
|
const file = `
|
|
8
8
|
# Use an official Node.js runtime as the base image
|
|
9
9
|
FROM ghcr.io/defenseunicorns/pepr/controller:v${version}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
|
+
|
|
4
|
+
import jsonPatch from "fast-json-patch";
|
|
5
|
+
import { kind, KubernetesObject } from "kubernetes-fluent-client";
|
|
6
|
+
import { clone } from "ramda";
|
|
7
|
+
|
|
8
|
+
import { Capability } from "../core/capability";
|
|
9
|
+
import { shouldSkipRequest } from "../filter/filter";
|
|
10
|
+
import { MutateResponse } from "../k8s";
|
|
11
|
+
import { AdmissionRequest, Binding } from "../types";
|
|
12
|
+
import Log from "../telemetry/logger";
|
|
13
|
+
import { ModuleConfig } from "../core/module";
|
|
14
|
+
import { PeprMutateRequest } from "../mutate-request";
|
|
15
|
+
import { base64Encode, convertFromBase64Map, convertToBase64Map } from "../utils";
|
|
16
|
+
import { OnError } from "../../cli/init/enums";
|
|
17
|
+
|
|
18
|
+
export interface Bindable {
|
|
19
|
+
req: AdmissionRequest;
|
|
20
|
+
config: ModuleConfig;
|
|
21
|
+
name: string;
|
|
22
|
+
namespaces: string[];
|
|
23
|
+
binding: Binding;
|
|
24
|
+
actMeta: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Result {
|
|
28
|
+
wrapped: PeprMutateRequest<KubernetesObject>;
|
|
29
|
+
response: MutateResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Add annotations to the request to indicate that the capability started processing
|
|
33
|
+
// this will allow tracking of failed mutations that were permitted to continue
|
|
34
|
+
export function updateStatus(
|
|
35
|
+
config: ModuleConfig,
|
|
36
|
+
name: string,
|
|
37
|
+
wrapped: PeprMutateRequest<KubernetesObject>,
|
|
38
|
+
status: string,
|
|
39
|
+
): PeprMutateRequest<KubernetesObject> {
|
|
40
|
+
// Only update the status if the request is a CREATE or UPDATE (we don't use CONNECT)
|
|
41
|
+
if (wrapped.Request.operation === "DELETE") {
|
|
42
|
+
return wrapped;
|
|
43
|
+
}
|
|
44
|
+
wrapped.SetAnnotation(`${config.uuid}.pepr.dev/${name}`, status);
|
|
45
|
+
|
|
46
|
+
return wrapped;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function logMutateErrorMessage(e: Error): string {
|
|
50
|
+
try {
|
|
51
|
+
if (e.message && e.message !== "[object Object]") {
|
|
52
|
+
return e.message;
|
|
53
|
+
} else {
|
|
54
|
+
throw new Error("An error occurred in the mutate action.");
|
|
55
|
+
}
|
|
56
|
+
} catch (e) {
|
|
57
|
+
return "An error occurred with the mutate action.";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function decodeData(wrapped: PeprMutateRequest<KubernetesObject>): {
|
|
62
|
+
skipped: string[];
|
|
63
|
+
wrapped: PeprMutateRequest<KubernetesObject>;
|
|
64
|
+
} {
|
|
65
|
+
let skipped: string[] = [];
|
|
66
|
+
|
|
67
|
+
const isSecret = wrapped.Request.kind.version === "v1" && wrapped.Request.kind.kind === "Secret";
|
|
68
|
+
if (isSecret) {
|
|
69
|
+
// convertFromBase64Map modifies it's arg rather than returing a mod'ed copy (ye olde side-effect special, blerg)
|
|
70
|
+
skipped = convertFromBase64Map(wrapped.Raw as unknown as kind.Secret);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return { skipped, wrapped };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function reencodeData(wrapped: PeprMutateRequest<KubernetesObject>, skipped: string[]): KubernetesObject {
|
|
77
|
+
const transformed = clone(wrapped.Raw);
|
|
78
|
+
|
|
79
|
+
const isSecret = wrapped.Request.kind.version === "v1" && wrapped.Request.kind.kind === "Secret";
|
|
80
|
+
if (isSecret) {
|
|
81
|
+
// convertToBase64Map modifies it's arg rather than returing a mod'ed copy (ye olde side-effect special, blerg)
|
|
82
|
+
convertToBase64Map(transformed as unknown as kind.Secret, skipped);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return transformed;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export async function processRequest(
|
|
89
|
+
bindable: Bindable,
|
|
90
|
+
wrapped: PeprMutateRequest<KubernetesObject>,
|
|
91
|
+
response: MutateResponse,
|
|
92
|
+
): Promise<Result> {
|
|
93
|
+
const { binding, actMeta, name, config } = bindable;
|
|
94
|
+
|
|
95
|
+
const label = binding.mutateCallback!.name;
|
|
96
|
+
Log.info(actMeta, `Processing mutation action (${label})`);
|
|
97
|
+
|
|
98
|
+
wrapped = updateStatus(config, name, wrapped, "started");
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
// Run the action
|
|
102
|
+
await binding.mutateCallback!(wrapped);
|
|
103
|
+
|
|
104
|
+
// Log on success
|
|
105
|
+
Log.info(actMeta, `Mutation action succeeded (${label})`);
|
|
106
|
+
|
|
107
|
+
// Add annotations to the request to indicate that the capability succeeded
|
|
108
|
+
wrapped = updateStatus(config, name, wrapped, "succeeded");
|
|
109
|
+
} catch (e) {
|
|
110
|
+
wrapped = updateStatus(config, name, wrapped, "warning");
|
|
111
|
+
response.warnings = response.warnings || [];
|
|
112
|
+
|
|
113
|
+
const errorMessage = logMutateErrorMessage(e);
|
|
114
|
+
|
|
115
|
+
// Log on failure
|
|
116
|
+
Log.error(actMeta, `Action failed: ${errorMessage}`);
|
|
117
|
+
response.warnings.push(`Action failed: ${errorMessage}`);
|
|
118
|
+
|
|
119
|
+
switch (config.onError) {
|
|
120
|
+
case OnError.REJECT:
|
|
121
|
+
response.result = "Pepr module configured to reject on error";
|
|
122
|
+
break;
|
|
123
|
+
|
|
124
|
+
case OnError.AUDIT:
|
|
125
|
+
response.auditAnnotations = response.auditAnnotations || {};
|
|
126
|
+
response.auditAnnotations[Date.now()] = `Action failed: ${errorMessage}`;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return { wrapped, response };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* eslint max-statements: ["warn", 25] */
|
|
135
|
+
export async function mutateProcessor(
|
|
136
|
+
config: ModuleConfig,
|
|
137
|
+
capabilities: Capability[],
|
|
138
|
+
req: AdmissionRequest,
|
|
139
|
+
reqMetadata: Record<string, string>,
|
|
140
|
+
): Promise<MutateResponse> {
|
|
141
|
+
let response: MutateResponse = {
|
|
142
|
+
uid: req.uid,
|
|
143
|
+
warnings: [],
|
|
144
|
+
allowed: false,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const decoded = decodeData(new PeprMutateRequest(req));
|
|
148
|
+
let wrapped = decoded.wrapped;
|
|
149
|
+
|
|
150
|
+
Log.info(reqMetadata, `Processing request`);
|
|
151
|
+
|
|
152
|
+
let bindables: Bindable[] = capabilities.flatMap(capa =>
|
|
153
|
+
capa.bindings.map(bind => ({
|
|
154
|
+
req,
|
|
155
|
+
config,
|
|
156
|
+
name: capa.name,
|
|
157
|
+
namespaces: capa.namespaces,
|
|
158
|
+
binding: bind,
|
|
159
|
+
actMeta: { ...reqMetadata, name: capa.name },
|
|
160
|
+
})),
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
bindables = bindables.filter(bind => {
|
|
164
|
+
if (!bind.binding.mutateCallback) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const shouldSkip = shouldSkipRequest(
|
|
169
|
+
bind.binding,
|
|
170
|
+
bind.req,
|
|
171
|
+
bind.namespaces,
|
|
172
|
+
bind.config?.alwaysIgnore?.namespaces,
|
|
173
|
+
);
|
|
174
|
+
if (shouldSkip !== "") {
|
|
175
|
+
Log.debug(shouldSkip);
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return true;
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
for (const bindable of bindables) {
|
|
183
|
+
({ wrapped, response } = await processRequest(bindable, wrapped, response));
|
|
184
|
+
if (config.onError === OnError.REJECT && response?.warnings!.length > 0) {
|
|
185
|
+
return response;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// If we've made it this far, the request is allowed
|
|
190
|
+
response.allowed = true;
|
|
191
|
+
|
|
192
|
+
// If no capability matched the request, exit early
|
|
193
|
+
if (bindables.length === 0) {
|
|
194
|
+
Log.info(reqMetadata, `No matching actions found`);
|
|
195
|
+
return response;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// delete operations can't be mutate, just return before the transformation
|
|
199
|
+
if (req.operation === "DELETE") {
|
|
200
|
+
return response;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// unskip base64-encoded data fields that were skipDecode'd
|
|
204
|
+
const transformed = reencodeData(wrapped, decoded.skipped);
|
|
205
|
+
|
|
206
|
+
// Compare the original request to the modified request to get the patches
|
|
207
|
+
const patches = jsonPatch.compare(req.object, transformed);
|
|
208
|
+
|
|
209
|
+
// Only add the patch if there are patches to apply
|
|
210
|
+
if (patches.length > 0) {
|
|
211
|
+
response.patchType = "JSONPatch";
|
|
212
|
+
// Webhook must be base64-encoded
|
|
213
|
+
// https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#response
|
|
214
|
+
response.patch = base64Encode(JSON.stringify(patches));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Remove the warnings array if it's empty
|
|
218
|
+
if (response.warnings && response.warnings.length < 1) {
|
|
219
|
+
delete response.warnings;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
Log.debug({ ...reqMetadata, patches }, `Patches generated`);
|
|
223
|
+
|
|
224
|
+
return response;
|
|
225
|
+
}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
3
|
|
|
4
4
|
import { kind, KubernetesObject } from "kubernetes-fluent-client";
|
|
5
|
-
import { Capability } from "
|
|
6
|
-
import { shouldSkipRequest } from "
|
|
7
|
-
import { ValidateResponse } from "
|
|
8
|
-
import { AdmissionRequest, Binding } from "
|
|
9
|
-
import Log from "
|
|
10
|
-
import { convertFromBase64Map } from "
|
|
11
|
-
import { PeprValidateRequest } from "
|
|
12
|
-
import { ModuleConfig } from "
|
|
5
|
+
import { Capability } from "../core/capability";
|
|
6
|
+
import { shouldSkipRequest } from "../filter/filter";
|
|
7
|
+
import { ValidateResponse } from "../k8s";
|
|
8
|
+
import { AdmissionRequest, Binding } from "../types";
|
|
9
|
+
import Log from "../telemetry/logger";
|
|
10
|
+
import { convertFromBase64Map } from "../utils";
|
|
11
|
+
import { PeprValidateRequest } from "../validate-request";
|
|
12
|
+
import { ModuleConfig } from "../core/module";
|
|
13
13
|
|
|
14
14
|
export async function processRequest(
|
|
15
15
|
binding: Binding,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
|
+
import Log from "../telemetry/logger";
|
|
4
|
+
import { Binding } from "../types";
|
|
5
|
+
import { Capability } from "../core/capability";
|
|
6
|
+
import { Event } from "../enums";
|
|
3
7
|
import { K8s, KubernetesObject, WatchCfg, WatchEvent } from "kubernetes-fluent-client";
|
|
8
|
+
import { Queue } from "../core/queue";
|
|
4
9
|
import { WatchPhase } from "kubernetes-fluent-client/dist/fluent/types";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { removeFinalizer } from "
|
|
8
|
-
import Log from "./telemetry/logger";
|
|
9
|
-
import { Queue } from "./queue";
|
|
10
|
-
import { Binding } from "./types";
|
|
11
|
-
import { Event } from "./enums";
|
|
12
|
-
import { metricsCollector } from "./telemetry/metrics";
|
|
10
|
+
import { filterNoMatchReason } from "../filter/filter";
|
|
11
|
+
import { metricsCollector } from "../telemetry/metrics";
|
|
12
|
+
import { removeFinalizer } from "../finalizer";
|
|
13
13
|
|
|
14
14
|
// stores Queue instances
|
|
15
15
|
const queues: Record<string, Queue<KubernetesObject>> = {};
|
|
@@ -18,7 +18,9 @@ const pretty = {
|
|
|
18
18
|
const transport = isPrettyLog ? pretty : undefined;
|
|
19
19
|
// epochTime is the pino default
|
|
20
20
|
const pinoTimeFunction =
|
|
21
|
-
process.env.PINO_TIME_STAMP === "iso"
|
|
21
|
+
process.env.PINO_TIME_STAMP === "iso"
|
|
22
|
+
? (): string => stdTimeFunctions.isoTime()
|
|
23
|
+
: (): string => stdTimeFunctions.epochTime();
|
|
22
24
|
const Log = pino({
|
|
23
25
|
transport,
|
|
24
26
|
timestamp: pinoTimeFunction,
|
package/src/lib/tls.ts
CHANGED
|
@@ -62,7 +62,11 @@ export function genTLS(name: string): TLSOut {
|
|
|
62
62
|
return { ca, key, crt, pem };
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
function genCert(
|
|
65
|
+
function genCert(
|
|
66
|
+
key: forge.pki.rsa.KeyPair,
|
|
67
|
+
name: string,
|
|
68
|
+
issuer: forge.pki.CertificateField[],
|
|
69
|
+
): forge.pki.Certificate {
|
|
66
70
|
const crt = forge.pki.createCertificate();
|
|
67
71
|
crt.publicKey = key.publicKey;
|
|
68
72
|
crt.serialNumber = "01";
|
|
@@ -23,7 +23,7 @@ export class PeprValidateRequest<T extends KubernetesObject> {
|
|
|
23
23
|
* Provides access to the old resource in the request if available.
|
|
24
24
|
* @returns The old Kubernetes resource object or null if not available.
|
|
25
25
|
*/
|
|
26
|
-
get OldResource() {
|
|
26
|
+
get OldResource(): KubernetesObject | undefined {
|
|
27
27
|
return this.#input.oldObject;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -31,7 +31,7 @@ export class PeprValidateRequest<T extends KubernetesObject> {
|
|
|
31
31
|
* Provides access to the request object.
|
|
32
32
|
* @returns The request object containing the Kubernetes resource.
|
|
33
33
|
*/
|
|
34
|
-
get Request() {
|
|
34
|
+
get Request(): AdmissionRequest<KubernetesObject> {
|
|
35
35
|
return this.#input;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -61,7 +61,7 @@ export class PeprValidateRequest<T extends KubernetesObject> {
|
|
|
61
61
|
* @param key the label key to check
|
|
62
62
|
* @returns
|
|
63
63
|
*/
|
|
64
|
-
HasLabel = (key: string) => {
|
|
64
|
+
HasLabel = (key: string): boolean => {
|
|
65
65
|
return this.Raw.metadata?.labels?.[key] !== undefined;
|
|
66
66
|
};
|
|
67
67
|
|
|
@@ -71,7 +71,7 @@ export class PeprValidateRequest<T extends KubernetesObject> {
|
|
|
71
71
|
* @param key the annotation key to check
|
|
72
72
|
* @returns
|
|
73
73
|
*/
|
|
74
|
-
HasAnnotation = (key: string) => {
|
|
74
|
+
HasAnnotation = (key: string): boolean => {
|
|
75
75
|
return this.Raw.metadata?.annotations?.[key] !== undefined;
|
|
76
76
|
};
|
|
77
77
|
|
package/src/lib.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { K8s, RegisterKind, kind as a, fetch, fetchStatus, kind } from "kubernetes-fluent-client";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
|
|
4
|
-
import { Capability } from "./lib/capability";
|
|
4
|
+
import { Capability } from "./lib/core/capability";
|
|
5
5
|
import Log from "./lib/telemetry/logger";
|
|
6
|
-
import { PeprModule } from "./lib/module";
|
|
6
|
+
import { PeprModule } from "./lib/core/module";
|
|
7
7
|
import { PeprMutateRequest } from "./lib/mutate-request";
|
|
8
8
|
import * as PeprUtils from "./lib/utils";
|
|
9
9
|
import { PeprValidateRequest } from "./lib/validate-request";
|
|
@@ -14,7 +14,7 @@ import { peprStoreCRD } from "../lib/assets/store";
|
|
|
14
14
|
import { validateHash } from "../lib/helpers";
|
|
15
15
|
const { version } = packageJSON;
|
|
16
16
|
|
|
17
|
-
function runModule(expectedHash: string) {
|
|
17
|
+
function runModule(expectedHash: string): void {
|
|
18
18
|
const gzPath = `/app/load/module-${expectedHash}.js.gz`;
|
|
19
19
|
const jsPath = `/app/module-${expectedHash}.js`;
|
|
20
20
|
|
|
@@ -59,7 +59,7 @@ Log.info(`Pepr Controller (v${version})`);
|
|
|
59
59
|
|
|
60
60
|
const hash = process.argv[2];
|
|
61
61
|
|
|
62
|
-
const startup = async () => {
|
|
62
|
+
const startup = async (): Promise<void> => {
|
|
63
63
|
try {
|
|
64
64
|
Log.info("Applying the Pepr Store CRD if it doesn't exist");
|
|
65
65
|
await K8s(kind.CustomResourceDefinition).Apply(peprStoreCRD, { force: true });
|
package/src/sdk/heredoc.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Refs:
|
|
2
2
|
// - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
|
|
3
3
|
|
|
4
|
-
export function heredoc(strings: TemplateStringsArray, ...values: string[]) {
|
|
4
|
+
export function heredoc(strings: TemplateStringsArray, ...values: string[]): string {
|
|
5
5
|
// shuffle strings & expression values back together
|
|
6
6
|
const zipped = strings
|
|
7
7
|
.reduce((acc: string[], cur, idx) => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/lib/capability.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAA2B,MAAM,0BAA0B,CAAC;AAInG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAc,QAAQ,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EACL,OAAO,EAGP,aAAa,EACb,gBAAgB,EAQhB,YAAY,EACb,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,qBAAa,UAAW,YAAW,gBAAgB;;IASjD,WAAW,EAAE,OAAO,CAAC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"./k8s";
|
|
3
|
-
import { AdmissionRequest } from "./types";
|
|
4
|
-
import { ModuleConfig } from "./module";
|
|
5
|
-
export declare function mutateProcessor(config: ModuleConfig, capabilities: Capability[], req: AdmissionRequest, reqMetadata: Record<string, string>): Promise<MutateResponse>;
|
|
6
|
-
//# sourceMappingURL=mutate-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mutate-processor.d.ts","sourceRoot":"","sources":["../../src/lib/mutate-processor.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,GAAG,EAAE,gBAAgB,EACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,cAAc,CAAC,CAmIzB"}
|
package/dist/lib/queue.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/lib/queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAIxE,KAAK,aAAa,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAUjF;;GAEG;AACH,qBAAa,KAAK,CAAC,CAAC,SAAS,gBAAgB;;gBAM/B,IAAI,EAAE,MAAM;IAKxB,KAAK,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAA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AAG,IAAI,CAE/B;CAqBH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-processor.d.ts","sourceRoot":"","sources":["../../src/lib/validate-processor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,mBAAmB,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,GACzD,OAAO,CAAC,gBAAgB,CAAC,CAkC3B;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,GAAG,EAAE,gBAAgB,EACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAkC7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch-processor.d.ts","sourceRoot":"","sources":["../../src/lib/watch-processor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,gBAAgB,EAAY,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEvF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAQhC;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAkBtD;AAED,wBAAgB,gBAAg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