@localstack/appinspector-ui 1.0.194 → 1.0.196
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/index.cjs +76 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +76 -54
- package/dist/index.js.map +1 -1
- package/dist/spans-worker.js +30 -12
- package/package.json +1 -1
package/dist/spans-worker.js
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
implicitDenies: payload.implicit_deny_count,
|
|
160
160
|
resources
|
|
161
161
|
},
|
|
162
|
+
enforcement: payload.enforcement,
|
|
162
163
|
operation: payload.operation,
|
|
163
164
|
permission,
|
|
164
165
|
principal: payload.principal_arn,
|
|
@@ -169,26 +170,43 @@
|
|
|
169
170
|
return void 0;
|
|
170
171
|
}
|
|
171
172
|
}
|
|
173
|
+
var getIamEvents = (span) => span.events.flatMap((event) => {
|
|
174
|
+
const payload = event.attributes?.payload;
|
|
175
|
+
if (!event.event_type?.toLowerCase().includes("iam") || typeof payload !== "string") return [];
|
|
176
|
+
return parseIAMEvent(payload) ?? [];
|
|
177
|
+
});
|
|
178
|
+
var getIamEnforcement = (span, events = getIamEvents(span)) => {
|
|
179
|
+
const enforcements = new Set(events.map((event) => event.enforcement).filter(Boolean));
|
|
180
|
+
if (enforcements.size > 0) {
|
|
181
|
+
if (enforcements.has("deny")) return "deny";
|
|
182
|
+
if (enforcements.has("warn")) return "warn";
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
return getIamEnforcementFromOperationStatus(span);
|
|
186
|
+
};
|
|
187
|
+
var getIamEnforcementFromOperationStatus = (span) => {
|
|
188
|
+
const status = span.operation_status;
|
|
189
|
+
if (status === "iam_explicit_deny" || status === "iam_implicit_deny") return "deny";
|
|
190
|
+
if (status === "iam_explicit_warn" || status === "iam_implicit_warn") return "warn";
|
|
191
|
+
return void 0;
|
|
192
|
+
};
|
|
172
193
|
|
|
173
194
|
// src/utils/span-issues.ts
|
|
174
195
|
var firstText = (...values) => values.find((value) => !!value) ?? void 0;
|
|
175
196
|
var OTEL_STATUS_ERROR = 2;
|
|
176
|
-
var getIamDenials = (span) => span.events.flatMap((event) => {
|
|
177
|
-
if (!event.event_type?.toLowerCase().includes("iam") || typeof event.attributes?.payload !== "string") {
|
|
178
|
-
return [];
|
|
179
|
-
}
|
|
180
|
-
const permission = parseIAMEvent(event.attributes.payload)?.permission;
|
|
181
|
-
if (permission === "explicitly_denied") return ["explicit"];
|
|
182
|
-
if (permission === "implicitly_denied") return ["implicit"];
|
|
183
|
-
return [];
|
|
184
|
-
});
|
|
185
197
|
var getSpanIssues = (span) => {
|
|
186
198
|
const status = span.operation_status;
|
|
187
|
-
const
|
|
188
|
-
const
|
|
199
|
+
const iamEvents = getIamEvents(span);
|
|
200
|
+
const enforcement = getIamEnforcement(span, iamEvents);
|
|
201
|
+
const iamDenied = enforcement === "deny";
|
|
202
|
+
const iamWarned = enforcement === "warn";
|
|
189
203
|
const errorMessages = (span.errors ?? []).filter((item) => item.level === "error");
|
|
190
204
|
const warningMessages = (span.errors ?? []).filter((item) => item.level === "warning");
|
|
191
|
-
const denials =
|
|
205
|
+
const denials = iamEvents.flatMap((event) => {
|
|
206
|
+
if (event.permission === "explicitly_denied") return ["explicit"];
|
|
207
|
+
if (event.permission === "implicitly_denied") return ["implicit"];
|
|
208
|
+
return [];
|
|
209
|
+
});
|
|
192
210
|
const unenforcedDenial = !iamDenied && (denials.length > 0 || span.attributes?.["localstack.has_iam_deny_event"] === true);
|
|
193
211
|
const error = status === "error" || iamDenied || span.status_code === OTEL_STATUS_ERROR || errorMessages.length > 0;
|
|
194
212
|
const warning = iamWarned || warningMessages.length > 0 || unenforcedDenial;
|