@agent-native/dispatch 0.15.1 → 0.15.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/actions/delete-staged-dataset.d.ts +3 -1
- package/dist/actions/delete-staged-dataset.js +3 -26
- package/dist/actions/delete-staged-dataset.js.map +1 -1
- package/dist/actions/delete-workspace-resource.d.ts +13 -13
- package/dist/actions/list-staged-datasets.d.ts +1 -1
- package/dist/actions/list-staged-datasets.js +3 -28
- package/dist/actions/list-staged-datasets.js.map +1 -1
- package/dist/actions/provider-api-catalog.d.ts +6 -4
- package/dist/actions/provider-api-catalog.js +3 -17
- package/dist/actions/provider-api-catalog.js.map +1 -1
- package/dist/actions/provider-api-docs.d.ts +21 -2
- package/dist/actions/provider-api-docs.js +6 -51
- package/dist/actions/provider-api-docs.js.map +1 -1
- package/dist/actions/provider-api-register.d.ts +39 -15
- package/dist/actions/provider-api-register.js +4 -193
- package/dist/actions/provider-api-register.js.map +1 -1
- package/dist/actions/provider-api-request.d.ts +34 -2
- package/dist/actions/provider-api-request.js +6 -171
- package/dist/actions/provider-api-request.js.map +1 -1
- package/dist/actions/query-staged-dataset.d.ts +18 -1
- package/dist/actions/query-staged-dataset.d.ts.map +1 -1
- package/dist/actions/query-staged-dataset.js +3 -100
- package/dist/actions/query-staged-dataset.js.map +1 -1
- package/dist/actions/upsert-destination.d.ts +12 -12
- package/dist/components/action-query-error.js +1 -1
- package/dist/components/action-query-error.js.map +1 -1
- package/dist/components/agents-panel.js +1 -1
- package/dist/components/agents-panel.js.map +1 -1
- package/dist/components/app-keys-popover.d.ts.map +1 -1
- package/dist/components/app-keys-popover.js +1 -1
- package/dist/components/app-keys-popover.js.map +1 -1
- package/dist/components/create-app-popover.js +5 -1
- package/dist/components/create-app-popover.js.map +1 -1
- package/dist/components/dispatch-control-plane.js +5 -1
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/dispatch-shell.js +1 -1
- package/dist/components/dispatch-shell.js.map +1 -1
- package/dist/components/layout/Header.d.ts.map +1 -1
- package/dist/components/layout/Header.js +2 -1
- package/dist/components/layout/Header.js.map +1 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +31 -65
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/messaging-setup-panel.d.ts.map +1 -1
- package/dist/components/messaging-setup-panel.js +2 -1
- package/dist/components/messaging-setup-panel.js.map +1 -1
- package/dist/components/task-queue-health.d.ts.map +1 -1
- package/dist/components/task-queue-health.js +2 -1
- package/dist/components/task-queue-health.js.map +1 -1
- package/dist/components/workspace-app-card.d.ts.map +1 -1
- package/dist/components/workspace-app-card.js +1 -1
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/components/workspace-resource-effective-stack.js +1 -1
- package/dist/components/workspace-resource-effective-stack.js.map +1 -1
- package/dist/components/workspace-resource-impact-preview.js +1 -1
- package/dist/components/workspace-resource-impact-preview.js.map +1 -1
- package/dist/components/workspace-template-card.js +1 -1
- package/dist/components/workspace-template-card.js.map +1 -1
- package/dist/hooks/use-navigation-state.d.ts.map +1 -1
- package/dist/hooks/use-navigation-state.js +2 -1
- package/dist/hooks/use-navigation-state.js.map +1 -1
- package/dist/lib/automations.js +1 -1
- package/dist/lib/automations.js.map +1 -1
- package/dist/lib/overview-chat.d.ts.map +1 -1
- package/dist/lib/overview-chat.js +2 -1
- package/dist/lib/overview-chat.js.map +1 -1
- package/dist/lib/task-queue.js +1 -1
- package/dist/lib/task-queue.js.map +1 -1
- package/dist/routes/pages/$appId.d.ts.map +1 -1
- package/dist/routes/pages/$appId.js +3 -1
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/_index.js +1 -1
- package/dist/routes/pages/_index.js.map +1 -1
- package/dist/routes/pages/agents.js +2 -1
- package/dist/routes/pages/agents.js.map +1 -1
- package/dist/routes/pages/approval.d.ts.map +1 -1
- package/dist/routes/pages/approval.js +3 -1
- package/dist/routes/pages/approval.js.map +1 -1
- package/dist/routes/pages/approvals.d.ts.map +1 -1
- package/dist/routes/pages/approvals.js +1 -1
- package/dist/routes/pages/approvals.js.map +1 -1
- package/dist/routes/pages/apps.$appId.d.ts.map +1 -1
- package/dist/routes/pages/apps.$appId.js +2 -1
- package/dist/routes/pages/apps.$appId.js.map +1 -1
- package/dist/routes/pages/apps.d.ts.map +1 -1
- package/dist/routes/pages/apps.js +2 -1
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/routes/pages/audit.js +1 -1
- package/dist/routes/pages/audit.js.map +1 -1
- package/dist/routes/pages/automations.d.ts.map +1 -1
- package/dist/routes/pages/automations.js +3 -1
- package/dist/routes/pages/automations.js.map +1 -1
- package/dist/routes/pages/chat.d.ts.map +1 -1
- package/dist/routes/pages/chat.js +3 -1
- package/dist/routes/pages/chat.js.map +1 -1
- package/dist/routes/pages/destinations.js +2 -1
- package/dist/routes/pages/destinations.js.map +1 -1
- package/dist/routes/pages/dreams.d.ts.map +1 -1
- package/dist/routes/pages/dreams.js +1 -1
- package/dist/routes/pages/dreams.js.map +1 -1
- package/dist/routes/pages/identities.d.ts.map +1 -1
- package/dist/routes/pages/identities.js +1 -1
- package/dist/routes/pages/identities.js.map +1 -1
- package/dist/routes/pages/integrations.d.ts.map +1 -1
- package/dist/routes/pages/integrations.js +1 -1
- package/dist/routes/pages/integrations.js.map +1 -1
- package/dist/routes/pages/metrics.d.ts.map +1 -1
- package/dist/routes/pages/metrics.js +2 -1
- package/dist/routes/pages/metrics.js.map +1 -1
- package/dist/routes/pages/new-app.d.ts.map +1 -1
- package/dist/routes/pages/new-app.js +2 -1
- package/dist/routes/pages/new-app.js.map +1 -1
- package/dist/routes/pages/operations.d.ts.map +1 -1
- package/dist/routes/pages/operations.js +3 -1
- package/dist/routes/pages/operations.js.map +1 -1
- package/dist/routes/pages/settings.d.ts.map +1 -1
- package/dist/routes/pages/settings.js +3 -1
- package/dist/routes/pages/settings.js.map +1 -1
- package/dist/routes/pages/thread-debug.d.ts.map +1 -1
- package/dist/routes/pages/thread-debug.js +2 -1
- package/dist/routes/pages/thread-debug.js.map +1 -1
- package/dist/routes/pages/vault.d.ts.map +1 -1
- package/dist/routes/pages/vault.js +1 -1
- package/dist/routes/pages/vault.js.map +1 -1
- package/dist/routes/pages/workspace.d.ts.map +1 -1
- package/dist/routes/pages/workspace.js +1 -1
- package/dist/routes/pages/workspace.js.map +1 -1
- package/package.json +4 -3
- package/src/actions/delete-staged-dataset.ts +3 -33
- package/src/actions/list-staged-datasets.ts +3 -30
- package/src/actions/provider-api-audit.spec.ts +2 -3
- package/src/actions/provider-api-catalog.ts +10 -23
- package/src/actions/provider-api-docs.ts +19 -68
- package/src/actions/provider-api-register.ts +5 -233
- package/src/actions/provider-api-request.ts +19 -232
- package/src/actions/query-staged-dataset.ts +3 -119
- package/src/components/action-query-error.spec.tsx +1 -1
- package/src/components/action-query-error.tsx +1 -1
- package/src/components/agents-panel.tsx +1 -1
- package/src/components/app-keys-popover.spec.tsx +4 -1
- package/src/components/app-keys-popover.tsx +4 -1
- package/src/components/create-app-popover.tsx +5 -5
- package/src/components/dispatch-control-plane.spec.tsx +20 -8
- package/src/components/dispatch-control-plane.tsx +5 -5
- package/src/components/dispatch-shell.tsx +1 -1
- package/src/components/layout/Header.tsx +2 -1
- package/src/components/layout/Layout.spec.tsx +24 -19
- package/src/components/layout/Layout.tsx +47 -151
- package/src/components/messaging-setup-panel.spec.tsx +4 -1
- package/src/components/messaging-setup-panel.tsx +2 -3
- package/src/components/task-queue-health.tsx +2 -1
- package/src/components/workspace-app-card.spec.tsx +1 -1
- package/src/components/workspace-app-card.tsx +4 -1
- package/src/components/workspace-resource-effective-stack.spec.tsx +1 -1
- package/src/components/workspace-resource-effective-stack.tsx +1 -1
- package/src/components/workspace-resource-impact-preview.spec.tsx +1 -1
- package/src/components/workspace-resource-impact-preview.tsx +1 -1
- package/src/components/workspace-template-card.spec.tsx +1 -1
- package/src/components/workspace-template-card.tsx +1 -1
- package/src/hooks/use-navigation-state.ts +5 -3
- package/src/lib/automations.ts +1 -1
- package/src/lib/overview-chat.spec.ts +5 -2
- package/src/lib/overview-chat.ts +2 -1
- package/src/lib/task-queue.ts +1 -1
- package/src/routes/pages/$appId.tsx +3 -1
- package/src/routes/pages/_index.tsx +1 -1
- package/src/routes/pages/agents.tsx +2 -2
- package/src/routes/pages/approval.tsx +4 -2
- package/src/routes/pages/approvals.tsx +4 -1
- package/src/routes/pages/apps.$appId.tsx +2 -1
- package/src/routes/pages/apps.tsx +2 -1
- package/src/routes/pages/audit.tsx +1 -1
- package/src/routes/pages/automations.tsx +3 -5
- package/src/routes/pages/chat.spec.tsx +15 -4
- package/src/routes/pages/chat.tsx +3 -4
- package/src/routes/pages/destinations.tsx +2 -2
- package/src/routes/pages/dreams.tsx +4 -1
- package/src/routes/pages/identities.tsx +4 -1
- package/src/routes/pages/integrations.tsx +4 -1
- package/src/routes/pages/metrics.tsx +2 -1
- package/src/routes/pages/new-app.tsx +2 -1
- package/src/routes/pages/operations.tsx +3 -5
- package/src/routes/pages/settings.tsx +4 -5
- package/src/routes/pages/thread-debug.tsx +2 -1
- package/src/routes/pages/vault.tsx +4 -1
- package/src/routes/pages/workspace.tsx +4 -1
- package/dist/actions/provider-api-audit.d.ts +0 -7
- package/dist/actions/provider-api-audit.d.ts.map +0 -1
- package/dist/actions/provider-api-audit.js +0 -74
- package/dist/actions/provider-api-audit.js.map +0 -1
- package/src/actions/provider-api-audit.ts +0 -88
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useActionMutation,
|
|
3
3
|
useActionQuery,
|
|
4
|
-
|
|
5
|
-
} from "@agent-native/core/client";
|
|
4
|
+
} from "@agent-native/core/client/hooks";
|
|
5
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
6
6
|
import { IconCheck, IconCopy, IconPlugConnected } from "@tabler/icons-react";
|
|
7
7
|
import { useMemo, useState } from "react";
|
|
8
8
|
import { toast } from "sonner";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { appPath } from "@agent-native/core/client/api-path";
|
|
1
2
|
import {
|
|
2
3
|
useActionMutation,
|
|
3
4
|
useActionQuery,
|
|
5
|
+
} from "@agent-native/core/client/hooks";
|
|
6
|
+
import {
|
|
4
7
|
isInAgentEmbed,
|
|
5
8
|
postNavigate,
|
|
6
|
-
|
|
7
|
-
} from "@agent-native/core/client";
|
|
9
|
+
} from "@agent-native/core/client/navigation";
|
|
8
10
|
import {
|
|
9
11
|
IconCheck,
|
|
10
12
|
IconX,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
useActionMutation,
|
|
3
|
+
useActionQuery,
|
|
4
|
+
} from "@agent-native/core/client/hooks";
|
|
2
5
|
import { useOrg } from "@agent-native/core/client/org";
|
|
3
6
|
import { useMemo, useState } from "react";
|
|
4
7
|
import { toast } from "sonner";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
useChangeVersions,
|
|
5
|
-
} from "@agent-native/core/client";
|
|
1
|
+
import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
|
|
2
|
+
import { PromptComposer } from "@agent-native/core/client/composer";
|
|
3
|
+
import { useChangeVersions } from "@agent-native/core/client/hooks";
|
|
6
4
|
import { IconPlus, IconSettingsAutomation } from "@tabler/icons-react";
|
|
7
5
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
8
6
|
import { useMemo, useState } from "react";
|
|
@@ -10,16 +10,27 @@ const clientState = vi.hoisted(() => ({
|
|
|
10
10
|
surfaceProps: null as Record<string, unknown> | null,
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
|
-
vi.mock("@agent-native/core/client", () => ({
|
|
13
|
+
vi.mock("@agent-native/core/client/agent-chat", () => ({
|
|
14
14
|
AgentChatSurface: (props: Record<string, unknown>) => {
|
|
15
15
|
clientState.surfaceProps = props;
|
|
16
16
|
return <>{props.composerSlot as ReactNode}</>;
|
|
17
17
|
},
|
|
18
|
-
appBasePath: () => "",
|
|
19
|
-
appPath: (path: string) => path,
|
|
20
|
-
isInBuilderFrame: () => false,
|
|
21
18
|
markAgentChatHomeHandoff: vi.fn(),
|
|
19
|
+
navigateWithAgentChatViewTransition: (
|
|
20
|
+
navigate: (path: string) => void,
|
|
21
|
+
path: string,
|
|
22
|
+
) => navigate(path),
|
|
22
23
|
sendToAgentChat: vi.fn(),
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
vi.mock("@agent-native/core/client/api-path", () => ({
|
|
27
|
+
agentNativePath: (path: string) => path,
|
|
28
|
+
appApiPath: (path: string) => path,
|
|
29
|
+
appBasePath: () => "",
|
|
30
|
+
appPath: (path: string) => path,
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
vi.mock("@agent-native/core/client/i18n", () => ({
|
|
23
34
|
useT: () => (key: string, values?: { defaultValue?: string }) =>
|
|
24
35
|
values?.defaultValue ?? key,
|
|
25
36
|
}));
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentChatSurface,
|
|
3
|
-
appBasePath,
|
|
4
|
-
appPath,
|
|
5
3
|
markAgentChatHomeHandoff,
|
|
6
|
-
|
|
7
|
-
} from "@agent-native/core/client";
|
|
4
|
+
} from "@agent-native/core/client/agent-chat";
|
|
5
|
+
import { appBasePath, appPath } from "@agent-native/core/client/api-path";
|
|
6
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
8
7
|
import {
|
|
9
8
|
useCallback,
|
|
10
9
|
useEffect,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useActionMutation,
|
|
3
3
|
useActionQuery,
|
|
4
|
-
|
|
5
|
-
} from "@agent-native/core/client";
|
|
4
|
+
} from "@agent-native/core/client/hooks";
|
|
5
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { toast } from "sonner";
|
|
8
8
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
useActionMutation,
|
|
3
|
+
useActionQuery,
|
|
4
|
+
} from "@agent-native/core/client/hooks";
|
|
2
5
|
import { toast } from "sonner";
|
|
3
6
|
|
|
4
7
|
import { ActionQueryError } from "../../components/action-query-error";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
useT,
|
|
5
|
-
} from "@agent-native/core/client";
|
|
1
|
+
import { DbAdminPage } from "@agent-native/core/client/db-admin";
|
|
2
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
3
|
+
import { ObservabilityDashboard } from "@agent-native/core/client/observability";
|
|
6
4
|
import {
|
|
7
5
|
IconActivity,
|
|
8
6
|
IconArrowUpRight,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { ChangelogSettingsCard } from "@agent-native/core/client/changelog";
|
|
2
|
+
import { LanguagePicker, useT } from "@agent-native/core/client/i18n";
|
|
3
|
+
import { TeamPage } from "@agent-native/core/client/org";
|
|
1
4
|
import {
|
|
2
|
-
ChangelogSettingsCard,
|
|
3
|
-
LanguagePicker,
|
|
4
5
|
SettingsTabsPage,
|
|
5
6
|
useAgentSettingsTabs,
|
|
6
|
-
|
|
7
|
-
} from "@agent-native/core/client";
|
|
8
|
-
import { TeamPage } from "@agent-native/core/client/org";
|
|
7
|
+
} from "@agent-native/core/client/settings";
|
|
9
8
|
import { Link } from "react-router";
|
|
10
9
|
|
|
11
10
|
import changelog from "../../../CHANGELOG.md?raw";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider-api-audit.d.ts","sourceRoot":"","sources":["../../src/actions/provider-api-audit.ts"],"names":[],"mappings":"AA8DA,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAclE;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GAAG,MAAM,CAKT"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const REDACTED = "[redacted]";
|
|
2
|
-
const CREDENTIAL_NAME = /^(?:api[-_]?key|access[-_]?token|auth(?:orization)?|bearer|credential|password|secret|signature|sig|token|x-amz-credential|x-amz-signature)$/i;
|
|
3
|
-
function decodePathSegment(segment) {
|
|
4
|
-
try {
|
|
5
|
-
return decodeURIComponent(segment);
|
|
6
|
-
}
|
|
7
|
-
catch {
|
|
8
|
-
return segment;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function looksLikeCredentialValue(segment) {
|
|
12
|
-
const value = decodePathSegment(segment);
|
|
13
|
-
if (/^eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(value)) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
if (/^(?:sk|pk|rk|ghp|github_pat|xox[baprs]|ya29|AIza)[-_][A-Za-z0-9_-]+$/i.test(value)) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
return value.length >= 32 && /^[A-Za-z0-9._~-]+$/.test(value);
|
|
20
|
-
}
|
|
21
|
-
function sanitizePathname(pathname) {
|
|
22
|
-
let redactNext = false;
|
|
23
|
-
return pathname
|
|
24
|
-
.split("/")
|
|
25
|
-
.map((segment) => {
|
|
26
|
-
if (!segment)
|
|
27
|
-
return segment;
|
|
28
|
-
const decoded = decodePathSegment(segment);
|
|
29
|
-
if (redactNext) {
|
|
30
|
-
redactNext = false;
|
|
31
|
-
return REDACTED;
|
|
32
|
-
}
|
|
33
|
-
const assignment = decoded.match(/^([^=:]+)([=:])(.+)$/);
|
|
34
|
-
if (assignment && CREDENTIAL_NAME.test(assignment[1])) {
|
|
35
|
-
return `${assignment[1]}${assignment[2]}${REDACTED}`;
|
|
36
|
-
}
|
|
37
|
-
if (CREDENTIAL_NAME.test(decoded)) {
|
|
38
|
-
redactNext = true;
|
|
39
|
-
return segment;
|
|
40
|
-
}
|
|
41
|
-
return looksLikeCredentialValue(segment) ? REDACTED : segment;
|
|
42
|
-
})
|
|
43
|
-
.join("/");
|
|
44
|
-
}
|
|
45
|
-
function sanitizeQuery(search) {
|
|
46
|
-
if (!search)
|
|
47
|
-
return "";
|
|
48
|
-
const redacted = Array.from(new URLSearchParams(search).keys(), (key) => {
|
|
49
|
-
const safeKey = encodeURIComponent(key.slice(0, 100));
|
|
50
|
-
return `${safeKey}=${REDACTED}`;
|
|
51
|
-
});
|
|
52
|
-
return redacted.length > 0 ? `?${redacted.join("&")}` : "";
|
|
53
|
-
}
|
|
54
|
-
export function sanitizeProviderApiAuditPath(path) {
|
|
55
|
-
const raw = String(path ?? "");
|
|
56
|
-
const withoutFragment = raw.split("#", 1)[0] ?? "";
|
|
57
|
-
try {
|
|
58
|
-
const url = new URL(withoutFragment);
|
|
59
|
-
return `${url.protocol}//${url.host}${sanitizePathname(url.pathname)}${sanitizeQuery(url.search)}`;
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
const queryIndex = withoutFragment.indexOf("?");
|
|
63
|
-
const pathname = queryIndex >= 0 ? withoutFragment.slice(0, queryIndex) : withoutFragment;
|
|
64
|
-
const search = queryIndex >= 0 ? withoutFragment.slice(queryIndex + 1) : "";
|
|
65
|
-
return `${sanitizePathname(pathname)}${sanitizeQuery(search)}`;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export function buildProviderApiAuditSummary(args) {
|
|
69
|
-
const method = String(args.method || "GET").toUpperCase();
|
|
70
|
-
const provider = String(args.provider ?? "");
|
|
71
|
-
const path = sanitizeProviderApiAuditPath(args.path);
|
|
72
|
-
return `${method} ${provider} ${path}`.slice(0, 200);
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=provider-api-audit.js.map
|
|
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AC;QACrC,OAAO,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,IAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IACrG,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChD,MAAM,QAAQ,GACZ,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;QAC3E,MAAM,MAAM,GAAG,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;IACjE,CAAC;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,IAI5C;IACC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,OAAO,GAAG,MAAM,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC","sourcesContent":["const REDACTED = \"[redacted]\";\n\nconst CREDENTIAL_NAME =\n /^(?:api[-_]?key|access[-_]?token|auth(?:orization)?|bearer|credential|password|secret|signature|sig|token|x-amz-credential|x-amz-signature)$/i;\n\nfunction decodePathSegment(segment: string): string {\n try {\n return decodeURIComponent(segment);\n } catch {\n return segment;\n }\n}\n\nfunction looksLikeCredentialValue(segment: string): boolean {\n const value = decodePathSegment(segment);\n if (/^eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$/.test(value)) {\n return true;\n }\n if (\n /^(?:sk|pk|rk|ghp|github_pat|xox[baprs]|ya29|AIza)[-_][A-Za-z0-9_-]+$/i.test(\n value,\n )\n ) {\n return true;\n }\n return value.length >= 32 && /^[A-Za-z0-9._~-]+$/.test(value);\n}\n\nfunction sanitizePathname(pathname: string): string {\n let redactNext = false;\n return pathname\n .split(\"/\")\n .map((segment) => {\n if (!segment) return segment;\n const decoded = decodePathSegment(segment);\n if (redactNext) {\n redactNext = false;\n return REDACTED;\n }\n\n const assignment = decoded.match(/^([^=:]+)([=:])(.+)$/);\n if (assignment && CREDENTIAL_NAME.test(assignment[1]!)) {\n return `${assignment[1]}${assignment[2]}${REDACTED}`;\n }\n if (CREDENTIAL_NAME.test(decoded)) {\n redactNext = true;\n return segment;\n }\n return looksLikeCredentialValue(segment) ? REDACTED : segment;\n })\n .join(\"/\");\n}\n\nfunction sanitizeQuery(search: string): string {\n if (!search) return \"\";\n const redacted = Array.from(new URLSearchParams(search).keys(), (key) => {\n const safeKey = encodeURIComponent(key.slice(0, 100));\n return `${safeKey}=${REDACTED}`;\n });\n return redacted.length > 0 ? `?${redacted.join(\"&\")}` : \"\";\n}\n\nexport function sanitizeProviderApiAuditPath(path: unknown): string {\n const raw = String(path ?? \"\");\n const withoutFragment = raw.split(\"#\", 1)[0] ?? \"\";\n\n try {\n const url = new URL(withoutFragment);\n return `${url.protocol}//${url.host}${sanitizePathname(url.pathname)}${sanitizeQuery(url.search)}`;\n } catch {\n const queryIndex = withoutFragment.indexOf(\"?\");\n const pathname =\n queryIndex >= 0 ? withoutFragment.slice(0, queryIndex) : withoutFragment;\n const search = queryIndex >= 0 ? withoutFragment.slice(queryIndex + 1) : \"\";\n return `${sanitizePathname(pathname)}${sanitizeQuery(search)}`;\n }\n}\n\nexport function buildProviderApiAuditSummary(args: {\n method?: unknown;\n provider?: unknown;\n path?: unknown;\n}): string {\n const method = String(args.method || \"GET\").toUpperCase();\n const provider = String(args.provider ?? \"\");\n const path = sanitizeProviderApiAuditPath(args.path);\n return `${method} ${provider} ${path}`.slice(0, 200);\n}\n"]}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
const REDACTED = "[redacted]";
|
|
2
|
-
|
|
3
|
-
const CREDENTIAL_NAME =
|
|
4
|
-
/^(?:api[-_]?key|access[-_]?token|auth(?:orization)?|bearer|credential|password|secret|signature|sig|token|x-amz-credential|x-amz-signature)$/i;
|
|
5
|
-
|
|
6
|
-
function decodePathSegment(segment: string): string {
|
|
7
|
-
try {
|
|
8
|
-
return decodeURIComponent(segment);
|
|
9
|
-
} catch {
|
|
10
|
-
return segment;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function looksLikeCredentialValue(segment: string): boolean {
|
|
15
|
-
const value = decodePathSegment(segment);
|
|
16
|
-
if (/^eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(value)) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
if (
|
|
20
|
-
/^(?:sk|pk|rk|ghp|github_pat|xox[baprs]|ya29|AIza)[-_][A-Za-z0-9_-]+$/i.test(
|
|
21
|
-
value,
|
|
22
|
-
)
|
|
23
|
-
) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return value.length >= 32 && /^[A-Za-z0-9._~-]+$/.test(value);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function sanitizePathname(pathname: string): string {
|
|
30
|
-
let redactNext = false;
|
|
31
|
-
return pathname
|
|
32
|
-
.split("/")
|
|
33
|
-
.map((segment) => {
|
|
34
|
-
if (!segment) return segment;
|
|
35
|
-
const decoded = decodePathSegment(segment);
|
|
36
|
-
if (redactNext) {
|
|
37
|
-
redactNext = false;
|
|
38
|
-
return REDACTED;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const assignment = decoded.match(/^([^=:]+)([=:])(.+)$/);
|
|
42
|
-
if (assignment && CREDENTIAL_NAME.test(assignment[1]!)) {
|
|
43
|
-
return `${assignment[1]}${assignment[2]}${REDACTED}`;
|
|
44
|
-
}
|
|
45
|
-
if (CREDENTIAL_NAME.test(decoded)) {
|
|
46
|
-
redactNext = true;
|
|
47
|
-
return segment;
|
|
48
|
-
}
|
|
49
|
-
return looksLikeCredentialValue(segment) ? REDACTED : segment;
|
|
50
|
-
})
|
|
51
|
-
.join("/");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function sanitizeQuery(search: string): string {
|
|
55
|
-
if (!search) return "";
|
|
56
|
-
const redacted = Array.from(new URLSearchParams(search).keys(), (key) => {
|
|
57
|
-
const safeKey = encodeURIComponent(key.slice(0, 100));
|
|
58
|
-
return `${safeKey}=${REDACTED}`;
|
|
59
|
-
});
|
|
60
|
-
return redacted.length > 0 ? `?${redacted.join("&")}` : "";
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function sanitizeProviderApiAuditPath(path: unknown): string {
|
|
64
|
-
const raw = String(path ?? "");
|
|
65
|
-
const withoutFragment = raw.split("#", 1)[0] ?? "";
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
const url = new URL(withoutFragment);
|
|
69
|
-
return `${url.protocol}//${url.host}${sanitizePathname(url.pathname)}${sanitizeQuery(url.search)}`;
|
|
70
|
-
} catch {
|
|
71
|
-
const queryIndex = withoutFragment.indexOf("?");
|
|
72
|
-
const pathname =
|
|
73
|
-
queryIndex >= 0 ? withoutFragment.slice(0, queryIndex) : withoutFragment;
|
|
74
|
-
const search = queryIndex >= 0 ? withoutFragment.slice(queryIndex + 1) : "";
|
|
75
|
-
return `${sanitizePathname(pathname)}${sanitizeQuery(search)}`;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function buildProviderApiAuditSummary(args: {
|
|
80
|
-
method?: unknown;
|
|
81
|
-
provider?: unknown;
|
|
82
|
-
path?: unknown;
|
|
83
|
-
}): string {
|
|
84
|
-
const method = String(args.method || "GET").toUpperCase();
|
|
85
|
-
const provider = String(args.provider ?? "");
|
|
86
|
-
const path = sanitizeProviderApiAuditPath(args.path);
|
|
87
|
-
return `${method} ${provider} ${path}`.slice(0, 200);
|
|
88
|
-
}
|