@akasecurity/ai-tc-claude-code 0.9.0 → 0.9.1
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/.claude-plugin/plugin.json +1 -1
- package/commands/setup.md +11 -10
- package/package.json +4 -4
- package/scripts/apply-suppressions.js +1235 -181
- package/scripts/backfill.js +1385 -174
- package/scripts/filescan.js +2641 -333
- package/scripts/firstrun.js +1241 -174
- package/scripts/intro.js +820 -147
- package/scripts/onboard.js +1224 -170
- package/scripts/post-tool-use.js +1405 -179
- package/scripts/pre-tool-use.js +1405 -179
- package/scripts/query.js +1242 -175
- package/scripts/reconcile.js +1238 -171
- package/scripts/remediate.js +1390 -179
- package/scripts/session-start.js +1263 -186
- package/scripts/start-light.js +823 -150
- package/scripts/statusline.js +1255 -178
- package/scripts/stop.js +837 -154
- package/scripts/user-prompt-submit.js +1405 -179
package/scripts/firstrun.js
CHANGED
|
@@ -542,6 +542,10 @@ var SQLITE_MIGRATIONS = [
|
|
|
542
542
|
{
|
|
543
543
|
tag: "0010_events_session_expression_index",
|
|
544
544
|
sql: "-- Custom migration: partial expression index for session-scoped finding reads.\n--\n-- sessionFindingsCount, the session-scoped listGroupedFindings paths, and the\n-- insert-time session dedup all filter live-capture events by\n-- json_extract(e.metadata, '$.sessionId') = :sessionId\n-- \u2014 previously a full findings-join scan with a JSON parse per row. The\n-- IS NOT NULL predicate keeps the index to session-stamped events only (an\n-- equality probe implies non-null, so SQLite still uses it).\nCREATE INDEX `idx_events_session_id` ON `events` (json_extract(`metadata`, '$.sessionId')) WHERE json_extract(`metadata`, '$.sessionId') IS NOT NULL;\n"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
tag: "0011_egress_writer",
|
|
548
|
+
sql: '-- Stable per-project reconcile key for egress call sites, plus a host-keyed\n-- egress decision override that survives destination pruning.\n--\n-- DROP INDEX IF EXISTS, not a bare DROP: the applier replays a pending\n-- migration\'s non-index statements verbatim, so a store that lost\n-- uq_share_call_site out of band would throw here \u2014 and on the plugin hook path\n-- that throw is swallowed fail-open, silently stopping capture.\n--\n-- Existing rows carry the old key\'s discriminator into project_key\n-- (\'legacy:\' || project), so the new unique index is a re-encoding of the old\n-- one and cannot collide on rows the old one allowed. Leaving them on the\n-- column default would collapse two projects\' identical file/line hits onto\n-- one key and abort the whole migration. Writer keys are \'git:\'/\'path:\'-\n-- prefixed, so a backfilled row never collides with a captured one either.\n--\n-- egress_decision_override.destination_id becomes nullable with ON DELETE SET\n-- NULL, which SQLite can only do by rebuilding the table. `host` is ADDed\n-- before the rebuild so the copy has a column to read and so the migration\n-- still presents two probeable columns to the applier\'s evidence check.\nALTER TABLE `share_call_site` ADD `project_key` text DEFAULT \'\' NOT NULL;--> statement-breakpoint\nUPDATE `share_call_site` SET `project_key` = \'legacy:\' || `project`;--> statement-breakpoint\nDROP INDEX IF EXISTS `uq_share_call_site`;--> statement-breakpoint\nCREATE UNIQUE INDEX `uq_share_call_site` ON `share_call_site` (`endpoint_id`,`project_key`,`file`,`line`);--> statement-breakpoint\nCREATE INDEX `idx_share_call_site_project` ON `share_call_site` (`project_key`,`endpoint_id`);--> statement-breakpoint\nALTER TABLE `egress_decision_override` ADD `host` text;--> statement-breakpoint\nPRAGMA foreign_keys=OFF;--> statement-breakpoint\nCREATE TABLE `__new_egress_decision_override` (\n `id` text PRIMARY KEY NOT NULL,\n `destination_id` text,\n `host` text,\n `decision` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`destination_id`) REFERENCES `share_destination`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nINSERT INTO `__new_egress_decision_override`("id", "destination_id", "host", "decision", "created_at", "updated_at") SELECT "id", "destination_id", "host", "decision", "created_at", "updated_at" FROM `egress_decision_override`;--> statement-breakpoint\nDROP TABLE `egress_decision_override`;--> statement-breakpoint\nALTER TABLE `__new_egress_decision_override` RENAME TO `egress_decision_override`;--> statement-breakpoint\nPRAGMA foreign_keys=ON;--> statement-breakpoint\nCREATE UNIQUE INDEX `uq_egress_decision_override` ON `egress_decision_override` (`destination_id`);--> statement-breakpoint\nCREATE UNIQUE INDEX `uq_egress_decision_override_host` ON `egress_decision_override` (`host`) WHERE `host` IS NOT NULL;\n'
|
|
545
549
|
}
|
|
546
550
|
];
|
|
547
551
|
|
|
@@ -16197,6 +16201,7 @@ var ExceptionBundleEntry = DetectionException.pick({
|
|
|
16197
16201
|
|
|
16198
16202
|
// ../../packages/schema/src/zod/rule.ts
|
|
16199
16203
|
var MatcherType = external_exports.enum(["keyword", "regex", "validator"]).meta({ id: "MatcherType" });
|
|
16204
|
+
var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
|
|
16200
16205
|
var KeywordMatcher = external_exports.object({
|
|
16201
16206
|
type: external_exports.literal("keyword"),
|
|
16202
16207
|
// An empty keyword matches at every position, yielding one zero-length span
|
|
@@ -16221,9 +16226,10 @@ function matchesEmptyString(pattern, flags) {
|
|
|
16221
16226
|
return false;
|
|
16222
16227
|
}
|
|
16223
16228
|
}
|
|
16229
|
+
var MAX_PATTERN_LENGTH = 2e3;
|
|
16224
16230
|
var RegexMatcher = external_exports.object({
|
|
16225
16231
|
type: external_exports.literal("regex"),
|
|
16226
|
-
pattern: external_exports.string(),
|
|
16232
|
+
pattern: external_exports.string().min(1).max(MAX_PATTERN_LENGTH),
|
|
16227
16233
|
flags: external_exports.string().default("gi"),
|
|
16228
16234
|
captureGroup: external_exports.number().int().nonnegative().optional()
|
|
16229
16235
|
}).refine((v) => isValidRegex(v.pattern, v.flags), {
|
|
@@ -16790,6 +16796,212 @@ function buildDetectionsList(summaries, query) {
|
|
|
16790
16796
|
return { counts, items: filtered.map(summaryToDetectionListItem) };
|
|
16791
16797
|
}
|
|
16792
16798
|
|
|
16799
|
+
// ../../packages/schema/src/zod/shares.ts
|
|
16800
|
+
var DestinationKind = external_exports.enum(["provider", "internal", "external", "ip"]).meta({ id: "DestinationKind" });
|
|
16801
|
+
var Transport = external_exports.enum(["https", "http", "sftp", "grpc", "smtp", "ws", "wss"]).meta({ id: "Transport" });
|
|
16802
|
+
var DataClass = external_exports.enum(["secrets", "pii", "customer", "source", "telemetry", "logs", "metrics", "none"]).meta({ id: "DataClass" });
|
|
16803
|
+
var DATA_CLASS_ORDER = DataClass.options;
|
|
16804
|
+
var ShareTrustLevel = external_exports.enum(["recognized", "internal", "unverified", "ip"]).meta({ id: "ShareTrustLevel" });
|
|
16805
|
+
var EgressDecision = external_exports.enum(["allow", "block"]).meta({ id: "EgressDecision" });
|
|
16806
|
+
var EgressStatus = external_exports.enum(["allowed", "blocked", "review"]).meta({ id: "EgressStatus" });
|
|
16807
|
+
var ReviewReason = external_exports.enum(["raw_ip", "unverified_domain", "plaintext_transport"]).meta({ id: "ReviewReason" });
|
|
16808
|
+
var HttpMethod = external_exports.enum(["GET", "POST", "PUT", "DELETE", "SDK", "REF"]).meta({ id: "HttpMethod" });
|
|
16809
|
+
var ReviewInfo = external_exports.object({
|
|
16810
|
+
needsReview: external_exports.boolean(),
|
|
16811
|
+
reasons: external_exports.array(ReviewReason)
|
|
16812
|
+
}).meta({ id: "ReviewInfo" });
|
|
16813
|
+
var DestinationNetwork = external_exports.object({
|
|
16814
|
+
port: external_exports.number().int().nullable(),
|
|
16815
|
+
geo: external_exports.string().nullable(),
|
|
16816
|
+
ptr: external_exports.string().nullable()
|
|
16817
|
+
}).meta({ id: "DestinationNetwork" });
|
|
16818
|
+
var EndpointSummary = external_exports.object({
|
|
16819
|
+
id: external_exports.string(),
|
|
16820
|
+
method: HttpMethod,
|
|
16821
|
+
transport: Transport,
|
|
16822
|
+
url: external_exports.string(),
|
|
16823
|
+
template: external_exports.boolean(),
|
|
16824
|
+
dataClass: DataClass,
|
|
16825
|
+
lastSeen: external_exports.iso.datetime(),
|
|
16826
|
+
callSiteCount: external_exports.number().int().nonnegative()
|
|
16827
|
+
}).meta({ id: "EndpointSummary" });
|
|
16828
|
+
var CallSite = external_exports.object({
|
|
16829
|
+
id: external_exports.string(),
|
|
16830
|
+
project: external_exports.string(),
|
|
16831
|
+
file: external_exports.string(),
|
|
16832
|
+
line: external_exports.number().int().nonnegative(),
|
|
16833
|
+
snippet: external_exports.string(),
|
|
16834
|
+
dynamic: external_exports.boolean(),
|
|
16835
|
+
vendored: external_exports.boolean(),
|
|
16836
|
+
/** Deep-link to the Inventory project, when the repo is governed there. */
|
|
16837
|
+
projectId: external_exports.string().nullable()
|
|
16838
|
+
}).meta({ id: "CallSite" });
|
|
16839
|
+
var EndpointWithSites = EndpointSummary.extend({
|
|
16840
|
+
sites: external_exports.array(CallSite)
|
|
16841
|
+
}).meta({ id: "EndpointWithSites" });
|
|
16842
|
+
var ShareDestinationSummary = external_exports.object({
|
|
16843
|
+
id: external_exports.string(),
|
|
16844
|
+
kind: DestinationKind,
|
|
16845
|
+
name: external_exports.string(),
|
|
16846
|
+
host: external_exports.string(),
|
|
16847
|
+
category: external_exports.string(),
|
|
16848
|
+
trust: ShareTrustLevel,
|
|
16849
|
+
/** Effective state (decision applied over the trust default). */
|
|
16850
|
+
status: EgressStatus,
|
|
16851
|
+
/** True when an egress decision override differs from the trust default. */
|
|
16852
|
+
isCustom: external_exports.boolean(),
|
|
16853
|
+
lastSeen: external_exports.iso.datetime(),
|
|
16854
|
+
endpointCount: external_exports.number().int().nonnegative(),
|
|
16855
|
+
callSiteCount: external_exports.number().int().nonnegative(),
|
|
16856
|
+
transports: external_exports.array(Transport),
|
|
16857
|
+
/** Most-sensitive first. */
|
|
16858
|
+
dataClasses: external_exports.array(DataClass),
|
|
16859
|
+
review: ReviewInfo,
|
|
16860
|
+
/** Non-provider hosts only; null for providers. */
|
|
16861
|
+
network: DestinationNetwork.nullable(),
|
|
16862
|
+
/** Embedded for inline expansion — no call sites here. */
|
|
16863
|
+
endpoints: external_exports.array(EndpointSummary)
|
|
16864
|
+
}).meta({ id: "ShareDestinationSummary" });
|
|
16865
|
+
var ShareDestinationDetail = ShareDestinationSummary.omit({
|
|
16866
|
+
endpointCount: true,
|
|
16867
|
+
callSiteCount: true,
|
|
16868
|
+
endpoints: true
|
|
16869
|
+
}).extend({
|
|
16870
|
+
/** Ownership/geo rationale; null for providers. */
|
|
16871
|
+
note: external_exports.string().nullable(),
|
|
16872
|
+
endpoints: external_exports.array(EndpointWithSites)
|
|
16873
|
+
}).meta({ id: "ShareDestinationDetail" });
|
|
16874
|
+
var ReviewDestination = external_exports.object({
|
|
16875
|
+
id: external_exports.string(),
|
|
16876
|
+
kind: DestinationKind,
|
|
16877
|
+
name: external_exports.string(),
|
|
16878
|
+
/** Registrable host — lets the strip derive the provider lettermark, as the register does. */
|
|
16879
|
+
host: external_exports.string(),
|
|
16880
|
+
trust: ShareTrustLevel,
|
|
16881
|
+
status: EgressStatus,
|
|
16882
|
+
review: ReviewInfo,
|
|
16883
|
+
topDataClass: DataClass,
|
|
16884
|
+
callSiteCount: external_exports.number().int().nonnegative(),
|
|
16885
|
+
lastSeen: external_exports.iso.datetime()
|
|
16886
|
+
}).meta({ id: "ReviewDestination" });
|
|
16887
|
+
var ShareDestinationGroup = external_exports.object({
|
|
16888
|
+
kind: DestinationKind,
|
|
16889
|
+
total: external_exports.number().int().nonnegative(),
|
|
16890
|
+
items: external_exports.array(ShareDestinationSummary)
|
|
16891
|
+
}).meta({ id: "ShareDestinationGroup" });
|
|
16892
|
+
var ListShareDestinationsResponse = external_exports.object({ groups: external_exports.array(ShareDestinationGroup) }).meta({ id: "ListShareDestinationsResponse" });
|
|
16893
|
+
var NeedsReviewResponse = external_exports.object({ items: external_exports.array(ReviewDestination) }).meta({ id: "NeedsReviewResponse" });
|
|
16894
|
+
var SharesStats = external_exports.object({
|
|
16895
|
+
destinations: external_exports.number().int().nonnegative(),
|
|
16896
|
+
endpoints: external_exports.number().int().nonnegative(),
|
|
16897
|
+
callSites: external_exports.number().int().nonnegative(),
|
|
16898
|
+
needsReview: external_exports.number().int().nonnegative(),
|
|
16899
|
+
insecure: external_exports.number().int().nonnegative(),
|
|
16900
|
+
byKind: external_exports.object({
|
|
16901
|
+
provider: external_exports.number().int().nonnegative(),
|
|
16902
|
+
internal: external_exports.number().int().nonnegative(),
|
|
16903
|
+
external: external_exports.number().int().nonnegative(),
|
|
16904
|
+
ip: external_exports.number().int().nonnegative()
|
|
16905
|
+
}),
|
|
16906
|
+
byTrust: external_exports.object({
|
|
16907
|
+
recognized: external_exports.number().int().nonnegative(),
|
|
16908
|
+
internal: external_exports.number().int().nonnegative(),
|
|
16909
|
+
unverified: external_exports.number().int().nonnegative(),
|
|
16910
|
+
ip: external_exports.number().int().nonnegative()
|
|
16911
|
+
})
|
|
16912
|
+
}).meta({ id: "SharesStats" });
|
|
16913
|
+
var SetEgressDecisionBody = external_exports.object({
|
|
16914
|
+
/** `null` clears the override — reverts to the trust default, isCustom false. */
|
|
16915
|
+
decision: EgressDecision.nullable()
|
|
16916
|
+
}).meta({ id: "SetEgressDecisionBody" });
|
|
16917
|
+
var SetEgressDecisionResponse = external_exports.object({ destination: ShareDestinationSummary }).meta({ id: "SetEgressDecisionResponse" });
|
|
16918
|
+
var ListShareDestinationsQuery = external_exports.object({
|
|
16919
|
+
/** Case-insensitive match over destination name/category, endpoint url, call-site project/file. */
|
|
16920
|
+
q: external_exports.string().optional(),
|
|
16921
|
+
/** Repeatable. Restrict to these DestinationKind values; absent means all kinds. */
|
|
16922
|
+
kind: external_exports.array(DestinationKind).optional(),
|
|
16923
|
+
/** Reserved for future grouping modes; only 'destination' is supported today. */
|
|
16924
|
+
groupBy: external_exports.enum(["destination"]).default("destination"),
|
|
16925
|
+
/**
|
|
16926
|
+
* When true, return a flat severity-ordered `items[]` instead of `groups`.
|
|
16927
|
+
* Uses `z.stringbool()` (NOT `z.coerce.boolean()` — `Boolean(str)` is true for
|
|
16928
|
+
* any non-empty string, so `?review=false`/`?review=0` would wrongly coerce
|
|
16929
|
+
* to `true`). `z.stringbool()` parses true/1/yes vs false/0/no correctly.
|
|
16930
|
+
*/
|
|
16931
|
+
review: external_exports.stringbool().default(false)
|
|
16932
|
+
});
|
|
16933
|
+
var ExportSharesQuery = external_exports.object({
|
|
16934
|
+
format: external_exports.enum(["csv", "json"]).default("csv"),
|
|
16935
|
+
q: external_exports.string().optional(),
|
|
16936
|
+
kind: external_exports.array(DestinationKind).optional()
|
|
16937
|
+
});
|
|
16938
|
+
|
|
16939
|
+
// ../../packages/schema/src/zod/egress-extraction.ts
|
|
16940
|
+
var EgressEcosystem = external_exports.enum(["npm", "pypi", "go", "maven", "rubygems", "cargo", "composer", "nuget"]).meta({ id: "EgressEcosystem" });
|
|
16941
|
+
var ProviderRegistryEntry = external_exports.object({
|
|
16942
|
+
id: external_exports.string(),
|
|
16943
|
+
name: external_exports.string(),
|
|
16944
|
+
category: external_exports.string(),
|
|
16945
|
+
/** Suffix-matched: 'stripe.com' matches api.stripe.com, never evilstripe.com. */
|
|
16946
|
+
hostSuffixes: external_exports.array(external_exports.string()).min(1),
|
|
16947
|
+
/** Canonical API base URL recorded for manifest-derived (method 'SDK') endpoints. */
|
|
16948
|
+
apiBase: external_exports.string(),
|
|
16949
|
+
/** Most-sensitive first; index 0 becomes the endpoint dataClass. */
|
|
16950
|
+
defaultDataClasses: external_exports.array(DataClass).min(1),
|
|
16951
|
+
/** SDK identifiers per ecosystem ('go' prefix-matched by path, 'maven' by group-id prefix). */
|
|
16952
|
+
sdks: external_exports.partialRecord(EgressEcosystem, external_exports.array(external_exports.string()))
|
|
16953
|
+
}).meta({ id: "ProviderRegistryEntry" });
|
|
16954
|
+
var EgressCallSiteHit = external_exports.object({
|
|
16955
|
+
file: external_exports.string(),
|
|
16956
|
+
line: external_exports.number().int().positive(),
|
|
16957
|
+
snippet: external_exports.string(),
|
|
16958
|
+
dynamic: external_exports.boolean(),
|
|
16959
|
+
vendored: external_exports.boolean()
|
|
16960
|
+
}).meta({ id: "EgressCallSiteHit" });
|
|
16961
|
+
var ResolvedEgressHit = external_exports.object({
|
|
16962
|
+
host: external_exports.string(),
|
|
16963
|
+
kind: DestinationKind,
|
|
16964
|
+
name: external_exports.string(),
|
|
16965
|
+
category: external_exports.string(),
|
|
16966
|
+
trust: ShareTrustLevel,
|
|
16967
|
+
network: DestinationNetwork.nullable(),
|
|
16968
|
+
method: HttpMethod,
|
|
16969
|
+
transport: Transport,
|
|
16970
|
+
url: external_exports.string(),
|
|
16971
|
+
template: external_exports.boolean(),
|
|
16972
|
+
dataClass: DataClass,
|
|
16973
|
+
site: EgressCallSiteHit
|
|
16974
|
+
}).meta({ id: "ResolvedEgressHit" });
|
|
16975
|
+
var EgressReconcile = external_exports.discriminatedUnion("mode", [
|
|
16976
|
+
external_exports.object({ mode: external_exports.literal("walk"), walkedPrefix: external_exports.string() }),
|
|
16977
|
+
external_exports.object({
|
|
16978
|
+
mode: external_exports.literal("ledger"),
|
|
16979
|
+
scannedFiles: external_exports.array(external_exports.string()),
|
|
16980
|
+
deletedFiles: external_exports.array(external_exports.string())
|
|
16981
|
+
})
|
|
16982
|
+
]).meta({ id: "EgressReconcile" });
|
|
16983
|
+
var RecordProjectEgressInput = external_exports.object({
|
|
16984
|
+
/** Stable reconcile key: 'git:<repo identity>' or 'path:<abs root>' (non-git). */
|
|
16985
|
+
projectKey: external_exports.string().min(1),
|
|
16986
|
+
/** Display name only — never keys reconciliation. */
|
|
16987
|
+
project: external_exports.string(),
|
|
16988
|
+
projectId: external_exports.string().nullable(),
|
|
16989
|
+
reconcile: EgressReconcile,
|
|
16990
|
+
hits: external_exports.array(ResolvedEgressHit)
|
|
16991
|
+
}).meta({ id: "RecordProjectEgressInput" });
|
|
16992
|
+
var EgressWriteSummary = external_exports.object({
|
|
16993
|
+
destinations: external_exports.number().int().nonnegative(),
|
|
16994
|
+
endpoints: external_exports.number().int().nonnegative(),
|
|
16995
|
+
callSites: external_exports.number().int().nonnegative(),
|
|
16996
|
+
truncated: external_exports.boolean(),
|
|
16997
|
+
/**
|
|
16998
|
+
* Files the cap dropped whole. Their stored rows were left untouched, so a
|
|
16999
|
+
* ledger-keeping caller must withhold their ledger entries and read them
|
|
17000
|
+
* again next scan.
|
|
17001
|
+
*/
|
|
17002
|
+
droppedFiles: external_exports.array(external_exports.string()).default([])
|
|
17003
|
+
}).meta({ id: "EgressWriteSummary" });
|
|
17004
|
+
|
|
16793
17005
|
// ../../packages/schema/src/zod/findings-group-build.ts
|
|
16794
17006
|
function toApiAction(dbVal) {
|
|
16795
17007
|
const map2 = {
|
|
@@ -17051,7 +17263,7 @@ var PatchInstalledPackRequest = external_exports.object({
|
|
|
17051
17263
|
}).meta({ id: "PatchInstalledPackRequest" });
|
|
17052
17264
|
|
|
17053
17265
|
// ../../packages/schema/src/zod/local.ts
|
|
17054
|
-
var WORKSPACE_SETTINGS_SPEC_VERSION =
|
|
17266
|
+
var WORKSPACE_SETTINGS_SPEC_VERSION = 3;
|
|
17055
17267
|
var RunMode = external_exports.enum(["standalone"]);
|
|
17056
17268
|
var SimpleDetectionPolicy = external_exports.enum(["redact", "warn"]);
|
|
17057
17269
|
var HistoricalAccess = external_exports.enum(["full", "session-only"]);
|
|
@@ -17066,6 +17278,9 @@ var WorkspaceSettings = external_exports.object({
|
|
|
17066
17278
|
policy: SimpleDetectionPolicy.default("redact"),
|
|
17067
17279
|
// Consent for scanning pre-install surfaces; opt-in (see HistoricalAccess).
|
|
17068
17280
|
historicalAccess: HistoricalAccess.default("session-only"),
|
|
17281
|
+
// In-place egress extraction on the scan paths; disable to stop all Data
|
|
17282
|
+
// Shares writes.
|
|
17283
|
+
dataSharesInPlace: external_exports.boolean().default(true),
|
|
17069
17284
|
// Absent until /aka:setup completes; its presence is what "onboarded" means.
|
|
17070
17285
|
onboardedAt: external_exports.iso.datetime().optional()
|
|
17071
17286
|
});
|
|
@@ -17549,145 +17764,6 @@ var SetupHandoffOffer = external_exports.object({
|
|
|
17549
17764
|
path: ["liveKeys"]
|
|
17550
17765
|
});
|
|
17551
17766
|
|
|
17552
|
-
// ../../packages/schema/src/zod/shares.ts
|
|
17553
|
-
var DestinationKind = external_exports.enum(["provider", "internal", "ip"]).meta({ id: "DestinationKind" });
|
|
17554
|
-
var Transport = external_exports.enum(["https", "http", "sftp", "grpc", "smtp"]).meta({ id: "Transport" });
|
|
17555
|
-
var DataClass = external_exports.enum(["secrets", "pii", "customer", "source", "telemetry", "logs", "metrics", "none"]).meta({ id: "DataClass" });
|
|
17556
|
-
var DATA_CLASS_ORDER = DataClass.options;
|
|
17557
|
-
var ShareTrustLevel = external_exports.enum(["recognized", "internal", "unverified", "ip"]).meta({ id: "ShareTrustLevel" });
|
|
17558
|
-
var EgressDecision = external_exports.enum(["allow", "block"]).meta({ id: "EgressDecision" });
|
|
17559
|
-
var EgressStatus = external_exports.enum(["allowed", "blocked", "review"]).meta({ id: "EgressStatus" });
|
|
17560
|
-
var ReviewReason = external_exports.enum(["raw_ip", "unverified_domain", "plaintext_transport"]).meta({ id: "ReviewReason" });
|
|
17561
|
-
var HttpMethod = external_exports.enum(["GET", "POST", "PUT", "DELETE"]).meta({ id: "HttpMethod" });
|
|
17562
|
-
var ReviewInfo = external_exports.object({
|
|
17563
|
-
needsReview: external_exports.boolean(),
|
|
17564
|
-
reasons: external_exports.array(ReviewReason)
|
|
17565
|
-
}).meta({ id: "ReviewInfo" });
|
|
17566
|
-
var DestinationNetwork = external_exports.object({
|
|
17567
|
-
port: external_exports.number().int().nullable(),
|
|
17568
|
-
geo: external_exports.string().nullable(),
|
|
17569
|
-
ptr: external_exports.string().nullable()
|
|
17570
|
-
}).meta({ id: "DestinationNetwork" });
|
|
17571
|
-
var EndpointSummary = external_exports.object({
|
|
17572
|
-
id: external_exports.string(),
|
|
17573
|
-
method: HttpMethod,
|
|
17574
|
-
transport: Transport,
|
|
17575
|
-
url: external_exports.string(),
|
|
17576
|
-
template: external_exports.boolean(),
|
|
17577
|
-
dataClass: DataClass,
|
|
17578
|
-
lastSeen: external_exports.iso.datetime(),
|
|
17579
|
-
callSiteCount: external_exports.number().int().nonnegative()
|
|
17580
|
-
}).meta({ id: "EndpointSummary" });
|
|
17581
|
-
var CallSite = external_exports.object({
|
|
17582
|
-
id: external_exports.string(),
|
|
17583
|
-
project: external_exports.string(),
|
|
17584
|
-
file: external_exports.string(),
|
|
17585
|
-
line: external_exports.number().int().nonnegative(),
|
|
17586
|
-
snippet: external_exports.string(),
|
|
17587
|
-
dynamic: external_exports.boolean(),
|
|
17588
|
-
vendored: external_exports.boolean(),
|
|
17589
|
-
/** Deep-link to the Inventory project, when the repo is governed there. */
|
|
17590
|
-
projectId: external_exports.string().nullable()
|
|
17591
|
-
}).meta({ id: "CallSite" });
|
|
17592
|
-
var EndpointWithSites = EndpointSummary.extend({
|
|
17593
|
-
sites: external_exports.array(CallSite)
|
|
17594
|
-
}).meta({ id: "EndpointWithSites" });
|
|
17595
|
-
var ShareDestinationSummary = external_exports.object({
|
|
17596
|
-
id: external_exports.string(),
|
|
17597
|
-
kind: DestinationKind,
|
|
17598
|
-
name: external_exports.string(),
|
|
17599
|
-
host: external_exports.string(),
|
|
17600
|
-
category: external_exports.string(),
|
|
17601
|
-
trust: ShareTrustLevel,
|
|
17602
|
-
/** Effective state (decision applied over the trust default). */
|
|
17603
|
-
status: EgressStatus,
|
|
17604
|
-
/** True when an egress decision override differs from the trust default. */
|
|
17605
|
-
isCustom: external_exports.boolean(),
|
|
17606
|
-
lastSeen: external_exports.iso.datetime(),
|
|
17607
|
-
endpointCount: external_exports.number().int().nonnegative(),
|
|
17608
|
-
callSiteCount: external_exports.number().int().nonnegative(),
|
|
17609
|
-
transports: external_exports.array(Transport),
|
|
17610
|
-
/** Most-sensitive first. */
|
|
17611
|
-
dataClasses: external_exports.array(DataClass),
|
|
17612
|
-
review: ReviewInfo,
|
|
17613
|
-
/** Non-provider hosts only; null for providers. */
|
|
17614
|
-
network: DestinationNetwork.nullable(),
|
|
17615
|
-
/** Embedded for inline expansion — no call sites here. */
|
|
17616
|
-
endpoints: external_exports.array(EndpointSummary)
|
|
17617
|
-
}).meta({ id: "ShareDestinationSummary" });
|
|
17618
|
-
var ShareDestinationDetail = ShareDestinationSummary.omit({
|
|
17619
|
-
endpointCount: true,
|
|
17620
|
-
callSiteCount: true,
|
|
17621
|
-
endpoints: true
|
|
17622
|
-
}).extend({
|
|
17623
|
-
/** Ownership/geo rationale; null for providers. */
|
|
17624
|
-
note: external_exports.string().nullable(),
|
|
17625
|
-
endpoints: external_exports.array(EndpointWithSites)
|
|
17626
|
-
}).meta({ id: "ShareDestinationDetail" });
|
|
17627
|
-
var ReviewDestination = external_exports.object({
|
|
17628
|
-
id: external_exports.string(),
|
|
17629
|
-
kind: DestinationKind,
|
|
17630
|
-
name: external_exports.string(),
|
|
17631
|
-
/** Registrable host — lets the strip derive the provider lettermark, as the register does. */
|
|
17632
|
-
host: external_exports.string(),
|
|
17633
|
-
trust: ShareTrustLevel,
|
|
17634
|
-
status: EgressStatus,
|
|
17635
|
-
review: ReviewInfo,
|
|
17636
|
-
topDataClass: DataClass,
|
|
17637
|
-
callSiteCount: external_exports.number().int().nonnegative(),
|
|
17638
|
-
lastSeen: external_exports.iso.datetime()
|
|
17639
|
-
}).meta({ id: "ReviewDestination" });
|
|
17640
|
-
var ShareDestinationGroup = external_exports.object({
|
|
17641
|
-
kind: DestinationKind,
|
|
17642
|
-
total: external_exports.number().int().nonnegative(),
|
|
17643
|
-
items: external_exports.array(ShareDestinationSummary)
|
|
17644
|
-
}).meta({ id: "ShareDestinationGroup" });
|
|
17645
|
-
var ListShareDestinationsResponse = external_exports.object({ groups: external_exports.array(ShareDestinationGroup) }).meta({ id: "ListShareDestinationsResponse" });
|
|
17646
|
-
var NeedsReviewResponse = external_exports.object({ items: external_exports.array(ReviewDestination) }).meta({ id: "NeedsReviewResponse" });
|
|
17647
|
-
var SharesStats = external_exports.object({
|
|
17648
|
-
destinations: external_exports.number().int().nonnegative(),
|
|
17649
|
-
endpoints: external_exports.number().int().nonnegative(),
|
|
17650
|
-
callSites: external_exports.number().int().nonnegative(),
|
|
17651
|
-
needsReview: external_exports.number().int().nonnegative(),
|
|
17652
|
-
insecure: external_exports.number().int().nonnegative(),
|
|
17653
|
-
byKind: external_exports.object({
|
|
17654
|
-
provider: external_exports.number().int().nonnegative(),
|
|
17655
|
-
internal: external_exports.number().int().nonnegative(),
|
|
17656
|
-
ip: external_exports.number().int().nonnegative()
|
|
17657
|
-
}),
|
|
17658
|
-
byTrust: external_exports.object({
|
|
17659
|
-
recognized: external_exports.number().int().nonnegative(),
|
|
17660
|
-
internal: external_exports.number().int().nonnegative(),
|
|
17661
|
-
unverified: external_exports.number().int().nonnegative(),
|
|
17662
|
-
ip: external_exports.number().int().nonnegative()
|
|
17663
|
-
})
|
|
17664
|
-
}).meta({ id: "SharesStats" });
|
|
17665
|
-
var SetEgressDecisionBody = external_exports.object({
|
|
17666
|
-
/** `null` clears the override — reverts to the trust default, isCustom false. */
|
|
17667
|
-
decision: EgressDecision.nullable()
|
|
17668
|
-
}).meta({ id: "SetEgressDecisionBody" });
|
|
17669
|
-
var SetEgressDecisionResponse = external_exports.object({ destination: ShareDestinationSummary }).meta({ id: "SetEgressDecisionResponse" });
|
|
17670
|
-
var ListShareDestinationsQuery = external_exports.object({
|
|
17671
|
-
/** Case-insensitive match over destination name/category, endpoint url, call-site project/file. */
|
|
17672
|
-
q: external_exports.string().optional(),
|
|
17673
|
-
/** Repeatable. Restrict to these DestinationKind values; absent means all kinds. */
|
|
17674
|
-
kind: external_exports.array(DestinationKind).optional(),
|
|
17675
|
-
/** Reserved for future grouping modes; only 'destination' is supported today. */
|
|
17676
|
-
groupBy: external_exports.enum(["destination"]).default("destination"),
|
|
17677
|
-
/**
|
|
17678
|
-
* When true, return a flat severity-ordered `items[]` instead of `groups`.
|
|
17679
|
-
* Uses `z.stringbool()` (NOT `z.coerce.boolean()` — `Boolean(str)` is true for
|
|
17680
|
-
* any non-empty string, so `?review=false`/`?review=0` would wrongly coerce
|
|
17681
|
-
* to `true`). `z.stringbool()` parses true/1/yes vs false/0/no correctly.
|
|
17682
|
-
*/
|
|
17683
|
-
review: external_exports.stringbool().default(false)
|
|
17684
|
-
});
|
|
17685
|
-
var ExportSharesQuery = external_exports.object({
|
|
17686
|
-
format: external_exports.enum(["csv", "json"]).default("csv"),
|
|
17687
|
-
q: external_exports.string().optional(),
|
|
17688
|
-
kind: external_exports.array(DestinationKind).optional()
|
|
17689
|
-
});
|
|
17690
|
-
|
|
17691
17767
|
// ../../packages/schema/src/zod/shares-access.ts
|
|
17692
17768
|
var ALLOWED_BY_DEFAULT_TRUST = /* @__PURE__ */ new Set(["recognized", "internal"]);
|
|
17693
17769
|
function trustDefaultStatus(trust) {
|
|
@@ -17707,7 +17783,7 @@ function deriveReviewReasons(trust, transports) {
|
|
|
17707
17783
|
const reasons = [];
|
|
17708
17784
|
if (trust === "ip") reasons.push("raw_ip");
|
|
17709
17785
|
if (trust === "unverified") reasons.push("unverified_domain");
|
|
17710
|
-
if (transports.includes("http")) reasons.push("plaintext_transport");
|
|
17786
|
+
if (transports.includes("http") || transports.includes("ws")) reasons.push("plaintext_transport");
|
|
17711
17787
|
return reasons;
|
|
17712
17788
|
}
|
|
17713
17789
|
function buildReviewInfo(trust, transports) {
|
|
@@ -17938,6 +18014,7 @@ function applyMigrations(db) {
|
|
|
17938
18014
|
ensureSyncedAtColumn(db, "audit_events");
|
|
17939
18015
|
ensureScanLedgerTable(db);
|
|
17940
18016
|
ensureBlockedDetectionsTable(db);
|
|
18017
|
+
ensureRuleProbeCacheTable(db);
|
|
17941
18018
|
ensureWriteGateTrigger(db);
|
|
17942
18019
|
ensureTokenUsageColumns(db);
|
|
17943
18020
|
reconcileSourceProjectIds(db);
|
|
@@ -18077,6 +18154,14 @@ function ensureBlockedDetectionsTable(db) {
|
|
|
18077
18154
|
blocked_at INTEGER NOT NULL
|
|
18078
18155
|
)`);
|
|
18079
18156
|
}
|
|
18157
|
+
function ensureRuleProbeCacheTable(db) {
|
|
18158
|
+
db.exec(`CREATE TABLE IF NOT EXISTS rule_probe_cache (
|
|
18159
|
+
rule_key TEXT PRIMARY KEY,
|
|
18160
|
+
verdict TEXT NOT NULL,
|
|
18161
|
+
worst_probe_ms REAL NOT NULL,
|
|
18162
|
+
checked_at INTEGER NOT NULL
|
|
18163
|
+
)`);
|
|
18164
|
+
}
|
|
18080
18165
|
|
|
18081
18166
|
// ../../packages/persistence/src/paths.ts
|
|
18082
18167
|
import { chmodSync, mkdirSync } from "fs";
|
|
@@ -21630,6 +21715,35 @@ var SqliteResolutionsRepository = class {
|
|
|
21630
21715
|
}
|
|
21631
21716
|
};
|
|
21632
21717
|
|
|
21718
|
+
// ../../packages/persistence/src/repositories/rule-probe-cache.ts
|
|
21719
|
+
var SqliteRuleProbeCacheRepository = class {
|
|
21720
|
+
constructor(db) {
|
|
21721
|
+
this.db = db;
|
|
21722
|
+
this.upsertStmt = db.prepare(
|
|
21723
|
+
`INSERT INTO rule_probe_cache (rule_key, verdict, worst_probe_ms, checked_at)
|
|
21724
|
+
VALUES (:ruleKey, :verdict, :worstProbeMs, :checkedAt)
|
|
21725
|
+
ON CONFLICT (rule_key) DO UPDATE SET
|
|
21726
|
+
verdict = excluded.verdict,
|
|
21727
|
+
worst_probe_ms = excluded.worst_probe_ms,
|
|
21728
|
+
checked_at = excluded.checked_at`
|
|
21729
|
+
);
|
|
21730
|
+
this.readStmt = db.prepare(
|
|
21731
|
+
`SELECT verdict, worst_probe_ms AS worstProbeMs FROM rule_probe_cache WHERE rule_key = :ruleKey`
|
|
21732
|
+
);
|
|
21733
|
+
}
|
|
21734
|
+
db;
|
|
21735
|
+
upsertStmt;
|
|
21736
|
+
readStmt;
|
|
21737
|
+
getVerdict(ruleKey) {
|
|
21738
|
+
return getRow(this.readStmt, { ruleKey });
|
|
21739
|
+
}
|
|
21740
|
+
setVerdict(ruleKey, verdict, worstProbeMs) {
|
|
21741
|
+
failOpenTransaction(this.db, () => {
|
|
21742
|
+
this.upsertStmt.run({ ruleKey, verdict, worstProbeMs, checkedAt: Date.now() });
|
|
21743
|
+
});
|
|
21744
|
+
}
|
|
21745
|
+
};
|
|
21746
|
+
|
|
21633
21747
|
// ../../packages/persistence/src/repositories/scan-ledger.ts
|
|
21634
21748
|
var SqliteScanLedgerRepository = class {
|
|
21635
21749
|
constructor(db) {
|
|
@@ -22041,11 +22155,50 @@ var SqliteSecurityRepository = class {
|
|
|
22041
22155
|
|
|
22042
22156
|
// ../../packages/persistence/src/repositories/shares.ts
|
|
22043
22157
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
22044
|
-
var
|
|
22158
|
+
var MAX_EGRESS_CALL_SITES_PER_PROJECT = 5e3;
|
|
22159
|
+
var IN_CHUNK = 500;
|
|
22160
|
+
var KIND_ORDER = ["provider", "internal", "external", "ip"];
|
|
22161
|
+
var PLAINTEXT_TRANSPORT_SQL = "('http', 'ws')";
|
|
22162
|
+
var OVERRIDE_JOIN = `LEFT JOIN egress_decision_override oh ON oh.host = d.host
|
|
22163
|
+
LEFT JOIN egress_decision_override ol ON ol.destination_id = d.id AND ol.host IS NULL`;
|
|
22045
22164
|
var CALL_SITE_EMBED_CAP = 200;
|
|
22046
22165
|
function parseNetwork(networkJson) {
|
|
22047
22166
|
return safeJson(networkJson, null);
|
|
22048
22167
|
}
|
|
22168
|
+
function capHits(all, mode) {
|
|
22169
|
+
if (all.length <= MAX_EGRESS_CALL_SITES_PER_PROJECT) {
|
|
22170
|
+
return { hits: [...all], droppedFiles: [], truncated: false };
|
|
22171
|
+
}
|
|
22172
|
+
if (mode === "walk") {
|
|
22173
|
+
return {
|
|
22174
|
+
hits: all.slice(0, MAX_EGRESS_CALL_SITES_PER_PROJECT),
|
|
22175
|
+
droppedFiles: [],
|
|
22176
|
+
truncated: true
|
|
22177
|
+
};
|
|
22178
|
+
}
|
|
22179
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
22180
|
+
for (const hit of all) {
|
|
22181
|
+
const bucket = byFile.get(hit.site.file);
|
|
22182
|
+
if (bucket === void 0) byFile.set(hit.site.file, [hit]);
|
|
22183
|
+
else bucket.push(hit);
|
|
22184
|
+
}
|
|
22185
|
+
const hits = [];
|
|
22186
|
+
const droppedFiles = [];
|
|
22187
|
+
for (const [file2, bucket] of byFile) {
|
|
22188
|
+
if (hits.length + bucket.length > MAX_EGRESS_CALL_SITES_PER_PROJECT) droppedFiles.push(file2);
|
|
22189
|
+
else hits.push(...bucket);
|
|
22190
|
+
}
|
|
22191
|
+
return { hits, droppedFiles, truncated: true };
|
|
22192
|
+
}
|
|
22193
|
+
function withoutDroppedFiles(reconcile, droppedFiles) {
|
|
22194
|
+
if (reconcile.mode === "walk" || droppedFiles.length === 0) return reconcile;
|
|
22195
|
+
const dropped = new Set(droppedFiles);
|
|
22196
|
+
return {
|
|
22197
|
+
mode: "ledger",
|
|
22198
|
+
scannedFiles: reconcile.scannedFiles.filter((file2) => !dropped.has(file2)),
|
|
22199
|
+
deletedFiles: reconcile.deletedFiles.filter((file2) => !dropped.has(file2))
|
|
22200
|
+
};
|
|
22201
|
+
}
|
|
22049
22202
|
function toEndpointSummary(row) {
|
|
22050
22203
|
return {
|
|
22051
22204
|
id: row.id,
|
|
@@ -22136,13 +22289,15 @@ var SqliteSharesRepository = class {
|
|
|
22136
22289
|
const callSites = countScalar(this.db, "SELECT count(*) AS n FROM share_call_site");
|
|
22137
22290
|
const insecure = countScalar(
|
|
22138
22291
|
this.db,
|
|
22139
|
-
|
|
22292
|
+
`SELECT count(DISTINCT destination_id) AS n FROM share_endpoint
|
|
22293
|
+
WHERE transport IN ${PLAINTEXT_TRANSPORT_SQL}`
|
|
22140
22294
|
);
|
|
22141
22295
|
const needsReview = countScalar(
|
|
22142
22296
|
this.db,
|
|
22143
22297
|
`SELECT count(DISTINCT d.id) AS n
|
|
22144
22298
|
FROM share_destination d
|
|
22145
|
-
LEFT JOIN share_endpoint e ON e.destination_id = d.id
|
|
22299
|
+
LEFT JOIN share_endpoint e ON e.destination_id = d.id
|
|
22300
|
+
AND e.transport IN ${PLAINTEXT_TRANSPORT_SQL}
|
|
22146
22301
|
WHERE d.trust IN ('unverified', 'ip') OR e.id IS NOT NULL`
|
|
22147
22302
|
);
|
|
22148
22303
|
const kindCounts = countBy(
|
|
@@ -22152,6 +22307,7 @@ var SqliteSharesRepository = class {
|
|
|
22152
22307
|
const byKind = {
|
|
22153
22308
|
provider: kindCounts.get("provider") ?? 0,
|
|
22154
22309
|
internal: kindCounts.get("internal") ?? 0,
|
|
22310
|
+
external: kindCounts.get("external") ?? 0,
|
|
22155
22311
|
ip: kindCounts.get("ip") ?? 0
|
|
22156
22312
|
};
|
|
22157
22313
|
const trustCounts = countBy(
|
|
@@ -22227,23 +22383,316 @@ var SqliteSharesRepository = class {
|
|
|
22227
22383
|
// real edit from a no-such-destination.
|
|
22228
22384
|
/**
|
|
22229
22385
|
* Set (decision) or clear (null) the egress decision override for a destination.
|
|
22230
|
-
* `null` deletes the override
|
|
22386
|
+
* `null` deletes the override rows → reverts to the trust default.
|
|
22387
|
+
*
|
|
22388
|
+
* The written row carries both the destination id and its host, so the
|
|
22389
|
+
* decision re-attaches by host after the destination is pruned and
|
|
22390
|
+
* re-detected under a fresh id. Rows written before the host column existed
|
|
22391
|
+
* (host NULL, matched by destination id) are replaced rather than left to
|
|
22392
|
+
* shadow the new one. Runs IMMEDIATE: the host lookup is read-then-write and
|
|
22393
|
+
* would otherwise race a concurrent prune.
|
|
22231
22394
|
*/
|
|
22232
22395
|
setEgressDecision(destinationId, decision) {
|
|
22233
|
-
|
|
22234
|
-
|
|
22235
|
-
|
|
22236
|
-
|
|
22237
|
-
|
|
22396
|
+
let existed = false;
|
|
22397
|
+
withTransaction(
|
|
22398
|
+
this.db,
|
|
22399
|
+
() => {
|
|
22400
|
+
const dest = this.db.prepare("SELECT host FROM share_destination WHERE id = ?").get(destinationId);
|
|
22401
|
+
if (dest === void 0) return;
|
|
22402
|
+
existed = true;
|
|
22403
|
+
this.db.prepare(
|
|
22404
|
+
`DELETE FROM egress_decision_override
|
|
22405
|
+
WHERE host = :host OR (destination_id = :destinationId AND host IS NULL)`
|
|
22406
|
+
).run({ host: dest.host, destinationId });
|
|
22407
|
+
if (decision === null) return;
|
|
22408
|
+
this.db.prepare(
|
|
22409
|
+
`INSERT INTO egress_decision_override
|
|
22410
|
+
(id, destination_id, host, decision, created_at, updated_at)
|
|
22411
|
+
VALUES (:id, :destinationId, :host, :decision, :now, :now)`
|
|
22412
|
+
).run({
|
|
22413
|
+
id: randomUUID7(),
|
|
22414
|
+
destinationId,
|
|
22415
|
+
host: dest.host,
|
|
22416
|
+
decision,
|
|
22417
|
+
now: Date.now()
|
|
22418
|
+
});
|
|
22419
|
+
},
|
|
22420
|
+
"IMMEDIATE"
|
|
22421
|
+
);
|
|
22422
|
+
return existed;
|
|
22423
|
+
}
|
|
22424
|
+
/**
|
|
22425
|
+
* Record one project's statically-extracted egress: reconcile the previously
|
|
22426
|
+
* stored call sites against this scan, upsert destination → endpoint → call
|
|
22427
|
+
* site for every hit, confirm `last_seen` on everything the project still
|
|
22428
|
+
* references, and drop what no longer has evidence.
|
|
22429
|
+
*
|
|
22430
|
+
* Reconciliation keys on `projectKey` alone; `project` and `projectId` are
|
|
22431
|
+
* display payload and never scope a delete. The whole write is one
|
|
22432
|
+
* transaction: a failure leaves the project's previous inventory exactly as
|
|
22433
|
+
* it was, and THROWS rather than reporting a partial write — callers decide
|
|
22434
|
+
* their own fail-open behavior, and the scanner additionally withholds its
|
|
22435
|
+
* ledger commit so the next scan retries.
|
|
22436
|
+
*
|
|
22437
|
+
* Over-cap input is truncated at a FILE boundary, and the files that lost
|
|
22438
|
+
* their hits are both excluded from the reconcile delete and named in
|
|
22439
|
+
* `droppedFiles`. That pairing is what keeps truncation non-destructive on
|
|
22440
|
+
* the ledger path: a dropped file keeps whatever rows it already had, and its
|
|
22441
|
+
* caller withholds the ledger entry so the next scan reads it again.
|
|
22442
|
+
*/
|
|
22443
|
+
recordProjectEgress(input) {
|
|
22444
|
+
const { hits, droppedFiles, truncated } = capHits(input.hits, input.reconcile.mode);
|
|
22445
|
+
const reconcile = withoutDroppedFiles(input.reconcile, droppedFiles);
|
|
22446
|
+
const now = Date.now();
|
|
22447
|
+
let summary = {
|
|
22448
|
+
destinations: 0,
|
|
22449
|
+
endpoints: 0,
|
|
22450
|
+
callSites: 0,
|
|
22451
|
+
truncated,
|
|
22452
|
+
droppedFiles
|
|
22453
|
+
};
|
|
22454
|
+
withTransaction(
|
|
22455
|
+
this.db,
|
|
22456
|
+
() => {
|
|
22457
|
+
const projectId = input.projectId ?? this.knownProjectId(input.projectKey);
|
|
22458
|
+
this.reconcileCallSites(input.projectKey, reconcile);
|
|
22459
|
+
this.upsertHits(input, hits, projectId, now);
|
|
22460
|
+
this.confirmLastSeen(input.projectKey, now);
|
|
22461
|
+
this.pruneOrphans();
|
|
22462
|
+
summary = { ...this.projectTotals(input.projectKey), truncated, droppedFiles };
|
|
22463
|
+
},
|
|
22464
|
+
"IMMEDIATE"
|
|
22465
|
+
);
|
|
22466
|
+
return summary;
|
|
22467
|
+
}
|
|
22468
|
+
// ─── Egress write internals ──────────────────────────────────────────────────
|
|
22469
|
+
/**
|
|
22470
|
+
* Clear the stored call sites this scan is responsible for re-creating.
|
|
22471
|
+
*
|
|
22472
|
+
* Each pipeline may only delete rows its own walker could have produced. The
|
|
22473
|
+
* fs walk behind 'walk' mode never descends into dot-directories, so its
|
|
22474
|
+
* delete excludes dot-path files — those rows are the plugin scanner's to
|
|
22475
|
+
* reconcile, and deleting them here would make the two pipelines erase each
|
|
22476
|
+
* other's rows on every alternating scan. 'ledger' mode names its files
|
|
22477
|
+
* outright and never mass-deletes, so rows the fs walk contributed for files
|
|
22478
|
+
* the scanner skips (vendored, oversize) survive it.
|
|
22479
|
+
*/
|
|
22480
|
+
reconcileCallSites(projectKey, reconcile) {
|
|
22481
|
+
if (reconcile.mode === "walk") {
|
|
22482
|
+
const prefix = reconcile.walkedPrefix.replace(/\/+$/, "");
|
|
22483
|
+
this.db.prepare(
|
|
22484
|
+
`DELETE FROM share_call_site
|
|
22485
|
+
WHERE project_key = :key
|
|
22486
|
+
AND (:prefix = '' OR file = :prefix OR file LIKE :subtree ESCAPE '\\')
|
|
22487
|
+
AND file NOT LIKE '.%'
|
|
22488
|
+
AND file NOT LIKE '%/.%'`
|
|
22489
|
+
).run({ key: projectKey, prefix, subtree: `${escapeLikePattern(prefix)}/%` });
|
|
22490
|
+
return;
|
|
22238
22491
|
}
|
|
22492
|
+
const files = [.../* @__PURE__ */ new Set([...reconcile.scannedFiles, ...reconcile.deletedFiles])];
|
|
22493
|
+
for (let i = 0; i < files.length; i += IN_CHUNK) {
|
|
22494
|
+
const chunk = files.slice(i, i + IN_CHUNK);
|
|
22495
|
+
this.db.prepare(
|
|
22496
|
+
`DELETE FROM share_call_site
|
|
22497
|
+
WHERE project_key = ? AND file IN (${placeholders(chunk.length)})`
|
|
22498
|
+
).run(projectKey, ...chunk);
|
|
22499
|
+
}
|
|
22500
|
+
}
|
|
22501
|
+
/**
|
|
22502
|
+
* Upsert every hit as destination → endpoint → call site. Destinations key on
|
|
22503
|
+
* `host` and endpoints on `(destination_id, method, url)`, both shared across
|
|
22504
|
+
* projects; only the call site carries `project_key`. A destination's `note`
|
|
22505
|
+
* is user-owned and never overwritten. The id caches keep one upsert per
|
|
22506
|
+
* distinct host and endpoint, so the first hit for a host supplies its
|
|
22507
|
+
* classification for this batch.
|
|
22508
|
+
*/
|
|
22509
|
+
upsertHits(input, hits, projectId, now) {
|
|
22510
|
+
if (hits.length === 0) return;
|
|
22511
|
+
const destStmt = this.db.prepare(
|
|
22512
|
+
`INSERT INTO share_destination
|
|
22513
|
+
(id, kind, name, host, category, trust, network_json, last_seen, provenance,
|
|
22514
|
+
created_at, updated_at)
|
|
22515
|
+
VALUES (:id, :kind, :name, :host, :category, :trust, :networkJson, :now, 'scan', :now, :now)
|
|
22516
|
+
ON CONFLICT (host) DO UPDATE SET
|
|
22517
|
+
kind = excluded.kind,
|
|
22518
|
+
name = excluded.name,
|
|
22519
|
+
category = excluded.category,
|
|
22520
|
+
trust = excluded.trust,
|
|
22521
|
+
network_json = excluded.network_json,
|
|
22522
|
+
last_seen = excluded.last_seen,
|
|
22523
|
+
updated_at = excluded.updated_at`
|
|
22524
|
+
);
|
|
22525
|
+
const destIdStmt = this.db.prepare("SELECT id FROM share_destination WHERE host = ?");
|
|
22526
|
+
const endpointStmt = this.db.prepare(
|
|
22527
|
+
`INSERT INTO share_endpoint
|
|
22528
|
+
(id, destination_id, method, transport, url, template, data_class, last_seen,
|
|
22529
|
+
created_at, updated_at)
|
|
22530
|
+
VALUES (:id, :destinationId, :method, :transport, :url, :template, :dataClass, :now,
|
|
22531
|
+
:now, :now)
|
|
22532
|
+
ON CONFLICT (destination_id, method, url) DO UPDATE SET
|
|
22533
|
+
transport = excluded.transport,
|
|
22534
|
+
template = excluded.template,
|
|
22535
|
+
data_class = excluded.data_class,
|
|
22536
|
+
last_seen = excluded.last_seen,
|
|
22537
|
+
updated_at = excluded.updated_at`
|
|
22538
|
+
);
|
|
22539
|
+
const endpointIdStmt = this.db.prepare(
|
|
22540
|
+
"SELECT id FROM share_endpoint WHERE destination_id = ? AND method = ? AND url = ?"
|
|
22541
|
+
);
|
|
22542
|
+
const siteStmt = this.db.prepare(
|
|
22543
|
+
`INSERT INTO share_call_site
|
|
22544
|
+
(id, endpoint_id, project, project_key, file, line, snippet, dynamic, vendored,
|
|
22545
|
+
project_id, created_at, updated_at)
|
|
22546
|
+
VALUES (:id, :endpointId, :project, :projectKey, :file, :line, :snippet, :dynamic,
|
|
22547
|
+
:vendored, :projectId, :now, :now)
|
|
22548
|
+
ON CONFLICT (endpoint_id, project_key, file, line) DO UPDATE SET
|
|
22549
|
+
snippet = excluded.snippet,
|
|
22550
|
+
dynamic = excluded.dynamic,
|
|
22551
|
+
vendored = excluded.vendored,
|
|
22552
|
+
project = excluded.project,
|
|
22553
|
+
project_id = COALESCE(excluded.project_id, share_call_site.project_id),
|
|
22554
|
+
updated_at = excluded.updated_at`
|
|
22555
|
+
);
|
|
22556
|
+
const destIds = /* @__PURE__ */ new Map();
|
|
22557
|
+
const endpointIds = /* @__PURE__ */ new Map();
|
|
22558
|
+
for (const hit of hits) {
|
|
22559
|
+
let destinationId = destIds.get(hit.host);
|
|
22560
|
+
if (destinationId === void 0) {
|
|
22561
|
+
destStmt.run({
|
|
22562
|
+
id: randomUUID7(),
|
|
22563
|
+
kind: hit.kind,
|
|
22564
|
+
name: hit.name,
|
|
22565
|
+
host: hit.host,
|
|
22566
|
+
category: hit.category,
|
|
22567
|
+
trust: hit.trust,
|
|
22568
|
+
networkJson: hit.network === null ? null : JSON.stringify(hit.network),
|
|
22569
|
+
now
|
|
22570
|
+
});
|
|
22571
|
+
destinationId = getRow(destIdStmt, [hit.host])?.id ?? "";
|
|
22572
|
+
destIds.set(hit.host, destinationId);
|
|
22573
|
+
}
|
|
22574
|
+
const endpointKey = `${destinationId}\0${hit.method}\0${hit.url}`;
|
|
22575
|
+
let endpointId = endpointIds.get(endpointKey);
|
|
22576
|
+
if (endpointId === void 0) {
|
|
22577
|
+
endpointStmt.run({
|
|
22578
|
+
id: randomUUID7(),
|
|
22579
|
+
destinationId,
|
|
22580
|
+
method: hit.method,
|
|
22581
|
+
transport: hit.transport,
|
|
22582
|
+
url: hit.url,
|
|
22583
|
+
template: boolToInt(hit.template),
|
|
22584
|
+
dataClass: hit.dataClass,
|
|
22585
|
+
now
|
|
22586
|
+
});
|
|
22587
|
+
endpointId = getRow(endpointIdStmt, [destinationId, hit.method, hit.url])?.id ?? "";
|
|
22588
|
+
endpointIds.set(endpointKey, endpointId);
|
|
22589
|
+
}
|
|
22590
|
+
siteStmt.run({
|
|
22591
|
+
id: randomUUID7(),
|
|
22592
|
+
endpointId,
|
|
22593
|
+
project: input.project,
|
|
22594
|
+
projectKey: input.projectKey,
|
|
22595
|
+
file: hit.site.file,
|
|
22596
|
+
line: hit.site.line,
|
|
22597
|
+
snippet: hit.site.snippet,
|
|
22598
|
+
dynamic: boolToInt(hit.site.dynamic),
|
|
22599
|
+
vendored: boolToInt(hit.site.vendored),
|
|
22600
|
+
projectId,
|
|
22601
|
+
now
|
|
22602
|
+
});
|
|
22603
|
+
}
|
|
22604
|
+
}
|
|
22605
|
+
/**
|
|
22606
|
+
* The source-project id this project's stored call sites already carry, if
|
|
22607
|
+
* any. Only the pipeline that resolves a source project supplies one; the
|
|
22608
|
+
* other passes null and inherits this, so the link stops flapping between a
|
|
22609
|
+
* real id and NULL depending on which pipeline ran last. The value is a
|
|
22610
|
+
* per-project attribute stored redundantly on each row, so any row's is
|
|
22611
|
+
* representative.
|
|
22612
|
+
*/
|
|
22613
|
+
knownProjectId(projectKey) {
|
|
22614
|
+
return getRow(
|
|
22615
|
+
this.db.prepare(
|
|
22616
|
+
`SELECT project_id AS projectId FROM share_call_site
|
|
22617
|
+
WHERE project_key = ? AND project_id IS NOT NULL LIMIT 1`
|
|
22618
|
+
),
|
|
22619
|
+
[projectKey]
|
|
22620
|
+
)?.projectId ?? null;
|
|
22621
|
+
}
|
|
22622
|
+
/**
|
|
22623
|
+
* Stamp `last_seen` on every endpoint and destination this project still
|
|
22624
|
+
* references — including rows the scan preserved rather than re-wrote, so a
|
|
22625
|
+
* ledger-skipped file's references don't decay into "stale" on the page.
|
|
22626
|
+
*/
|
|
22627
|
+
confirmLastSeen(projectKey, now) {
|
|
22239
22628
|
this.db.prepare(
|
|
22240
|
-
`
|
|
22241
|
-
|
|
22242
|
-
|
|
22243
|
-
|
|
22244
|
-
|
|
22245
|
-
|
|
22246
|
-
|
|
22629
|
+
`UPDATE share_endpoint SET last_seen = :now, updated_at = :now
|
|
22630
|
+
WHERE id IN (SELECT DISTINCT endpoint_id FROM share_call_site WHERE project_key = :key)`
|
|
22631
|
+
).run({ now, key: projectKey });
|
|
22632
|
+
this.db.prepare(
|
|
22633
|
+
`UPDATE share_destination SET last_seen = :now, updated_at = :now
|
|
22634
|
+
WHERE id IN (SELECT DISTINCT e.destination_id
|
|
22635
|
+
FROM share_endpoint e
|
|
22636
|
+
JOIN share_call_site c ON c.endpoint_id = e.id
|
|
22637
|
+
WHERE c.project_key = :key)`
|
|
22638
|
+
).run({ now, key: projectKey });
|
|
22639
|
+
}
|
|
22640
|
+
/**
|
|
22641
|
+
* Drop rows left without evidence: endpoints with no call site, then
|
|
22642
|
+
* destinations with no endpoint. Call sites are the only evidence either one
|
|
22643
|
+
* has, so a row that lost its last one belongs to no project any more.
|
|
22644
|
+
*
|
|
22645
|
+
* Overrides are deleted between the two steps, and only the ones written
|
|
22646
|
+
* before the host column existed. Those match a destination by id alone;
|
|
22647
|
+
* because the id link is released on delete rather than cascading, leaving
|
|
22648
|
+
* them would accumulate rows that match neither join arm and that nothing can
|
|
22649
|
+
* reach again. Host-bearing rows deliberately survive — the host is what
|
|
22650
|
+
* re-attaches a user's decision when the destination comes back.
|
|
22651
|
+
*/
|
|
22652
|
+
pruneOrphans() {
|
|
22653
|
+
this.db.exec(
|
|
22654
|
+
`DELETE FROM share_endpoint
|
|
22655
|
+
WHERE NOT EXISTS (SELECT 1 FROM share_call_site c WHERE c.endpoint_id = share_endpoint.id)`
|
|
22656
|
+
);
|
|
22657
|
+
this.db.exec(
|
|
22658
|
+
`DELETE FROM egress_decision_override
|
|
22659
|
+
WHERE host IS NULL
|
|
22660
|
+
AND destination_id IN (
|
|
22661
|
+
SELECT d.id FROM share_destination d
|
|
22662
|
+
WHERE NOT EXISTS (SELECT 1 FROM share_endpoint e WHERE e.destination_id = d.id))`
|
|
22663
|
+
);
|
|
22664
|
+
this.db.exec(
|
|
22665
|
+
`DELETE FROM share_destination
|
|
22666
|
+
WHERE NOT EXISTS (
|
|
22667
|
+
SELECT 1 FROM share_endpoint e WHERE e.destination_id = share_destination.id)`
|
|
22668
|
+
);
|
|
22669
|
+
}
|
|
22670
|
+
/**
|
|
22671
|
+
* Live totals for one project. Destinations and endpoints are shared across
|
|
22672
|
+
* projects and carry no project column, so both are counted through the call
|
|
22673
|
+
* sites that reference them.
|
|
22674
|
+
*/
|
|
22675
|
+
projectTotals(projectKey) {
|
|
22676
|
+
return {
|
|
22677
|
+
destinations: countScalar(
|
|
22678
|
+
this.db,
|
|
22679
|
+
`SELECT count(DISTINCT e.destination_id) AS n
|
|
22680
|
+
FROM share_endpoint e
|
|
22681
|
+
JOIN share_call_site c ON c.endpoint_id = e.id
|
|
22682
|
+
WHERE c.project_key = ?`,
|
|
22683
|
+
[projectKey]
|
|
22684
|
+
),
|
|
22685
|
+
endpoints: countScalar(
|
|
22686
|
+
this.db,
|
|
22687
|
+
"SELECT count(DISTINCT endpoint_id) AS n FROM share_call_site WHERE project_key = ?",
|
|
22688
|
+
[projectKey]
|
|
22689
|
+
),
|
|
22690
|
+
callSites: countScalar(
|
|
22691
|
+
this.db,
|
|
22692
|
+
"SELECT count(*) AS n FROM share_call_site WHERE project_key = ?",
|
|
22693
|
+
[projectKey]
|
|
22694
|
+
)
|
|
22695
|
+
};
|
|
22247
22696
|
}
|
|
22248
22697
|
// ─── Raw fetchers ────────────────────────────────────────────────────────────
|
|
22249
22698
|
mapDestRow(r) {
|
|
@@ -22263,7 +22712,8 @@ var SqliteSharesRepository = class {
|
|
|
22263
22712
|
fetchDestinations(q, kinds, reviewOnly = false) {
|
|
22264
22713
|
const cols = `d.id, d.kind, d.name, d.host, d.category, d.trust, d.note,
|
|
22265
22714
|
d.network_json AS networkJson, d.last_seen AS lastSeenMs,
|
|
22266
|
-
d.created_at AS createdAt,
|
|
22715
|
+
d.created_at AS createdAt,
|
|
22716
|
+
COALESCE(oh.decision, ol.decision) AS overrideDecision`;
|
|
22267
22717
|
const conditions = [];
|
|
22268
22718
|
const params = [];
|
|
22269
22719
|
if (kinds && kinds.length > 0) {
|
|
@@ -22274,7 +22724,8 @@ var SqliteSharesRepository = class {
|
|
|
22274
22724
|
conditions.push(
|
|
22275
22725
|
`(d.trust IN ('unverified', 'ip')
|
|
22276
22726
|
OR EXISTS (SELECT 1 FROM share_endpoint re
|
|
22277
|
-
WHERE re.destination_id = d.id
|
|
22727
|
+
WHERE re.destination_id = d.id
|
|
22728
|
+
AND re.transport IN ${PLAINTEXT_TRANSPORT_SQL}))`
|
|
22278
22729
|
);
|
|
22279
22730
|
}
|
|
22280
22731
|
let sql;
|
|
@@ -22287,7 +22738,7 @@ var SqliteSharesRepository = class {
|
|
|
22287
22738
|
params.push(pattern, pattern, pattern, pattern, pattern);
|
|
22288
22739
|
sql = `SELECT DISTINCT ${cols}
|
|
22289
22740
|
FROM share_destination d
|
|
22290
|
-
|
|
22741
|
+
${OVERRIDE_JOIN}
|
|
22291
22742
|
LEFT JOIN share_endpoint e ON e.destination_id = d.id
|
|
22292
22743
|
LEFT JOIN share_call_site c ON c.endpoint_id = e.id
|
|
22293
22744
|
${conditions.length ? `WHERE ${conditions.join(" AND ")}` : ""}
|
|
@@ -22295,7 +22746,7 @@ var SqliteSharesRepository = class {
|
|
|
22295
22746
|
} else {
|
|
22296
22747
|
sql = `SELECT ${cols}
|
|
22297
22748
|
FROM share_destination d
|
|
22298
|
-
|
|
22749
|
+
${OVERRIDE_JOIN}
|
|
22299
22750
|
${conditions.length ? `WHERE ${conditions.join(" AND ")}` : ""}
|
|
22300
22751
|
ORDER BY d.created_at ASC, d.id ASC`;
|
|
22301
22752
|
}
|
|
@@ -22310,9 +22761,9 @@ var SqliteSharesRepository = class {
|
|
|
22310
22761
|
this.db.prepare(
|
|
22311
22762
|
`SELECT d.id, d.kind, d.name, d.host, d.category, d.trust, d.note,
|
|
22312
22763
|
d.network_json AS networkJson, d.last_seen AS lastSeenMs,
|
|
22313
|
-
|
|
22764
|
+
COALESCE(oh.decision, ol.decision) AS overrideDecision
|
|
22314
22765
|
FROM share_destination d
|
|
22315
|
-
|
|
22766
|
+
${OVERRIDE_JOIN}
|
|
22316
22767
|
WHERE d.id = ?`
|
|
22317
22768
|
),
|
|
22318
22769
|
[destinationId]
|
|
@@ -22541,6 +22992,7 @@ function openLocalDatabase(dir) {
|
|
|
22541
22992
|
const scanLedger = new SqliteScanLedgerRepository(db);
|
|
22542
22993
|
const exceptions = new SqliteExceptionsRepository(db);
|
|
22543
22994
|
const resolutions = new SqliteResolutionsRepository(db);
|
|
22995
|
+
const ruleProbeCache = new SqliteRuleProbeCacheRepository(db);
|
|
22544
22996
|
const security = new SqliteSecurityRepository(db);
|
|
22545
22997
|
const detections = new SqliteDetectionsRepository(db);
|
|
22546
22998
|
const shares = new SqliteSharesRepository(db);
|
|
@@ -22678,6 +23130,7 @@ function openLocalDatabase(dir) {
|
|
|
22678
23130
|
scanLedger,
|
|
22679
23131
|
exceptions,
|
|
22680
23132
|
resolutions,
|
|
23133
|
+
ruleProbeCache,
|
|
22681
23134
|
security,
|
|
22682
23135
|
detections,
|
|
22683
23136
|
shares,
|
|
@@ -22890,13 +23343,581 @@ import { readdirSync, readFileSync as readFileSync4, realpathSync, statSync as s
|
|
|
22890
23343
|
import { homedir as homedir2 } from "os";
|
|
22891
23344
|
import { basename as basename2, join as join7 } from "path";
|
|
22892
23345
|
|
|
23346
|
+
// ../../packages/detections/src/egress/registry.ts
|
|
23347
|
+
var EXTRACTOR_VERSION = "1";
|
|
23348
|
+
var PROVIDER_REGISTRY = [
|
|
23349
|
+
{
|
|
23350
|
+
id: "stripe",
|
|
23351
|
+
name: "Stripe",
|
|
23352
|
+
category: "Payments",
|
|
23353
|
+
hostSuffixes: ["stripe.com"],
|
|
23354
|
+
apiBase: "https://api.stripe.com",
|
|
23355
|
+
defaultDataClasses: ["pii", "customer"],
|
|
23356
|
+
sdks: {
|
|
23357
|
+
npm: ["stripe"],
|
|
23358
|
+
pypi: ["stripe"],
|
|
23359
|
+
go: ["github.com/stripe/stripe-go"],
|
|
23360
|
+
maven: ["com.stripe"],
|
|
23361
|
+
rubygems: ["stripe"],
|
|
23362
|
+
composer: ["stripe/stripe-php"],
|
|
23363
|
+
nuget: ["Stripe.net"]
|
|
23364
|
+
}
|
|
23365
|
+
},
|
|
23366
|
+
{
|
|
23367
|
+
id: "datadog",
|
|
23368
|
+
name: "Datadog",
|
|
23369
|
+
category: "Observability",
|
|
23370
|
+
hostSuffixes: ["datadoghq.com", "datadoghq.eu"],
|
|
23371
|
+
apiBase: "https://api.datadoghq.com",
|
|
23372
|
+
defaultDataClasses: ["telemetry", "logs", "metrics"],
|
|
23373
|
+
sdks: {
|
|
23374
|
+
npm: ["dd-trace", "@datadog/browser-logs"],
|
|
23375
|
+
pypi: ["datadog", "ddtrace"],
|
|
23376
|
+
go: ["github.com/DataDog/dd-trace-go"],
|
|
23377
|
+
maven: ["com.datadoghq"],
|
|
23378
|
+
rubygems: ["ddtrace", "dogapi"],
|
|
23379
|
+
nuget: ["Datadog.Trace"]
|
|
23380
|
+
}
|
|
23381
|
+
},
|
|
23382
|
+
{
|
|
23383
|
+
id: "newrelic",
|
|
23384
|
+
name: "New Relic",
|
|
23385
|
+
category: "Observability",
|
|
23386
|
+
hostSuffixes: ["newrelic.com", "nr-data.net"],
|
|
23387
|
+
apiBase: "https://api.newrelic.com",
|
|
23388
|
+
defaultDataClasses: ["telemetry", "logs", "metrics"],
|
|
23389
|
+
sdks: {
|
|
23390
|
+
npm: ["newrelic"],
|
|
23391
|
+
pypi: ["newrelic"],
|
|
23392
|
+
go: ["github.com/newrelic/go-agent"],
|
|
23393
|
+
maven: ["com.newrelic.agent.java"],
|
|
23394
|
+
rubygems: ["newrelic_rpm"],
|
|
23395
|
+
nuget: ["NewRelic.Agent"]
|
|
23396
|
+
}
|
|
23397
|
+
},
|
|
23398
|
+
{
|
|
23399
|
+
id: "sentry",
|
|
23400
|
+
name: "Sentry",
|
|
23401
|
+
category: "Error tracking",
|
|
23402
|
+
hostSuffixes: ["sentry.io"],
|
|
23403
|
+
apiBase: "https://sentry.io",
|
|
23404
|
+
defaultDataClasses: ["source", "telemetry"],
|
|
23405
|
+
sdks: {
|
|
23406
|
+
npm: ["@sentry/node", "@sentry/react", "@sentry/nextjs"],
|
|
23407
|
+
pypi: ["sentry-sdk"],
|
|
23408
|
+
go: ["github.com/getsentry/sentry-go"],
|
|
23409
|
+
maven: ["io.sentry"],
|
|
23410
|
+
rubygems: ["sentry-ruby"],
|
|
23411
|
+
cargo: ["sentry"],
|
|
23412
|
+
composer: ["sentry/sentry"],
|
|
23413
|
+
nuget: ["Sentry"]
|
|
23414
|
+
}
|
|
23415
|
+
},
|
|
23416
|
+
{
|
|
23417
|
+
id: "openai",
|
|
23418
|
+
name: "OpenAI",
|
|
23419
|
+
category: "LLM provider",
|
|
23420
|
+
hostSuffixes: ["openai.com"],
|
|
23421
|
+
apiBase: "https://api.openai.com",
|
|
23422
|
+
defaultDataClasses: ["pii", "source"],
|
|
23423
|
+
sdks: {
|
|
23424
|
+
npm: ["openai"],
|
|
23425
|
+
pypi: ["openai"],
|
|
23426
|
+
go: ["github.com/sashabaranov/go-openai"],
|
|
23427
|
+
maven: ["com.openai"],
|
|
23428
|
+
rubygems: ["ruby-openai"],
|
|
23429
|
+
cargo: ["async-openai"],
|
|
23430
|
+
composer: ["openai-php/client"],
|
|
23431
|
+
nuget: ["OpenAI"]
|
|
23432
|
+
}
|
|
23433
|
+
},
|
|
23434
|
+
{
|
|
23435
|
+
id: "anthropic",
|
|
23436
|
+
name: "Anthropic",
|
|
23437
|
+
category: "LLM provider",
|
|
23438
|
+
hostSuffixes: ["anthropic.com"],
|
|
23439
|
+
apiBase: "https://api.anthropic.com",
|
|
23440
|
+
defaultDataClasses: ["pii", "source"],
|
|
23441
|
+
sdks: {
|
|
23442
|
+
npm: ["@anthropic-ai/sdk"],
|
|
23443
|
+
pypi: ["anthropic"],
|
|
23444
|
+
go: ["github.com/anthropics/anthropic-sdk-go"],
|
|
23445
|
+
nuget: ["Anthropic.SDK"]
|
|
23446
|
+
}
|
|
23447
|
+
},
|
|
23448
|
+
{
|
|
23449
|
+
id: "aws",
|
|
23450
|
+
name: "Amazon Web Services",
|
|
23451
|
+
category: "Cloud platform",
|
|
23452
|
+
hostSuffixes: ["amazonaws.com"],
|
|
23453
|
+
apiBase: "https://s3.amazonaws.com",
|
|
23454
|
+
defaultDataClasses: ["secrets", "customer"],
|
|
23455
|
+
sdks: {
|
|
23456
|
+
npm: ["@aws-sdk/client-s3", "aws-sdk"],
|
|
23457
|
+
pypi: ["boto3"],
|
|
23458
|
+
go: ["github.com/aws/aws-sdk-go", "github.com/aws/aws-sdk-go-v2"],
|
|
23459
|
+
maven: ["com.amazonaws", "software.amazon.awssdk"],
|
|
23460
|
+
rubygems: ["aws-sdk-s3"],
|
|
23461
|
+
cargo: ["aws-sdk-s3"],
|
|
23462
|
+
nuget: ["AWSSDK.S3"]
|
|
23463
|
+
}
|
|
23464
|
+
},
|
|
23465
|
+
{
|
|
23466
|
+
id: "gcp",
|
|
23467
|
+
name: "Google Cloud",
|
|
23468
|
+
category: "Cloud platform",
|
|
23469
|
+
hostSuffixes: ["googleapis.com"],
|
|
23470
|
+
apiBase: "https://storage.googleapis.com",
|
|
23471
|
+
defaultDataClasses: ["customer", "logs"],
|
|
23472
|
+
sdks: {
|
|
23473
|
+
npm: ["@google-cloud/storage"],
|
|
23474
|
+
pypi: ["google-cloud-storage"],
|
|
23475
|
+
go: ["cloud.google.com/go"],
|
|
23476
|
+
maven: ["com.google.cloud"],
|
|
23477
|
+
rubygems: ["google-cloud-storage"],
|
|
23478
|
+
nuget: ["Google.Cloud.Storage.V1"]
|
|
23479
|
+
}
|
|
23480
|
+
},
|
|
23481
|
+
{
|
|
23482
|
+
id: "azure",
|
|
23483
|
+
name: "Microsoft Azure",
|
|
23484
|
+
category: "Cloud platform",
|
|
23485
|
+
hostSuffixes: ["azure.com", "windows.net"],
|
|
23486
|
+
apiBase: "https://management.azure.com",
|
|
23487
|
+
defaultDataClasses: ["customer", "logs"],
|
|
23488
|
+
sdks: {
|
|
23489
|
+
npm: ["@azure/storage-blob"],
|
|
23490
|
+
pypi: ["azure-storage-blob"],
|
|
23491
|
+
go: ["github.com/Azure/azure-sdk-for-go"],
|
|
23492
|
+
maven: ["com.azure"],
|
|
23493
|
+
rubygems: ["azure-storage-blob"],
|
|
23494
|
+
nuget: ["Azure.Storage.Blobs"]
|
|
23495
|
+
}
|
|
23496
|
+
},
|
|
23497
|
+
{
|
|
23498
|
+
id: "slack",
|
|
23499
|
+
name: "Slack",
|
|
23500
|
+
category: "Notifications",
|
|
23501
|
+
hostSuffixes: ["slack.com"],
|
|
23502
|
+
apiBase: "https://slack.com/api",
|
|
23503
|
+
defaultDataClasses: ["logs"],
|
|
23504
|
+
sdks: {
|
|
23505
|
+
npm: ["@slack/web-api"],
|
|
23506
|
+
pypi: ["slack-sdk"],
|
|
23507
|
+
go: ["github.com/slack-go/slack"],
|
|
23508
|
+
maven: ["com.slack.api"],
|
|
23509
|
+
rubygems: ["slack-ruby-client"],
|
|
23510
|
+
composer: ["slack-php/slack-api"],
|
|
23511
|
+
nuget: ["SlackNet"]
|
|
23512
|
+
}
|
|
23513
|
+
},
|
|
23514
|
+
{
|
|
23515
|
+
id: "segment",
|
|
23516
|
+
name: "Segment",
|
|
23517
|
+
category: "Analytics",
|
|
23518
|
+
hostSuffixes: ["segment.io", "segment.com"],
|
|
23519
|
+
apiBase: "https://api.segment.io",
|
|
23520
|
+
defaultDataClasses: ["customer"],
|
|
23521
|
+
sdks: {
|
|
23522
|
+
npm: ["@segment/analytics-node", "analytics-node"],
|
|
23523
|
+
pypi: ["segment-analytics-python"],
|
|
23524
|
+
go: ["github.com/segmentio/analytics-go"],
|
|
23525
|
+
maven: ["com.segment.analytics.java"],
|
|
23526
|
+
rubygems: ["analytics-ruby"],
|
|
23527
|
+
nuget: ["Analytics"]
|
|
23528
|
+
}
|
|
23529
|
+
},
|
|
23530
|
+
{
|
|
23531
|
+
id: "twilio",
|
|
23532
|
+
name: "Twilio",
|
|
23533
|
+
category: "Communications",
|
|
23534
|
+
hostSuffixes: ["twilio.com"],
|
|
23535
|
+
apiBase: "https://api.twilio.com",
|
|
23536
|
+
defaultDataClasses: ["pii", "customer"],
|
|
23537
|
+
sdks: {
|
|
23538
|
+
npm: ["twilio"],
|
|
23539
|
+
pypi: ["twilio"],
|
|
23540
|
+
go: ["github.com/twilio/twilio-go"],
|
|
23541
|
+
maven: ["com.twilio.sdk"],
|
|
23542
|
+
rubygems: ["twilio-ruby"],
|
|
23543
|
+
composer: ["twilio/sdk"],
|
|
23544
|
+
nuget: ["Twilio"]
|
|
23545
|
+
}
|
|
23546
|
+
},
|
|
23547
|
+
{
|
|
23548
|
+
id: "sendgrid",
|
|
23549
|
+
name: "SendGrid",
|
|
23550
|
+
category: "Email",
|
|
23551
|
+
hostSuffixes: ["sendgrid.com"],
|
|
23552
|
+
apiBase: "https://api.sendgrid.com",
|
|
23553
|
+
defaultDataClasses: ["pii"],
|
|
23554
|
+
sdks: {
|
|
23555
|
+
npm: ["@sendgrid/mail"],
|
|
23556
|
+
pypi: ["sendgrid"],
|
|
23557
|
+
go: ["github.com/sendgrid/sendgrid-go"],
|
|
23558
|
+
maven: ["com.sendgrid"],
|
|
23559
|
+
rubygems: ["sendgrid-ruby"],
|
|
23560
|
+
composer: ["sendgrid/sendgrid"],
|
|
23561
|
+
nuget: ["SendGrid"]
|
|
23562
|
+
}
|
|
23563
|
+
},
|
|
23564
|
+
{
|
|
23565
|
+
id: "mailgun",
|
|
23566
|
+
name: "Mailgun",
|
|
23567
|
+
category: "Email",
|
|
23568
|
+
hostSuffixes: ["mailgun.net"],
|
|
23569
|
+
apiBase: "https://api.mailgun.net",
|
|
23570
|
+
defaultDataClasses: ["pii"],
|
|
23571
|
+
sdks: {
|
|
23572
|
+
npm: ["mailgun.js"],
|
|
23573
|
+
pypi: ["mailgun"],
|
|
23574
|
+
rubygems: ["mailgun-ruby"],
|
|
23575
|
+
composer: ["mailgun/mailgun-php"],
|
|
23576
|
+
nuget: ["Mailgun"]
|
|
23577
|
+
}
|
|
23578
|
+
},
|
|
23579
|
+
{
|
|
23580
|
+
id: "mixpanel",
|
|
23581
|
+
name: "Mixpanel",
|
|
23582
|
+
category: "Analytics",
|
|
23583
|
+
hostSuffixes: ["mixpanel.com"],
|
|
23584
|
+
apiBase: "https://api.mixpanel.com",
|
|
23585
|
+
defaultDataClasses: ["customer", "telemetry"],
|
|
23586
|
+
sdks: {
|
|
23587
|
+
npm: ["mixpanel"],
|
|
23588
|
+
pypi: ["mixpanel"],
|
|
23589
|
+
rubygems: ["mixpanel-ruby"],
|
|
23590
|
+
nuget: ["Mixpanel"]
|
|
23591
|
+
}
|
|
23592
|
+
},
|
|
23593
|
+
{
|
|
23594
|
+
id: "amplitude",
|
|
23595
|
+
name: "Amplitude",
|
|
23596
|
+
category: "Analytics",
|
|
23597
|
+
hostSuffixes: ["amplitude.com"],
|
|
23598
|
+
apiBase: "https://api2.amplitude.com",
|
|
23599
|
+
defaultDataClasses: ["customer", "telemetry"],
|
|
23600
|
+
sdks: {
|
|
23601
|
+
npm: ["@amplitude/analytics-node"],
|
|
23602
|
+
pypi: ["amplitude-analytics"],
|
|
23603
|
+
nuget: ["Amplitude"]
|
|
23604
|
+
}
|
|
23605
|
+
},
|
|
23606
|
+
{
|
|
23607
|
+
id: "posthog",
|
|
23608
|
+
name: "PostHog",
|
|
23609
|
+
category: "Analytics",
|
|
23610
|
+
hostSuffixes: ["posthog.com"],
|
|
23611
|
+
apiBase: "https://us.i.posthog.com",
|
|
23612
|
+
defaultDataClasses: ["customer", "telemetry"],
|
|
23613
|
+
sdks: {
|
|
23614
|
+
npm: ["posthog-node", "posthog-js"],
|
|
23615
|
+
pypi: ["posthog"],
|
|
23616
|
+
go: ["github.com/posthog/posthog-go"],
|
|
23617
|
+
rubygems: ["posthog-ruby"],
|
|
23618
|
+
composer: ["posthog/posthog-php"],
|
|
23619
|
+
nuget: ["PostHog"]
|
|
23620
|
+
}
|
|
23621
|
+
},
|
|
23622
|
+
{
|
|
23623
|
+
id: "honeycomb",
|
|
23624
|
+
name: "Honeycomb",
|
|
23625
|
+
category: "Observability",
|
|
23626
|
+
hostSuffixes: ["honeycomb.io"],
|
|
23627
|
+
apiBase: "https://api.honeycomb.io",
|
|
23628
|
+
defaultDataClasses: ["telemetry", "metrics"],
|
|
23629
|
+
sdks: {
|
|
23630
|
+
npm: ["libhoney"],
|
|
23631
|
+
pypi: ["libhoney"],
|
|
23632
|
+
go: ["github.com/honeycombio/libhoney-go"],
|
|
23633
|
+
rubygems: ["libhoney"]
|
|
23634
|
+
}
|
|
23635
|
+
},
|
|
23636
|
+
{
|
|
23637
|
+
id: "grafana",
|
|
23638
|
+
name: "Grafana Cloud",
|
|
23639
|
+
category: "Observability",
|
|
23640
|
+
hostSuffixes: ["grafana.net"],
|
|
23641
|
+
apiBase: "https://grafana.net",
|
|
23642
|
+
defaultDataClasses: ["logs", "metrics"],
|
|
23643
|
+
sdks: {
|
|
23644
|
+
npm: ["@grafana/faro-web-sdk"]
|
|
23645
|
+
}
|
|
23646
|
+
},
|
|
23647
|
+
{
|
|
23648
|
+
id: "splunk",
|
|
23649
|
+
name: "Splunk",
|
|
23650
|
+
category: "Observability",
|
|
23651
|
+
hostSuffixes: ["splunkcloud.com", "splunk.com"],
|
|
23652
|
+
apiBase: "https://http-inputs.splunkcloud.com",
|
|
23653
|
+
defaultDataClasses: ["logs"],
|
|
23654
|
+
sdks: {
|
|
23655
|
+
npm: ["splunk-logging"],
|
|
23656
|
+
pypi: ["splunk-sdk"],
|
|
23657
|
+
maven: ["com.splunk"],
|
|
23658
|
+
nuget: ["Splunk.Logging.Common"]
|
|
23659
|
+
}
|
|
23660
|
+
},
|
|
23661
|
+
{
|
|
23662
|
+
id: "pagerduty",
|
|
23663
|
+
name: "PagerDuty",
|
|
23664
|
+
category: "Incident response",
|
|
23665
|
+
hostSuffixes: ["pagerduty.com"],
|
|
23666
|
+
apiBase: "https://api.pagerduty.com",
|
|
23667
|
+
defaultDataClasses: ["logs"],
|
|
23668
|
+
sdks: {
|
|
23669
|
+
npm: ["@pagerduty/pdjs"],
|
|
23670
|
+
pypi: ["pdpyras"],
|
|
23671
|
+
go: ["github.com/PagerDuty/go-pagerduty"],
|
|
23672
|
+
rubygems: ["pagerduty"]
|
|
23673
|
+
}
|
|
23674
|
+
},
|
|
23675
|
+
{
|
|
23676
|
+
id: "github",
|
|
23677
|
+
name: "GitHub",
|
|
23678
|
+
category: "Developer platform",
|
|
23679
|
+
hostSuffixes: ["github.com", "githubusercontent.com"],
|
|
23680
|
+
apiBase: "https://api.github.com",
|
|
23681
|
+
defaultDataClasses: ["source"],
|
|
23682
|
+
sdks: {
|
|
23683
|
+
npm: ["@octokit/rest", "octokit"],
|
|
23684
|
+
pypi: ["pygithub"],
|
|
23685
|
+
go: ["github.com/google/go-github"],
|
|
23686
|
+
maven: ["org.kohsuke.github-api"],
|
|
23687
|
+
rubygems: ["octokit"],
|
|
23688
|
+
cargo: ["octocrab"],
|
|
23689
|
+
composer: ["knplabs/github-api"],
|
|
23690
|
+
nuget: ["Octokit"]
|
|
23691
|
+
}
|
|
23692
|
+
},
|
|
23693
|
+
{
|
|
23694
|
+
id: "gitlab",
|
|
23695
|
+
name: "GitLab",
|
|
23696
|
+
category: "Developer platform",
|
|
23697
|
+
hostSuffixes: ["gitlab.com"],
|
|
23698
|
+
apiBase: "https://gitlab.com/api",
|
|
23699
|
+
defaultDataClasses: ["source"],
|
|
23700
|
+
sdks: {
|
|
23701
|
+
npm: ["@gitbeaker/rest"],
|
|
23702
|
+
pypi: ["python-gitlab"],
|
|
23703
|
+
go: ["gitlab.com/gitlab-org/api/client-go"],
|
|
23704
|
+
rubygems: ["gitlab"],
|
|
23705
|
+
nuget: ["GitLabApiClient"]
|
|
23706
|
+
}
|
|
23707
|
+
},
|
|
23708
|
+
{
|
|
23709
|
+
id: "auth0",
|
|
23710
|
+
name: "Auth0",
|
|
23711
|
+
category: "Identity",
|
|
23712
|
+
hostSuffixes: ["auth0.com"],
|
|
23713
|
+
apiBase: "https://login.auth0.com",
|
|
23714
|
+
defaultDataClasses: ["pii"],
|
|
23715
|
+
sdks: {
|
|
23716
|
+
npm: ["auth0"],
|
|
23717
|
+
pypi: ["auth0-python"],
|
|
23718
|
+
go: ["github.com/auth0/go-auth0"],
|
|
23719
|
+
maven: ["com.auth0"],
|
|
23720
|
+
rubygems: ["auth0"],
|
|
23721
|
+
composer: ["auth0/auth0-php"],
|
|
23722
|
+
nuget: ["Auth0.ManagementApi"]
|
|
23723
|
+
}
|
|
23724
|
+
},
|
|
23725
|
+
{
|
|
23726
|
+
id: "okta",
|
|
23727
|
+
name: "Okta",
|
|
23728
|
+
category: "Identity",
|
|
23729
|
+
hostSuffixes: ["okta.com", "oktapreview.com"],
|
|
23730
|
+
apiBase: "https://login.okta.com",
|
|
23731
|
+
defaultDataClasses: ["pii"],
|
|
23732
|
+
sdks: {
|
|
23733
|
+
npm: ["@okta/okta-sdk-nodejs"],
|
|
23734
|
+
pypi: ["okta"],
|
|
23735
|
+
go: ["github.com/okta/okta-sdk-golang"],
|
|
23736
|
+
maven: ["com.okta.sdk"],
|
|
23737
|
+
nuget: ["Okta.Sdk"]
|
|
23738
|
+
}
|
|
23739
|
+
},
|
|
23740
|
+
{
|
|
23741
|
+
id: "clerk",
|
|
23742
|
+
name: "Clerk",
|
|
23743
|
+
category: "Identity",
|
|
23744
|
+
hostSuffixes: ["clerk.com", "clerk.dev"],
|
|
23745
|
+
apiBase: "https://api.clerk.com",
|
|
23746
|
+
defaultDataClasses: ["pii"],
|
|
23747
|
+
sdks: {
|
|
23748
|
+
npm: ["@clerk/backend", "@clerk/nextjs"],
|
|
23749
|
+
pypi: ["clerk-backend-api"],
|
|
23750
|
+
go: ["github.com/clerk/clerk-sdk-go"]
|
|
23751
|
+
}
|
|
23752
|
+
},
|
|
23753
|
+
{
|
|
23754
|
+
id: "supabase",
|
|
23755
|
+
name: "Supabase",
|
|
23756
|
+
category: "Backend platform",
|
|
23757
|
+
hostSuffixes: ["supabase.co", "supabase.com"],
|
|
23758
|
+
apiBase: "https://api.supabase.com",
|
|
23759
|
+
defaultDataClasses: ["pii", "customer"],
|
|
23760
|
+
sdks: {
|
|
23761
|
+
npm: ["@supabase/supabase-js"],
|
|
23762
|
+
pypi: ["supabase"],
|
|
23763
|
+
cargo: ["postgrest"]
|
|
23764
|
+
}
|
|
23765
|
+
},
|
|
23766
|
+
{
|
|
23767
|
+
id: "firebase",
|
|
23768
|
+
name: "Firebase",
|
|
23769
|
+
category: "Backend platform",
|
|
23770
|
+
hostSuffixes: ["firebaseio.com", "firebase.google.com"],
|
|
23771
|
+
apiBase: "https://firebaseio.com",
|
|
23772
|
+
defaultDataClasses: ["customer"],
|
|
23773
|
+
sdks: {
|
|
23774
|
+
npm: ["firebase", "firebase-admin"],
|
|
23775
|
+
pypi: ["firebase-admin"],
|
|
23776
|
+
go: ["firebase.google.com/go"],
|
|
23777
|
+
maven: ["com.google.firebase"]
|
|
23778
|
+
}
|
|
23779
|
+
},
|
|
23780
|
+
{
|
|
23781
|
+
id: "mongodb-atlas",
|
|
23782
|
+
name: "MongoDB Atlas",
|
|
23783
|
+
category: "Database SaaS",
|
|
23784
|
+
hostSuffixes: ["mongodb.net", "mongodb.com"],
|
|
23785
|
+
apiBase: "https://cloud.mongodb.com",
|
|
23786
|
+
defaultDataClasses: ["customer"],
|
|
23787
|
+
sdks: {
|
|
23788
|
+
npm: ["mongodb"],
|
|
23789
|
+
pypi: ["pymongo"],
|
|
23790
|
+
go: ["go.mongodb.org/mongo-driver"],
|
|
23791
|
+
maven: ["org.mongodb"],
|
|
23792
|
+
rubygems: ["mongo"],
|
|
23793
|
+
cargo: ["mongodb"],
|
|
23794
|
+
nuget: ["MongoDB.Driver"]
|
|
23795
|
+
}
|
|
23796
|
+
},
|
|
23797
|
+
{
|
|
23798
|
+
id: "planetscale",
|
|
23799
|
+
name: "PlanetScale",
|
|
23800
|
+
category: "Database SaaS",
|
|
23801
|
+
hostSuffixes: ["psdb.cloud", "planetscale.com"],
|
|
23802
|
+
apiBase: "https://api.planetscale.com",
|
|
23803
|
+
defaultDataClasses: ["customer"],
|
|
23804
|
+
sdks: {
|
|
23805
|
+
npm: ["@planetscale/database"],
|
|
23806
|
+
go: ["github.com/planetscale/planetscale-go"]
|
|
23807
|
+
}
|
|
23808
|
+
},
|
|
23809
|
+
{
|
|
23810
|
+
id: "algolia",
|
|
23811
|
+
name: "Algolia",
|
|
23812
|
+
category: "Search SaaS",
|
|
23813
|
+
hostSuffixes: ["algolia.net", "algolianet.com"],
|
|
23814
|
+
apiBase: "https://algolia.net",
|
|
23815
|
+
defaultDataClasses: ["customer"],
|
|
23816
|
+
sdks: {
|
|
23817
|
+
npm: ["algoliasearch"],
|
|
23818
|
+
pypi: ["algoliasearch"],
|
|
23819
|
+
go: ["github.com/algolia/algoliasearch-client-go"],
|
|
23820
|
+
maven: ["com.algolia"],
|
|
23821
|
+
rubygems: ["algolia"],
|
|
23822
|
+
composer: ["algolia/algoliasearch-client-php"],
|
|
23823
|
+
nuget: ["Algolia.Search"]
|
|
23824
|
+
}
|
|
23825
|
+
},
|
|
23826
|
+
{
|
|
23827
|
+
id: "cloudflare",
|
|
23828
|
+
name: "Cloudflare",
|
|
23829
|
+
category: "CDN / edge",
|
|
23830
|
+
hostSuffixes: ["cloudflare.com", "workers.dev"],
|
|
23831
|
+
apiBase: "https://api.cloudflare.com",
|
|
23832
|
+
defaultDataClasses: ["logs"],
|
|
23833
|
+
sdks: {
|
|
23834
|
+
npm: ["cloudflare"],
|
|
23835
|
+
pypi: ["cloudflare"],
|
|
23836
|
+
go: ["github.com/cloudflare/cloudflare-go"],
|
|
23837
|
+
nuget: ["CloudFlare.Client"]
|
|
23838
|
+
}
|
|
23839
|
+
},
|
|
23840
|
+
{
|
|
23841
|
+
id: "huggingface",
|
|
23842
|
+
name: "Hugging Face",
|
|
23843
|
+
category: "LLM provider",
|
|
23844
|
+
hostSuffixes: ["huggingface.co"],
|
|
23845
|
+
apiBase: "https://api-inference.huggingface.co",
|
|
23846
|
+
defaultDataClasses: ["source"],
|
|
23847
|
+
sdks: {
|
|
23848
|
+
npm: ["@huggingface/inference"],
|
|
23849
|
+
pypi: ["huggingface-hub", "transformers"],
|
|
23850
|
+
rubygems: ["hugging-face"]
|
|
23851
|
+
}
|
|
23852
|
+
},
|
|
23853
|
+
{
|
|
23854
|
+
id: "cohere",
|
|
23855
|
+
name: "Cohere",
|
|
23856
|
+
category: "LLM provider",
|
|
23857
|
+
hostSuffixes: ["cohere.com", "cohere.ai"],
|
|
23858
|
+
apiBase: "https://api.cohere.com",
|
|
23859
|
+
defaultDataClasses: ["pii", "source"],
|
|
23860
|
+
sdks: {
|
|
23861
|
+
npm: ["cohere-ai"],
|
|
23862
|
+
pypi: ["cohere"],
|
|
23863
|
+
go: ["github.com/cohere-ai/cohere-go"]
|
|
23864
|
+
}
|
|
23865
|
+
},
|
|
23866
|
+
{
|
|
23867
|
+
id: "mistral",
|
|
23868
|
+
name: "Mistral AI",
|
|
23869
|
+
category: "LLM provider",
|
|
23870
|
+
hostSuffixes: ["mistral.ai"],
|
|
23871
|
+
apiBase: "https://api.mistral.ai",
|
|
23872
|
+
defaultDataClasses: ["pii", "source"],
|
|
23873
|
+
sdks: {
|
|
23874
|
+
npm: ["@mistralai/mistralai"],
|
|
23875
|
+
pypi: ["mistralai"],
|
|
23876
|
+
go: ["github.com/gage-technologies/mistral-go"]
|
|
23877
|
+
}
|
|
23878
|
+
}
|
|
23879
|
+
];
|
|
23880
|
+
var EGRESS_VERSION_MATERIAL = `${EXTRACTOR_VERSION}
|
|
23881
|
+
${JSON.stringify(PROVIDER_REGISTRY)}`;
|
|
23882
|
+
|
|
23883
|
+
// ../../packages/detections/src/egress/extract.ts
|
|
23884
|
+
var SECRET_KEY_NAMES = "api[_-]?key|apikey|private[_-]?key|access[_-]?key|access[_-]?token|token|secret|credentials?|password|passwd|pwd|authorization|sig|signature|sas|assertion";
|
|
23885
|
+
var AUTH_SCHEMES = "Bearer|Basic|Token|Digest|ApiKey|SSWS|AWS4-HMAC-SHA256";
|
|
23886
|
+
var SECRET_VALUE = new RegExp(
|
|
23887
|
+
`((?:${SECRET_KEY_NAMES})['"\`]?\\s*[:=]\\s*['"\`]?)(?!(?:${AUTH_SCHEMES})[\\s'"\`])[^\\s'"\`&]+`,
|
|
23888
|
+
"gi"
|
|
23889
|
+
);
|
|
23890
|
+
var AUTH_SCHEME_VALUE = new RegExp(
|
|
23891
|
+
`((?:${SECRET_KEY_NAMES})['"\`]?\\s*[:=]\\s*['"\`]?)(${AUTH_SCHEMES})\\s+[^\\s'"\`]+`,
|
|
23892
|
+
"gi"
|
|
23893
|
+
);
|
|
23894
|
+
var WEBHOOK_SECRET_PATHS = [
|
|
23895
|
+
{ hosts: ["hooks.slack.com"], prefix: "/services/" },
|
|
23896
|
+
{
|
|
23897
|
+
hosts: ["discord.com", "discordapp.com", "ptb.discord.com", "canary.discord.com"],
|
|
23898
|
+
prefix: "/api/webhooks/"
|
|
23899
|
+
},
|
|
23900
|
+
{ hosts: ["hooks.zapier.com"], prefix: "/hooks/" },
|
|
23901
|
+
{ hosts: ["outlook.office.com", "outlook.office365.com"], prefix: "/webhook/" }
|
|
23902
|
+
];
|
|
23903
|
+
function escapeRegExp(literal2) {
|
|
23904
|
+
return literal2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
23905
|
+
}
|
|
23906
|
+
var WEBHOOK_URL = new RegExp(
|
|
23907
|
+
`(https?://(?:${WEBHOOK_SECRET_PATHS.flatMap(
|
|
23908
|
+
(entry) => entry.hosts.map((host) => `${escapeRegExp(host)}${escapeRegExp(entry.prefix)}`)
|
|
23909
|
+
).join("|")}))[^\\s'"\`<>()[\\]{},;]+`,
|
|
23910
|
+
"gi"
|
|
23911
|
+
);
|
|
23912
|
+
|
|
22893
23913
|
// ../../packages/detections/src/escape-regexp.ts
|
|
22894
|
-
function
|
|
23914
|
+
function escapeRegExp2(value) {
|
|
22895
23915
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
22896
23916
|
}
|
|
22897
23917
|
|
|
22898
23918
|
// ../../packages/detections/src/matchers/limits.ts
|
|
22899
23919
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
23920
|
+
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
22900
23921
|
|
|
22901
23922
|
// ../../packages/detections/src/matchers/keyword.ts
|
|
22902
23923
|
var KeywordMatcher2 = class {
|
|
@@ -22907,7 +23928,7 @@ var KeywordMatcher2 = class {
|
|
|
22907
23928
|
for (const kw of keywords) {
|
|
22908
23929
|
if (kw.length === 0) continue;
|
|
22909
23930
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
22910
|
-
const re = new RegExp(
|
|
23931
|
+
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
22911
23932
|
let m;
|
|
22912
23933
|
while ((m = re.exec(text)) !== null) {
|
|
22913
23934
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -22924,9 +23945,13 @@ var RegexMatcher2 = class {
|
|
|
22924
23945
|
if (rule.matcher.type !== "regex") return [];
|
|
22925
23946
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
22926
23947
|
const re = new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`);
|
|
23948
|
+
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
22927
23949
|
const spans = [];
|
|
22928
23950
|
let m;
|
|
22929
|
-
|
|
23951
|
+
const maxIterations = scanText2.length + 1;
|
|
23952
|
+
let iterations = 0;
|
|
23953
|
+
while ((m = re.exec(scanText2)) !== null) {
|
|
23954
|
+
if (++iterations > maxIterations) break;
|
|
22930
23955
|
const group = captureGroup != null ? m[captureGroup] : m[0];
|
|
22931
23956
|
if (m[0].length === 0) re.lastIndex++;
|
|
22932
23957
|
if (group && spans.length < MAX_MATCHES_PER_RULE) {
|
|
@@ -23001,6 +24026,31 @@ var CONFIG_POSTURE_RULES = [
|
|
|
23001
24026
|
}
|
|
23002
24027
|
];
|
|
23003
24028
|
|
|
24029
|
+
// ../../packages/detections/src/security/redos-probe.ts
|
|
24030
|
+
var EXPONENTIAL_UNITS = [
|
|
24031
|
+
"a",
|
|
24032
|
+
"0",
|
|
24033
|
+
" ",
|
|
24034
|
+
"x",
|
|
24035
|
+
"ab",
|
|
24036
|
+
"a.",
|
|
24037
|
+
"a-",
|
|
24038
|
+
"a_",
|
|
24039
|
+
"a@",
|
|
24040
|
+
"a/",
|
|
24041
|
+
"a:",
|
|
24042
|
+
"a=",
|
|
24043
|
+
"a;",
|
|
24044
|
+
"aA0",
|
|
24045
|
+
" "
|
|
24046
|
+
];
|
|
24047
|
+
var EXPONENTIAL_PROBES = EXPONENTIAL_UNITS.flatMap(
|
|
24048
|
+
(unit) => [23, 25].map((len) => unit.repeat(Math.ceil(len / unit.length)).slice(0, len) + "!")
|
|
24049
|
+
);
|
|
24050
|
+
var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map(
|
|
24051
|
+
(unit) => unit.repeat(1e4).slice(0, 4e4) + "!"
|
|
24052
|
+
);
|
|
24053
|
+
|
|
23004
24054
|
// ../../rules/code-flaws/auth-jwt-no-verify.json
|
|
23005
24055
|
var auth_jwt_no_verify_default = {
|
|
23006
24056
|
specVersion: 1,
|
|
@@ -25043,10 +26093,14 @@ import { arch, hostname as hostname3, platform, release } from "os";
|
|
|
25043
26093
|
import { mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
25044
26094
|
import { join as join8 } from "path";
|
|
25045
26095
|
|
|
26096
|
+
// ../../packages/plugin-sdk/src/paths.ts
|
|
26097
|
+
import { readdirSync as readdirSync2, realpathSync as realpathSync2 } from "fs";
|
|
26098
|
+
import { basename as basename3, dirname as dirname2, sep as sep3 } from "path";
|
|
26099
|
+
|
|
25046
26100
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
25047
26101
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
25048
|
-
import { existsSync as existsSync4, readdirSync as
|
|
25049
|
-
import { basename as
|
|
26102
|
+
import { existsSync as existsSync4, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "fs";
|
|
26103
|
+
import { basename as basename4, join as join9, relative, sep as sep4 } from "path";
|
|
25050
26104
|
|
|
25051
26105
|
// ../../packages/plugin-sdk/src/runtime.ts
|
|
25052
26106
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
@@ -25327,6 +26381,13 @@ var StandaloneDataGateway = class {
|
|
|
25327
26381
|
this.db.scanLedger.upsertEntries(entries);
|
|
25328
26382
|
return Promise.resolve();
|
|
25329
26383
|
}
|
|
26384
|
+
getRuleProbeVerdict(ruleKey) {
|
|
26385
|
+
return Promise.resolve(this.db.ruleProbeCache.getVerdict(ruleKey));
|
|
26386
|
+
}
|
|
26387
|
+
setRuleProbeVerdict(ruleKey, verdict, worstProbeMs) {
|
|
26388
|
+
this.db.ruleProbeCache.setVerdict(ruleKey, verdict, worstProbeMs);
|
|
26389
|
+
return Promise.resolve();
|
|
26390
|
+
}
|
|
25330
26391
|
openAtRestKeysForPath(path) {
|
|
25331
26392
|
return Promise.resolve(this.db.resolutions.openAtRestKeysForPath(path));
|
|
25332
26393
|
}
|
|
@@ -25337,6 +26398,12 @@ var StandaloneDataGateway = class {
|
|
|
25337
26398
|
this.db.resolutions.insertResolution(input);
|
|
25338
26399
|
return Promise.resolve();
|
|
25339
26400
|
}
|
|
26401
|
+
// Bare forward — no toggle read here. The plugin-path kill-switch is
|
|
26402
|
+
// enforced by the caller, which already holds the parsed workspace
|
|
26403
|
+
// settings; this class only ever sees `dataDir`, not the settings base.
|
|
26404
|
+
recordProjectEgress(input) {
|
|
26405
|
+
return Promise.resolve(this.db.shares.recordProjectEgress(input));
|
|
26406
|
+
}
|
|
25340
26407
|
close() {
|
|
25341
26408
|
this.db.close();
|
|
25342
26409
|
return Promise.resolve();
|
|
@@ -25354,12 +26421,12 @@ import { randomUUID as randomUUID12 } from "crypto";
|
|
|
25354
26421
|
var EXCEPTION_RETENTION_MS = 90 * 24 * 60 * 60 * 1e3;
|
|
25355
26422
|
|
|
25356
26423
|
// src/command-registry.ts
|
|
25357
|
-
import { readdirSync as
|
|
26424
|
+
import { readdirSync as readdirSync4 } from "fs";
|
|
25358
26425
|
import { fileURLToPath } from "url";
|
|
25359
26426
|
var COMMAND_NAMESPACE = "aka";
|
|
25360
26427
|
var COMMANDS_DIR = fileURLToPath(new URL("../commands", import.meta.url));
|
|
25361
26428
|
function readRegisteredCommands() {
|
|
25362
|
-
return
|
|
26429
|
+
return readdirSync4(COMMANDS_DIR).filter((f) => f.endsWith(".md")).map((f) => `/${COMMAND_NAMESPACE}:${f.replace(/\.md$/, "")}`);
|
|
25363
26430
|
}
|
|
25364
26431
|
function selectRegisteredCommands(curated, registry2) {
|
|
25365
26432
|
const registered = new Set(registry2);
|
|
@@ -25440,8 +26507,8 @@ function table(headers, rows, opts = {}) {
|
|
|
25440
26507
|
const widths = headers.map(
|
|
25441
26508
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
25442
26509
|
);
|
|
25443
|
-
const
|
|
25444
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
26510
|
+
const sep5 = " ".repeat(gap);
|
|
26511
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep5);
|
|
25445
26512
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
25446
26513
|
if (opts.rowSep === true) {
|
|
25447
26514
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -25453,7 +26520,7 @@ function table(headers, rows, opts = {}) {
|
|
|
25453
26520
|
});
|
|
25454
26521
|
return [headerLine, rule, ...body].join("\n");
|
|
25455
26522
|
}
|
|
25456
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
26523
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep5);
|
|
25457
26524
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
25458
26525
|
}
|
|
25459
26526
|
function fenced(body) {
|