@seekrit/mcp 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1678 -167
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
-
import
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { z as z$1 } from "zod";
|
|
6
7
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
8
|
import { homedir } from "node:os";
|
|
8
9
|
import { dirname, join, parse } from "node:path";
|
|
@@ -97,6 +98,26 @@ z.object({
|
|
|
97
98
|
*/
|
|
98
99
|
entries: z.array(activityEntrySchema).min(1).max(500)
|
|
99
100
|
});
|
|
101
|
+
// ../../packages/core/src/agent-login.ts
|
|
102
|
+
/** Where each kind of login is stored unless told otherwise. */
|
|
103
|
+
const AGENT_LOGIN_SECRETS = {
|
|
104
|
+
/** Codex's `auth.json`, as an envelope. */
|
|
105
|
+
codex: "CODEX_LOGIN",
|
|
106
|
+
/** Claude Code's full `.credentials.json`, as an envelope. */
|
|
107
|
+
claude: "CLAUDE_LOGIN",
|
|
108
|
+
/** A `claude setup-token` token — a plain secret, the variable Claude Code reads. */
|
|
109
|
+
claudeToken: "CLAUDE_CODE_OAUTH_TOKEN"
|
|
110
|
+
};
|
|
111
|
+
/** The serialized prefix of every version of the envelope (`kind` is always first). */
|
|
112
|
+
const ENVELOPE_PREFIX = "{\"kind\":\"seekrit.agent-login/";
|
|
113
|
+
/**
|
|
114
|
+
* Whether a decrypted secret value is a managed agent login. Such a value is a
|
|
115
|
+
* *file*, never an environment variable: `seekrit run` keeps it out of the
|
|
116
|
+
* child's environment.
|
|
117
|
+
*/
|
|
118
|
+
function isAgentLoginValue(value) {
|
|
119
|
+
return value.startsWith(ENVELOPE_PREFIX);
|
|
120
|
+
}
|
|
100
121
|
/**
|
|
101
122
|
* Twelve hours, matching `[control] max_ttl` in a proxy config. A task is meant
|
|
102
123
|
* to bound one run; something that needs longer wants a policy change, not a
|
|
@@ -703,6 +724,23 @@ function skipSpace(content, from, end) {
|
|
|
703
724
|
while (i < end && (content[i] === " " || content[i] === " ")) i++;
|
|
704
725
|
return i;
|
|
705
726
|
}
|
|
727
|
+
// ../../packages/core/src/ids.ts
|
|
728
|
+
const ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
729
|
+
/**
|
|
730
|
+
* Generate a prefixed, URL-safe random ID, e.g. `org_h9K2x…`.
|
|
731
|
+
* Uses rejection sampling so every character is uniformly distributed.
|
|
732
|
+
*/
|
|
733
|
+
function randomId(prefix, length = 24) {
|
|
734
|
+
let out = "";
|
|
735
|
+
while (out.length < length) {
|
|
736
|
+
const bytes = crypto.getRandomValues(new Uint8Array(length - out.length));
|
|
737
|
+
for (const byte of bytes) {
|
|
738
|
+
if (byte < 248) out += ALPHABET[byte % 62];
|
|
739
|
+
if (out.length === length) break;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
return `${prefix}_${out}`;
|
|
743
|
+
}
|
|
706
744
|
// ../../packages/core/src/interpolate.ts
|
|
707
745
|
/**
|
|
708
746
|
* Secret references: `${OTHER_SECRET}` inside a secret value.
|
|
@@ -848,6 +886,578 @@ function interpolateSecrets(values) {
|
|
|
848
886
|
unresolved: [...unresolved].sort()
|
|
849
887
|
};
|
|
850
888
|
}
|
|
889
|
+
// ../../packages/core/src/managed-providers/common.ts
|
|
890
|
+
const managedEndpointSchema = z.string().url().max(2048).refine((value) => {
|
|
891
|
+
try {
|
|
892
|
+
const url = new URL(value);
|
|
893
|
+
url.port = "";
|
|
894
|
+
return connectUrlSchema.safeParse(url.toString()).success;
|
|
895
|
+
} catch {
|
|
896
|
+
return false;
|
|
897
|
+
}
|
|
898
|
+
}, "use a public HTTPS endpoint without embedded credentials, query, or fragment");
|
|
899
|
+
const managedTtlSchema = z.number().int().min(60).max(604800).optional();
|
|
900
|
+
const nameSchema$1 = z.string().min(1).max(128).regex(/^[a-zA-Z_][a-zA-Z0-9_-]*$/);
|
|
901
|
+
// ../../packages/core/src/managed-providers/aws-cache.ts
|
|
902
|
+
const cacheRegionSchema = z.string().regex(/^[a-z]{2}(?:-[a-z]+)+-\d$/);
|
|
903
|
+
const cacheGroupSchema = z.string().min(1).max(128).regex(/^[a-zA-Z][a-zA-Z0-9-]*$/);
|
|
904
|
+
const cacheAccessSchema = z.string().min(1).max(4096).refine((value) => /^on(?:\s|$)/.test(value) && !/(?:^|\s)(?:nopass|resetpass|[>#<])/.test(value), "ACL must enable the user and must not contain password directives");
|
|
905
|
+
// ../../packages/core/src/managed-providers/memorydb.ts
|
|
906
|
+
const memorydbTargetConfigSchema = z.object({
|
|
907
|
+
provider: z.literal("memorydb"),
|
|
908
|
+
executor: z.literal("in_do"),
|
|
909
|
+
region: cacheRegionSchema,
|
|
910
|
+
aclName: cacheGroupSchema,
|
|
911
|
+
accessString: cacheAccessSchema,
|
|
912
|
+
maxTtlSeconds: managedTtlSchema
|
|
913
|
+
}).strict();
|
|
914
|
+
// ../../packages/core/src/native-providers/cassandra.ts
|
|
915
|
+
const cassandraSettingsSchema = z.object({
|
|
916
|
+
host: z.string().min(1).max(253).regex(/^[a-zA-Z0-9_.:-]+$/),
|
|
917
|
+
port: z.number().int().min(1).max(65535).default(9042),
|
|
918
|
+
roles: z.array(z.string().min(1).max(128).regex(/^[a-zA-Z_][a-zA-Z0-9_-]*$/)).min(1).max(32).refine((roles) => new Set(roles).size === roles.length, "roles must be unique"),
|
|
919
|
+
caCertificate: z.string().min(1).max(16384).optional()
|
|
920
|
+
}).strict();
|
|
921
|
+
// ../../packages/core/src/native-providers/entra.ts
|
|
922
|
+
const entraSettingsSchema = z.object({
|
|
923
|
+
tenantId: z.string().uuid(),
|
|
924
|
+
domain: z.string().min(1).max(253).regex(/^[a-zA-Z0-9](?:[a-zA-Z0-9.-]*[a-zA-Z0-9])?$/),
|
|
925
|
+
groups: z.array(z.string().uuid()).min(1).max(32).refine((v) => new Set(v).size === v.length, "Groups must be unique.")
|
|
926
|
+
}).strict();
|
|
927
|
+
// ../../packages/core/src/native-providers/ibm-api-connect.ts
|
|
928
|
+
const id$1 = z.string().min(1).max(255).regex(/^[a-zA-Z0-9_-]+$/);
|
|
929
|
+
const ibmApiConnectSettingsSchema = z.object({
|
|
930
|
+
endpoint: z.string().url().refine((value) => {
|
|
931
|
+
const url = new URL(value);
|
|
932
|
+
return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
|
|
933
|
+
}, "Use an HTTPS platform API endpoint without credentials or query parameters."),
|
|
934
|
+
organization: id$1,
|
|
935
|
+
catalog: id$1,
|
|
936
|
+
consumerOrganization: id$1,
|
|
937
|
+
application: id$1,
|
|
938
|
+
caCertificate: z.string().min(1).max(16384).optional()
|
|
939
|
+
}).strict();
|
|
940
|
+
// ../../packages/core/src/native-providers/kafka.ts
|
|
941
|
+
const broker = z.string().max(260).regex(/^[a-zA-Z0-9_.-]+:[0-9]+$/).refine((value) => {
|
|
942
|
+
const port = Number(value.slice(value.lastIndexOf(":") + 1));
|
|
943
|
+
return Number.isInteger(port) && port > 0 && port <= 65535;
|
|
944
|
+
}, "Use host:port with a valid TLS listener port");
|
|
945
|
+
const acl = z.object({
|
|
946
|
+
resourceType: z.enum(["topic", "group"]),
|
|
947
|
+
resourceName: z.string().min(1).max(249).regex(/^[a-zA-Z0-9_.-]+$/).refine((v) => v !== "." && v !== ".."),
|
|
948
|
+
patternType: z.enum(["literal", "prefixed"]).default("literal"),
|
|
949
|
+
operation: z.enum([
|
|
950
|
+
"read",
|
|
951
|
+
"write",
|
|
952
|
+
"describe"
|
|
953
|
+
])
|
|
954
|
+
}).strict().refine((a) => a.resourceType !== "group" || a.operation !== "write", "Consumer groups support read or describe");
|
|
955
|
+
const kafkaSettingsSchema = z.object({
|
|
956
|
+
brokers: z.array(broker).min(1).max(16).refine((items) => new Set(items.map((v) => v.toLowerCase())).size === items.length, "Brokers must be unique"),
|
|
957
|
+
adminMechanism: z.enum([
|
|
958
|
+
"PLAIN",
|
|
959
|
+
"SCRAM-SHA-256",
|
|
960
|
+
"SCRAM-SHA-512"
|
|
961
|
+
]).default("SCRAM-SHA-256"),
|
|
962
|
+
acls: z.array(acl).min(1).max(64),
|
|
963
|
+
caCertificate: z.string().min(1).max(16384).optional()
|
|
964
|
+
}).strict();
|
|
965
|
+
// ../../packages/core/src/native-providers/ldap.ts
|
|
966
|
+
const dn = z.string().min(3).max(2048).refine((v) => v.includes("=") && !/[\0\r\n]/.test(v), "Enter a distinguished name.");
|
|
967
|
+
const ldapSettingsSchema = z.object({
|
|
968
|
+
endpoint: z.string().url().refine((v) => {
|
|
969
|
+
const u = new URL(v);
|
|
970
|
+
return u.protocol === "ldaps:" && !!u.hostname && !u.username && !u.password && !u.search && !u.hash && ["", "/"].includes(u.pathname);
|
|
971
|
+
}, "Use an LDAPS origin without credentials or a search base."),
|
|
972
|
+
usersDn: dn,
|
|
973
|
+
groups: z.array(dn).min(1).max(32).refine((v) => new Set(v).size === v.length, "Groups must be unique."),
|
|
974
|
+
memberAttribute: z.enum(["member", "uniqueMember"]).default("member"),
|
|
975
|
+
caCertificate: z.string().min(1).max(16384).optional()
|
|
976
|
+
}).strict();
|
|
977
|
+
// ../../packages/core/src/native-providers/sap-hana.ts
|
|
978
|
+
const sapHanaSettingsSchema = z.object({
|
|
979
|
+
host: z.string().min(1).max(253).regex(/^[a-zA-Z0-9_.:-]+$/),
|
|
980
|
+
port: z.number().int().min(1).max(65535),
|
|
981
|
+
roles: z.array(z.string().min(1).max(256).regex(/^[a-zA-Z_][a-zA-Z0-9_.:$#-]*$/)).min(1).max(32).refine((roles) => new Set(roles).size === roles.length, "roles must be unique"),
|
|
982
|
+
caCertificate: z.string().min(1).max(16384).optional()
|
|
983
|
+
}).strict();
|
|
984
|
+
// ../../packages/core/src/native-providers/vertica.ts
|
|
985
|
+
const verticaSettingsSchema = z.object({
|
|
986
|
+
host: z.string().min(1).max(253).regex(/^[a-zA-Z0-9_.:-]+$/),
|
|
987
|
+
port: z.number().int().min(1).max(65535).default(5433),
|
|
988
|
+
database: z.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),
|
|
989
|
+
roles: z.array(z.string().min(1).max(128).regex(/^[a-zA-Z_][a-zA-Z0-9_$-]*$/)).min(1).max(32).refine((roles) => new Set(roles).size === roles.length, "roles must be unique"),
|
|
990
|
+
caCertificate: z.string().min(1).max(16384).optional()
|
|
991
|
+
}).strict();
|
|
992
|
+
// ../../packages/core/src/native-leases.ts
|
|
993
|
+
/** Providers executed by the enrolled Rust provisioner. Credentials and settings
|
|
994
|
+
* are sealed together in the browser; these schemas also drive CLI validation. */
|
|
995
|
+
const NATIVE_LEASE_KINDS = [
|
|
996
|
+
"kafka",
|
|
997
|
+
"sap-hana",
|
|
998
|
+
"cassandra",
|
|
999
|
+
"vertica",
|
|
1000
|
+
"kubernetes",
|
|
1001
|
+
"entra",
|
|
1002
|
+
"ldap",
|
|
1003
|
+
"ibm-api-connect"
|
|
1004
|
+
];
|
|
1005
|
+
function isNativeLeaseKind(value) {
|
|
1006
|
+
return NATIVE_LEASE_KINDS.includes(value);
|
|
1007
|
+
}
|
|
1008
|
+
const privateHttpsEndpointSchema = z.string().url().refine((value) => {
|
|
1009
|
+
const url = new URL(value);
|
|
1010
|
+
return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
|
|
1011
|
+
}, "Use HTTPS without credentials, a query, or a fragment.");
|
|
1012
|
+
const caCertificateSchema = z.string().min(1).max(16384).optional();
|
|
1013
|
+
const dnsLabel = z.string().min(1).max(63).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/);
|
|
1014
|
+
const schemas = {
|
|
1015
|
+
kafka: kafkaSettingsSchema,
|
|
1016
|
+
"sap-hana": sapHanaSettingsSchema,
|
|
1017
|
+
cassandra: cassandraSettingsSchema,
|
|
1018
|
+
vertica: verticaSettingsSchema,
|
|
1019
|
+
"ibm-api-connect": ibmApiConnectSettingsSchema,
|
|
1020
|
+
ldap: ldapSettingsSchema,
|
|
1021
|
+
entra: entraSettingsSchema,
|
|
1022
|
+
kubernetes: z.object({
|
|
1023
|
+
endpoint: privateHttpsEndpointSchema,
|
|
1024
|
+
namespace: dnsLabel,
|
|
1025
|
+
serviceAccount: z.string().min(1).max(253).regex(/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/),
|
|
1026
|
+
audiences: z.array(z.string().min(1).max(2048)).min(1).max(16),
|
|
1027
|
+
caCertificate: caCertificateSchema
|
|
1028
|
+
}).strict()
|
|
1029
|
+
};
|
|
1030
|
+
function nativeSettings(provider, settings) {
|
|
1031
|
+
return schemas[provider].parse(settings);
|
|
1032
|
+
}
|
|
1033
|
+
// ../../packages/core/src/managed-providers/elasticache.ts
|
|
1034
|
+
const elasticacheTargetConfigSchema = z.object({
|
|
1035
|
+
provider: z.literal("elasticache"),
|
|
1036
|
+
executor: z.literal("in_do"),
|
|
1037
|
+
region: cacheRegionSchema,
|
|
1038
|
+
userGroupId: cacheGroupSchema,
|
|
1039
|
+
engine: z.enum(["redis", "valkey"]).default("redis"),
|
|
1040
|
+
accessString: cacheAccessSchema,
|
|
1041
|
+
maxTtlSeconds: managedTtlSchema
|
|
1042
|
+
}).strict();
|
|
1043
|
+
// ../../packages/core/src/managed-providers/snowflake.ts
|
|
1044
|
+
const identifier = z.string().regex(/^[a-zA-Z_][a-zA-Z0-9_$]{0,254}$/).transform((value) => value.toUpperCase());
|
|
1045
|
+
const snowflakeTargetConfigSchema = z.object({
|
|
1046
|
+
provider: z.literal("snowflake"),
|
|
1047
|
+
executor: z.literal("in_do"),
|
|
1048
|
+
account: z.string().min(1).max(200).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/i),
|
|
1049
|
+
adminRole: identifier.default("USERADMIN"),
|
|
1050
|
+
roles: z.array(identifier).min(1).max(50),
|
|
1051
|
+
warehouse: identifier.optional(),
|
|
1052
|
+
networkPolicy: identifier.optional(),
|
|
1053
|
+
maxTtlSeconds: managedTtlSchema
|
|
1054
|
+
}).strict();
|
|
1055
|
+
// ../../packages/core/src/managed-providers/couchbase.ts
|
|
1056
|
+
const resourceName = z.string().min(1).max(255);
|
|
1057
|
+
const access = z.object({
|
|
1058
|
+
privileges: z.array(z.enum(["data_reader", "data_writer"])).min(1).max(2),
|
|
1059
|
+
resources: z.object({ buckets: z.array(z.object({
|
|
1060
|
+
name: resourceName,
|
|
1061
|
+
scopes: z.array(z.object({
|
|
1062
|
+
name: resourceName,
|
|
1063
|
+
collections: z.array(resourceName).min(1).max(100).optional()
|
|
1064
|
+
}).strict()).min(1).max(100).optional()
|
|
1065
|
+
}).strict()).min(1).max(100) }).strict()
|
|
1066
|
+
}).strict();
|
|
1067
|
+
const couchbaseTargetConfigSchema = z.object({
|
|
1068
|
+
provider: z.literal("couchbase"),
|
|
1069
|
+
executor: z.literal("in_do"),
|
|
1070
|
+
organizationId: z.string().uuid(),
|
|
1071
|
+
projectId: z.string().uuid(),
|
|
1072
|
+
clusterId: z.string().uuid(),
|
|
1073
|
+
credentialType: z.enum(["basic", "advanced"]).default("basic"),
|
|
1074
|
+
access: z.array(access).min(1).max(100).optional(),
|
|
1075
|
+
userRoles: z.array(resourceName).min(1).max(100).optional(),
|
|
1076
|
+
maxTtlSeconds: managedTtlSchema
|
|
1077
|
+
}).strict().superRefine((value, ctx) => {
|
|
1078
|
+
if (value.credentialType === "basic" ? !value.access || !!value.userRoles : !value.userRoles || !!value.access) ctx.addIssue({
|
|
1079
|
+
code: "custom",
|
|
1080
|
+
message: "basic credentials require access only; advanced credentials require userRoles only"
|
|
1081
|
+
});
|
|
1082
|
+
});
|
|
1083
|
+
// ../../packages/core/src/managed-providers/mongodb-atlas.ts
|
|
1084
|
+
const mongoAtlasTargetConfigSchema = z.object({
|
|
1085
|
+
provider: z.literal("mongodb-atlas"),
|
|
1086
|
+
executor: z.literal("in_do"),
|
|
1087
|
+
projectId: z.string().regex(/^[a-f0-9]{24}$/),
|
|
1088
|
+
roles: z.array(z.object({
|
|
1089
|
+
roleName: z.string().min(1).max(128),
|
|
1090
|
+
databaseName: z.string().min(1).max(64),
|
|
1091
|
+
collectionName: z.string().min(1).max(128).optional()
|
|
1092
|
+
}).strict()).min(1).max(100),
|
|
1093
|
+
clusters: z.array(z.string().min(1).max(64)).min(1).max(100),
|
|
1094
|
+
maxTtlSeconds: managedTtlSchema
|
|
1095
|
+
}).strict();
|
|
1096
|
+
// ../../packages/core/src/managed-providers/milvus.ts
|
|
1097
|
+
const milvusTargetConfigSchema = z.object({
|
|
1098
|
+
provider: z.literal("milvus"),
|
|
1099
|
+
executor: z.literal("in_do"),
|
|
1100
|
+
endpoint: managedEndpointSchema,
|
|
1101
|
+
roles: z.array(z.string().regex(/^[a-zA-Z][a-zA-Z0-9_]{0,127}$/)).min(1).max(50),
|
|
1102
|
+
maxTtlSeconds: managedTtlSchema
|
|
1103
|
+
}).strict();
|
|
1104
|
+
// ../../packages/core/src/managed-providers/rabbitmq.ts
|
|
1105
|
+
const rabbitmqTargetConfigSchema = z.object({
|
|
1106
|
+
provider: z.literal("rabbitmq"),
|
|
1107
|
+
executor: z.literal("in_do"),
|
|
1108
|
+
endpoint: managedEndpointSchema,
|
|
1109
|
+
vhost: z.string().min(1).max(255),
|
|
1110
|
+
configure: z.string().max(2048).default("^$"),
|
|
1111
|
+
write: z.string().max(2048).default("^$"),
|
|
1112
|
+
read: z.string().max(2048).default("^$"),
|
|
1113
|
+
maxTtlSeconds: managedTtlSchema
|
|
1114
|
+
}).strict();
|
|
1115
|
+
// ../../packages/core/src/managed-providers/clickhouse.ts
|
|
1116
|
+
const clickhouseTargetConfigSchema = z.object({
|
|
1117
|
+
provider: z.literal("clickhouse"),
|
|
1118
|
+
executor: z.literal("in_do"),
|
|
1119
|
+
endpoint: managedEndpointSchema,
|
|
1120
|
+
roles: z.array(nameSchema$1).min(1).max(50),
|
|
1121
|
+
database: nameSchema$1.optional(),
|
|
1122
|
+
cluster: nameSchema$1.optional(),
|
|
1123
|
+
maxTtlSeconds: managedTtlSchema
|
|
1124
|
+
}).strict();
|
|
1125
|
+
// ../../packages/core/src/managed-providers/elasticsearch.ts
|
|
1126
|
+
const role = z.object({
|
|
1127
|
+
cluster: z.array(z.string().min(1).max(100)).max(100).default([]),
|
|
1128
|
+
indices: z.array(z.object({
|
|
1129
|
+
names: z.array(z.string().min(1).max(256)).min(1).max(100),
|
|
1130
|
+
privileges: z.array(z.string().min(1).max(100)).min(1).max(100),
|
|
1131
|
+
allow_restricted_indices: z.literal(false).optional()
|
|
1132
|
+
}).strict()).max(100).default([])
|
|
1133
|
+
}).strict();
|
|
1134
|
+
const elasticsearchTargetConfigSchema = z.object({
|
|
1135
|
+
provider: z.literal("elasticsearch"),
|
|
1136
|
+
executor: z.literal("in_do"),
|
|
1137
|
+
endpoint: managedEndpointSchema,
|
|
1138
|
+
credentialType: z.enum(["user", "api_key"]).default("user"),
|
|
1139
|
+
roles: z.array(z.string().min(1).max(128)).min(1).max(100).optional(),
|
|
1140
|
+
roleDescriptors: z.record(z.string().min(1).max(128), role).refine((value) => Object.keys(value).length > 0 && Object.keys(value).length <= 20, "supply explicit key permissions").optional(),
|
|
1141
|
+
maxTtlSeconds: managedTtlSchema
|
|
1142
|
+
}).strict().superRefine((value, ctx) => {
|
|
1143
|
+
if (value.credentialType === "user" && !value.roles?.length) ctx.addIssue({
|
|
1144
|
+
code: "custom",
|
|
1145
|
+
path: ["roles"],
|
|
1146
|
+
message: "select at least one user role"
|
|
1147
|
+
});
|
|
1148
|
+
if (value.credentialType === "api_key" && !value.roleDescriptors) ctx.addIssue({
|
|
1149
|
+
code: "custom",
|
|
1150
|
+
path: ["roleDescriptors"],
|
|
1151
|
+
message: "supply explicit key permissions"
|
|
1152
|
+
});
|
|
1153
|
+
});
|
|
1154
|
+
// ../../packages/core/src/managed-leases.ts
|
|
1155
|
+
/** Providers whose credential is generated by the broker or upstream service. */
|
|
1156
|
+
const MANAGED_LEASE_KINDS = [
|
|
1157
|
+
...NATIVE_LEASE_KINDS,
|
|
1158
|
+
"openrouter",
|
|
1159
|
+
"tailscale",
|
|
1160
|
+
"elasticsearch",
|
|
1161
|
+
"clickhouse",
|
|
1162
|
+
"rabbitmq",
|
|
1163
|
+
"milvus",
|
|
1164
|
+
"mongodb-atlas",
|
|
1165
|
+
"couchbase",
|
|
1166
|
+
"snowflake",
|
|
1167
|
+
"elasticache",
|
|
1168
|
+
"memorydb",
|
|
1169
|
+
"mssql",
|
|
1170
|
+
"azure-sql"
|
|
1171
|
+
];
|
|
1172
|
+
const openRouterTargetConfigSchema = z.object({
|
|
1173
|
+
provider: z.literal("openrouter"),
|
|
1174
|
+
executor: z.literal("in_do"),
|
|
1175
|
+
workspaceId: z.string().uuid().optional(),
|
|
1176
|
+
creditLimit: z.number().finite().nonnegative(),
|
|
1177
|
+
limitReset: z.enum([
|
|
1178
|
+
"daily",
|
|
1179
|
+
"weekly",
|
|
1180
|
+
"monthly"
|
|
1181
|
+
]).optional(),
|
|
1182
|
+
includeByokInLimit: z.boolean().optional(),
|
|
1183
|
+
maxTtlSeconds: z.number().int().min(60).max(604800).optional()
|
|
1184
|
+
}).strict();
|
|
1185
|
+
const tailscaleTargetConfigSchema = z.object({
|
|
1186
|
+
provider: z.literal("tailscale"),
|
|
1187
|
+
executor: z.literal("in_do"),
|
|
1188
|
+
tailnet: z.string().min(1).max(253).regex(/^[a-zA-Z0-9@._-]+$/),
|
|
1189
|
+
credentialType: z.enum([
|
|
1190
|
+
"auth",
|
|
1191
|
+
"client",
|
|
1192
|
+
"federated"
|
|
1193
|
+
]),
|
|
1194
|
+
tags: z.array(z.string().regex(/^tag:[a-zA-Z0-9_-]+$/)).max(100).default([]),
|
|
1195
|
+
reusable: z.boolean().default(false),
|
|
1196
|
+
ephemeral: z.boolean().default(true),
|
|
1197
|
+
preauthorized: z.boolean().default(false),
|
|
1198
|
+
scopes: z.array(z.string().min(1).max(128)).max(100).default([]),
|
|
1199
|
+
issuer: z.string().url().optional(),
|
|
1200
|
+
audience: z.string().min(1).max(2048).optional(),
|
|
1201
|
+
subject: z.string().min(1).max(2048).optional(),
|
|
1202
|
+
maxTtlSeconds: z.number().int().min(60).max(604800).optional()
|
|
1203
|
+
}).strict().superRefine((value, ctx) => {
|
|
1204
|
+
if (value.credentialType !== "auth" && !value.scopes.length) ctx.addIssue({
|
|
1205
|
+
code: "custom",
|
|
1206
|
+
path: ["scopes"],
|
|
1207
|
+
message: "select at least one scope"
|
|
1208
|
+
});
|
|
1209
|
+
if (value.credentialType === "federated" && (!value.issuer?.startsWith("https://") || !value.audience || !value.subject)) ctx.addIssue({
|
|
1210
|
+
code: "custom",
|
|
1211
|
+
path: ["issuer"],
|
|
1212
|
+
message: "federation requires HTTPS issuer, audience, and subject"
|
|
1213
|
+
});
|
|
1214
|
+
});
|
|
1215
|
+
const hostedManagedTargetConfigSchema = z.discriminatedUnion("provider", [
|
|
1216
|
+
clickhouseTargetConfigSchema,
|
|
1217
|
+
rabbitmqTargetConfigSchema,
|
|
1218
|
+
milvusTargetConfigSchema,
|
|
1219
|
+
mongoAtlasTargetConfigSchema,
|
|
1220
|
+
couchbaseTargetConfigSchema,
|
|
1221
|
+
snowflakeTargetConfigSchema,
|
|
1222
|
+
elasticacheTargetConfigSchema,
|
|
1223
|
+
memorydbTargetConfigSchema,
|
|
1224
|
+
openRouterTargetConfigSchema,
|
|
1225
|
+
tailscaleTargetConfigSchema,
|
|
1226
|
+
elasticsearchTargetConfigSchema
|
|
1227
|
+
]);
|
|
1228
|
+
function hasLocalServiceEndpoint(provider) {
|
|
1229
|
+
return [
|
|
1230
|
+
"milvus",
|
|
1231
|
+
"rabbitmq",
|
|
1232
|
+
"clickhouse",
|
|
1233
|
+
"elasticsearch"
|
|
1234
|
+
].includes(provider);
|
|
1235
|
+
}
|
|
1236
|
+
/** Reuse the provider's existing permission validation without accepting a
|
|
1237
|
+
* remotely supplied destination for a locally held administrator credential. */
|
|
1238
|
+
function customerSettingsAsHosted(provider, settings) {
|
|
1239
|
+
const endpoint = typeof settings.endpoint === "string" ? settings.endpoint : void 0;
|
|
1240
|
+
if (hasLocalServiceEndpoint(provider) && endpoint !== void 0) {
|
|
1241
|
+
const url = new URL(z.string().parse(endpoint));
|
|
1242
|
+
if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash) throw new Error("Use an HTTPS service endpoint without credentials.");
|
|
1243
|
+
}
|
|
1244
|
+
const normalized = hostedManagedTargetConfigSchema.parse({
|
|
1245
|
+
...settings,
|
|
1246
|
+
provider,
|
|
1247
|
+
executor: "in_do",
|
|
1248
|
+
...hasLocalServiceEndpoint(provider) ? { endpoint: "https://customer-service.example.com" } : {}
|
|
1249
|
+
});
|
|
1250
|
+
return endpoint === void 0 ? normalized : {
|
|
1251
|
+
...normalized,
|
|
1252
|
+
endpoint
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
const mssqlSettingsSchema = z.object({ roles: z.array(z.string().min(1).max(128).refine((role) => !role.includes("\0"))).min(1).max(100).refine((roles) => new Set(roles).size === roles.length, "roles must be unique") }).strict();
|
|
1256
|
+
function normalizeCustomerSettings(provider, settings) {
|
|
1257
|
+
return provider === "mssql" || provider === "azure-sql" ? mssqlSettingsSchema.parse(settings) : isNativeLeaseKind(provider) ? nativeSettings(provider, settings) : customerSettingsAsHosted(provider, settings);
|
|
1258
|
+
}
|
|
1259
|
+
/** Permissions remain configured in Seekrit; destination and admin secret stay local. */
|
|
1260
|
+
const remoteManagedTargetConfigSchema = z.object({
|
|
1261
|
+
provider: z.enum(MANAGED_LEASE_KINDS),
|
|
1262
|
+
executor: z.literal("remote"),
|
|
1263
|
+
provisionerId: z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/).optional(),
|
|
1264
|
+
transport: z.enum(["push", "pull"]).default("push"),
|
|
1265
|
+
provisionerUrl: managedEndpointSchema.optional(),
|
|
1266
|
+
settings: z.record(z.string(), z.unknown()),
|
|
1267
|
+
maxTtlSeconds: managedTtlSchema
|
|
1268
|
+
}).strict().superRefine((config, ctx) => {
|
|
1269
|
+
if (config.provider === "azure-sql" && !config.provisionerId) ctx.addIssue({
|
|
1270
|
+
code: "custom",
|
|
1271
|
+
path: ["provisionerId"],
|
|
1272
|
+
message: "Register a provisioner for Azure SQL execution."
|
|
1273
|
+
});
|
|
1274
|
+
if (!config.provisionerId && config.transport === "push" && !config.provisionerUrl) ctx.addIssue({
|
|
1275
|
+
code: "custom",
|
|
1276
|
+
path: ["provisionerUrl"],
|
|
1277
|
+
message: "HTTPS mode requires a provisioner URL"
|
|
1278
|
+
});
|
|
1279
|
+
if (config.transport === "pull" && config.provisionerUrl) ctx.addIssue({
|
|
1280
|
+
code: "custom",
|
|
1281
|
+
path: ["provisionerUrl"],
|
|
1282
|
+
message: "outbound mode does not use a provisioner URL"
|
|
1283
|
+
});
|
|
1284
|
+
if ([
|
|
1285
|
+
"provider",
|
|
1286
|
+
"executor",
|
|
1287
|
+
"maxTtlSeconds"
|
|
1288
|
+
].some((key) => key in config.settings)) {
|
|
1289
|
+
ctx.addIssue({
|
|
1290
|
+
code: "custom",
|
|
1291
|
+
path: ["settings"],
|
|
1292
|
+
message: "settings contain a reserved field"
|
|
1293
|
+
});
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
if (config.provider === "kubernetes" && config.maxTtlSeconds !== void 0 && config.maxTtlSeconds < 900) ctx.addIssue({
|
|
1297
|
+
code: "custom",
|
|
1298
|
+
path: ["maxTtlSeconds"],
|
|
1299
|
+
message: "Kubernetes requires at least 15 minutes."
|
|
1300
|
+
});
|
|
1301
|
+
try {
|
|
1302
|
+
if (!config.provisionerId && config.settings.endpoint !== void 0) throw new Error("Register a provisioner to configure its endpoint in Seekrit.");
|
|
1303
|
+
if (config.provisionerId && hasLocalServiceEndpoint(config.provider) && !config.settings.endpoint) throw new Error("Configure the service endpoint in Seekrit.");
|
|
1304
|
+
if (isNativeLeaseKind(config.provider) && !config.provisionerId) throw new Error("Select a registered customer provisioner.");
|
|
1305
|
+
normalizeCustomerSettings(config.provider, config.settings);
|
|
1306
|
+
} catch (error) {
|
|
1307
|
+
if (error instanceof z.ZodError) for (const issue of error.issues) ctx.addIssue({
|
|
1308
|
+
code: "custom",
|
|
1309
|
+
path: ["settings", ...issue.path],
|
|
1310
|
+
message: issue.message
|
|
1311
|
+
});
|
|
1312
|
+
else ctx.addIssue({
|
|
1313
|
+
code: "custom",
|
|
1314
|
+
path: ["settings"],
|
|
1315
|
+
message: "invalid service settings"
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
}).transform((config) => {
|
|
1319
|
+
const normalized = normalizeCustomerSettings(config.provider, config.settings);
|
|
1320
|
+
return {
|
|
1321
|
+
...config,
|
|
1322
|
+
settings: Object.fromEntries(Object.entries(normalized).filter(([key]) => ![
|
|
1323
|
+
"provider",
|
|
1324
|
+
"executor",
|
|
1325
|
+
"maxTtlSeconds"
|
|
1326
|
+
].includes(key) && (key !== "endpoint" || config.settings.endpoint !== void 0)))
|
|
1327
|
+
};
|
|
1328
|
+
});
|
|
1329
|
+
const managedTargetConfigSchema = z.union([hostedManagedTargetConfigSchema, remoteManagedTargetConfigSchema]);
|
|
1330
|
+
const id = z.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/);
|
|
1331
|
+
const timestamp = z.number().int().nonnegative().safe();
|
|
1332
|
+
const provisionerPrincipalSchema = z.object({
|
|
1333
|
+
type: z.enum(["user", "service_token"]),
|
|
1334
|
+
id,
|
|
1335
|
+
publicKeyJwk: z.string().min(1).max(1024)
|
|
1336
|
+
}).strict();
|
|
1337
|
+
const provisionerBootstrapSchema = z.object({
|
|
1338
|
+
version: z.literal(1),
|
|
1339
|
+
orgId: id,
|
|
1340
|
+
provisionerId: id,
|
|
1341
|
+
authority: provisionerPrincipalSchema,
|
|
1342
|
+
createdAt: timestamp
|
|
1343
|
+
}).strict();
|
|
1344
|
+
const provisionerGrantSchema = z.object({
|
|
1345
|
+
version: z.literal(1),
|
|
1346
|
+
id,
|
|
1347
|
+
orgId: id,
|
|
1348
|
+
provisionerId: id,
|
|
1349
|
+
principal: provisionerPrincipalSchema,
|
|
1350
|
+
targets: z.array(id.or(z.literal("*"))).min(1).max(100),
|
|
1351
|
+
manage: z.boolean(),
|
|
1352
|
+
issuedAt: timestamp,
|
|
1353
|
+
expiresAt: timestamp
|
|
1354
|
+
}).strict();
|
|
1355
|
+
const provisionerChainSchema = z.object({
|
|
1356
|
+
bootstrap: z.string().max(4096).startsWith("pb1."),
|
|
1357
|
+
grants: z.array(z.string().max(4096).startsWith("pg1.")).max(3)
|
|
1358
|
+
}).strict();
|
|
1359
|
+
z.object({
|
|
1360
|
+
version: z.literal(1),
|
|
1361
|
+
orgId: id,
|
|
1362
|
+
provisionerId: id,
|
|
1363
|
+
targetId: id,
|
|
1364
|
+
provider: id,
|
|
1365
|
+
leaseId: id,
|
|
1366
|
+
instanceId: id,
|
|
1367
|
+
nonce: id,
|
|
1368
|
+
targetDigest: z.string().regex(/^[A-Za-z0-9_-]{43}$/),
|
|
1369
|
+
action: z.unknown(),
|
|
1370
|
+
recipientPublicKey: z.string().max(1024).optional(),
|
|
1371
|
+
issuedAt: timestamp,
|
|
1372
|
+
expiresAt: timestamp
|
|
1373
|
+
}).strict();
|
|
1374
|
+
const provisionerAuthorizationSchema = provisionerChainSchema.extend({ proof: z.string().max(16384).startsWith("pr1.") });
|
|
1375
|
+
const utf8 = new TextEncoder();
|
|
1376
|
+
function b64(bytes) {
|
|
1377
|
+
return btoa(String.fromCharCode(...bytes)).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
1378
|
+
}
|
|
1379
|
+
function unb64(value) {
|
|
1380
|
+
if (!/^[A-Za-z0-9_-]+$/.test(value)) throw new Error("Invalid authorization encoding");
|
|
1381
|
+
return Uint8Array.from(atob(value.replaceAll("-", "+").replaceAll("_", "/")), (c) => c.charCodeAt(0));
|
|
1382
|
+
}
|
|
1383
|
+
function readProvisionerEnvelope(envelope, prefix) {
|
|
1384
|
+
const parts = envelope.split(".");
|
|
1385
|
+
if (envelope.length > 16384 || parts.length !== 3 || parts[0] !== prefix) throw new Error("Invalid customer authorization envelope");
|
|
1386
|
+
return JSON.parse(new TextDecoder("utf-8", {
|
|
1387
|
+
fatal: true,
|
|
1388
|
+
ignoreBOM: false
|
|
1389
|
+
}).decode(unb64(parts[1] ?? "")));
|
|
1390
|
+
}
|
|
1391
|
+
function provisionerPublicKey(value) {
|
|
1392
|
+
const jwk = JSON.parse(value);
|
|
1393
|
+
if (jwk.kty !== "EC" || jwk.crv !== "P-256" || !jwk.x || !jwk.y || jwk.d) throw new Error("Customer authorization requires a public P-256 key");
|
|
1394
|
+
return {
|
|
1395
|
+
kty: "EC",
|
|
1396
|
+
crv: "P-256",
|
|
1397
|
+
x: jwk.x,
|
|
1398
|
+
y: jwk.y
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
async function signProvisionerEnvelope(prefix, key, payload) {
|
|
1402
|
+
const encoded = b64(utf8.encode(JSON.stringify(payload)));
|
|
1403
|
+
const signature = await crypto.subtle.sign({
|
|
1404
|
+
name: "ECDSA",
|
|
1405
|
+
hash: "SHA-256"
|
|
1406
|
+
}, key, utf8.encode(`${prefix}\n${encoded}`));
|
|
1407
|
+
return `${prefix}.${encoded}.${b64(new Uint8Array(signature))}`;
|
|
1408
|
+
}
|
|
1409
|
+
async function verifyProvisionerEnvelope(envelope, prefix, publicKeyJwk) {
|
|
1410
|
+
const payload = readProvisionerEnvelope(envelope, prefix);
|
|
1411
|
+
const [, encoded, signature] = envelope.split(".");
|
|
1412
|
+
const key = await crypto.subtle.importKey("jwk", provisionerPublicKey(publicKeyJwk), {
|
|
1413
|
+
name: "ECDSA",
|
|
1414
|
+
namedCurve: "P-256"
|
|
1415
|
+
}, false, ["verify"]);
|
|
1416
|
+
if (!await crypto.subtle.verify({
|
|
1417
|
+
name: "ECDSA",
|
|
1418
|
+
hash: "SHA-256"
|
|
1419
|
+
}, key, unb64(signature ?? ""), utf8.encode(`${prefix}\n${encoded}`))) throw new Error("Invalid customer authorization signature");
|
|
1420
|
+
return payload;
|
|
1421
|
+
}
|
|
1422
|
+
/** The API compares bootstrap to its registration; the Rust service additionally
|
|
1423
|
+
* verifies its MAC with a root-derived key unavailable to the API. */
|
|
1424
|
+
async function verifyProvisionerChain(chain, orgId, provisionerId, now = Date.now()) {
|
|
1425
|
+
provisionerChainSchema.parse(chain);
|
|
1426
|
+
const root = provisionerBootstrapSchema.parse(readProvisionerEnvelope(chain.bootstrap, "pb1"));
|
|
1427
|
+
if (root.orgId !== orgId || root.provisionerId !== provisionerId || root.authority.type !== "user") throw new Error("Customer authorization belongs to another provisioner");
|
|
1428
|
+
provisionerPublicKey(root.authority.publicKeyJwk);
|
|
1429
|
+
let access = {
|
|
1430
|
+
principal: root.authority,
|
|
1431
|
+
targets: ["*"],
|
|
1432
|
+
manage: true,
|
|
1433
|
+
expiresAt: Number.MAX_SAFE_INTEGER,
|
|
1434
|
+
chain
|
|
1435
|
+
};
|
|
1436
|
+
for (const envelope of chain.grants) {
|
|
1437
|
+
if (!access.manage) throw new Error("This permission cannot delegate access");
|
|
1438
|
+
const grant = provisionerGrantSchema.parse(await verifyProvisionerEnvelope(envelope, "pg1", access.principal.publicKeyJwk));
|
|
1439
|
+
if (grant.orgId !== orgId || grant.provisionerId !== provisionerId || grant.issuedAt > now + 3e5 || grant.expiresAt <= now || grant.expiresAt <= grant.issuedAt || grant.expiresAt - grant.issuedAt > 7776e6 || grant.expiresAt > access.expiresAt || !grant.targets.every((t) => access.targets.includes("*") || access.targets.includes(t)) || grant.manage && grant.principal.type !== "user") throw new Error("Expired or invalid customer access grant");
|
|
1440
|
+
provisionerPublicKey(grant.principal.publicKeyJwk);
|
|
1441
|
+
access = {
|
|
1442
|
+
principal: grant.principal,
|
|
1443
|
+
targets: grant.targets,
|
|
1444
|
+
manage: grant.manage,
|
|
1445
|
+
expiresAt: grant.expiresAt,
|
|
1446
|
+
chain
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
return access;
|
|
1450
|
+
}
|
|
1451
|
+
/** Targets carry their templates inside encrypted configuration. */
|
|
1452
|
+
function provisionerTransportAction(action) {
|
|
1453
|
+
if (action.kind === "sql") return {
|
|
1454
|
+
kind: "sql",
|
|
1455
|
+
statements: [],
|
|
1456
|
+
parameters: action.parameters
|
|
1457
|
+
};
|
|
1458
|
+
if (action.kind === "ssh-sign") return action;
|
|
1459
|
+
return { kind: "noop" };
|
|
1460
|
+
}
|
|
851
1461
|
z.enum([
|
|
852
1462
|
"postgres",
|
|
853
1463
|
"mysql",
|
|
@@ -855,7 +1465,8 @@ z.enum([
|
|
|
855
1465
|
"redis",
|
|
856
1466
|
"aws",
|
|
857
1467
|
"gcp",
|
|
858
|
-
"mongodb"
|
|
1468
|
+
"mongodb",
|
|
1469
|
+
...MANAGED_LEASE_KINDS
|
|
859
1470
|
]);
|
|
860
1471
|
const executorModeSchema = z.enum(["in_do", "remote"]);
|
|
861
1472
|
/**
|
|
@@ -924,7 +1535,12 @@ const awsRegionSchema$1 = z.string().regex(/^[a-z]{2}(?:-[a-z]+)+-\d$/, "must be
|
|
|
924
1535
|
* documented safe set and bound the length.
|
|
925
1536
|
*/
|
|
926
1537
|
const awsExternalIdSchema = z.string().regex(/^[\w+=,.@:/-]{2,1224}$/, "must be a valid STS external id");
|
|
927
|
-
|
|
1538
|
+
/**
|
|
1539
|
+
* An STS session name stamped onto the assumed-role credential (and surfaced in
|
|
1540
|
+
* CloudTrail). We derive it from the lease id, so this is a sanity gate matching
|
|
1541
|
+
* the AWS-documented pattern.
|
|
1542
|
+
*/
|
|
1543
|
+
const awsRoleSessionNameSchema = z.string().regex(/^[\w+=,.@-]{2,64}$/, "must be 2–64 chars of [A-Za-z0-9_+=,.@-]");
|
|
928
1544
|
/**
|
|
929
1545
|
* A GCP service-account email the broker is allowed to impersonate (or that
|
|
930
1546
|
* appears in a delegation chain). Structurally validated and bounded: it is
|
|
@@ -955,7 +1571,14 @@ const p256PublicKeyJwkSchema = z.string().max(2048).refine((s) => {
|
|
|
955
1571
|
return false;
|
|
956
1572
|
}
|
|
957
1573
|
}, "must be a JWK-serialized P-256 public key");
|
|
958
|
-
|
|
1574
|
+
/**
|
|
1575
|
+
* A MongoDB user name. Derived from the lease id (so it's server-chosen, not
|
|
1576
|
+
* user input), but validated as a strict token anyway: MongoDB user documents
|
|
1577
|
+
* are structured BSON — there is no string interpolation to inject into — yet a
|
|
1578
|
+
* bounded `[A-Za-z0-9_.-]` name keeps the created principal readable in
|
|
1579
|
+
* `db.getUsers()` and free of the `.`/`$` characters Mongo reserves.
|
|
1580
|
+
*/
|
|
1581
|
+
const mongoUserNameSchema = z.string().regex(/^[A-Za-z0-9_-]{1,64}$/, "must be 1–64 chars of [A-Za-z0-9_-]");
|
|
959
1582
|
/**
|
|
960
1583
|
* A MongoDB database name — the db a preset role is granted on, or the
|
|
961
1584
|
* authentication database a leased user is created in. MongoDB forbids
|
|
@@ -976,6 +1599,11 @@ const postgresAccessLevelSchema = z.enum([
|
|
|
976
1599
|
"readwrite",
|
|
977
1600
|
"custom"
|
|
978
1601
|
]);
|
|
1602
|
+
/** The group role each preset's leased credentials inherit. */
|
|
1603
|
+
const POSTGRES_GROUP_ROLES = {
|
|
1604
|
+
readonly: "seekrit_readonly",
|
|
1605
|
+
readwrite: "seekrit_readwrite"
|
|
1606
|
+
};
|
|
979
1607
|
const mysqlAccessLevelSchema = z.enum([
|
|
980
1608
|
"readonly",
|
|
981
1609
|
"readwrite",
|
|
@@ -991,6 +1619,11 @@ const mongoAccessLevelSchema = z.enum([
|
|
|
991
1619
|
"readwrite",
|
|
992
1620
|
"custom"
|
|
993
1621
|
]);
|
|
1622
|
+
/** The built-in MongoDB role each preset grants on the target database. */
|
|
1623
|
+
const MONGO_PRESET_ROLES = {
|
|
1624
|
+
readonly: "read",
|
|
1625
|
+
readwrite: "readWrite"
|
|
1626
|
+
};
|
|
994
1627
|
const connectionSchema = z.object({
|
|
995
1628
|
host: z.string().min(1),
|
|
996
1629
|
port: z.number().int().min(1).max(65535),
|
|
@@ -1001,6 +1634,8 @@ const statementSchema$1 = z.string().min(1).max(4e3);
|
|
|
1001
1634
|
/** A bare SQL identifier (schema name) — no quotes/whitespace/semicolons. */
|
|
1002
1635
|
const identifierSchema = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,62}$/, "must be an identifier");
|
|
1003
1636
|
const postgresTargetConfigSchema = z.object({
|
|
1637
|
+
tls: z.boolean().optional(),
|
|
1638
|
+
provisionerId: z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/).optional(),
|
|
1004
1639
|
provider: z.literal("postgres"),
|
|
1005
1640
|
executor: executorModeSchema,
|
|
1006
1641
|
accessLevel: postgresAccessLevelSchema.optional(),
|
|
@@ -1013,6 +1648,8 @@ const postgresTargetConfigSchema = z.object({
|
|
|
1013
1648
|
/** A MySQL account host part (`'name'@'<host>'`) — no quotes/whitespace. */
|
|
1014
1649
|
const mysqlHostSchema$1 = z.string().regex(/^[A-Za-z0-9_.%:-]{1,255}$/, "must be a host pattern");
|
|
1015
1650
|
const mysqlTargetConfigSchema = z.object({
|
|
1651
|
+
tls: z.boolean().optional(),
|
|
1652
|
+
provisionerId: z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/).optional(),
|
|
1016
1653
|
provider: z.literal("mysql"),
|
|
1017
1654
|
executor: executorModeSchema,
|
|
1018
1655
|
accessLevel: mysqlAccessLevelSchema.optional(),
|
|
@@ -1029,6 +1666,7 @@ const redisConnectionSchema = z.object({
|
|
|
1029
1666
|
db: z.number().int().min(0).max(15).optional()
|
|
1030
1667
|
});
|
|
1031
1668
|
const redisTargetConfigSchema = z.object({
|
|
1669
|
+
provisionerId: z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/).optional(),
|
|
1032
1670
|
provider: z.literal("redis"),
|
|
1033
1671
|
executor: executorModeSchema,
|
|
1034
1672
|
accessLevel: redisAccessLevelSchema.optional(),
|
|
@@ -1038,8 +1676,9 @@ const redisTargetConfigSchema = z.object({
|
|
|
1038
1676
|
revokeStatements: z.array(statementSchema$1).max(16).optional()
|
|
1039
1677
|
});
|
|
1040
1678
|
const sshTargetConfigSchema = z.object({
|
|
1679
|
+
provisionerId: z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/).optional(),
|
|
1041
1680
|
provider: z.literal("ssh"),
|
|
1042
|
-
executor:
|
|
1681
|
+
executor: executorModeSchema,
|
|
1043
1682
|
caPublicKey: sshPublicKeySchema,
|
|
1044
1683
|
allowedPrincipals: z.array(sshPrincipalSchema).max(64).optional(),
|
|
1045
1684
|
extensions: z.array(sshExtensionSchema).max(16).optional(),
|
|
@@ -1051,8 +1690,9 @@ const sshTargetConfigSchema = z.object({
|
|
|
1051
1690
|
});
|
|
1052
1691
|
const AWS_MAX_TTL_SECONDS = 43200;
|
|
1053
1692
|
const awsTargetConfigSchema = z.object({
|
|
1693
|
+
provisionerId: z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/).optional(),
|
|
1054
1694
|
provider: z.literal("aws"),
|
|
1055
|
-
executor:
|
|
1695
|
+
executor: executorModeSchema,
|
|
1056
1696
|
roleArn: awsRoleArnSchema,
|
|
1057
1697
|
region: awsRegionSchema$1,
|
|
1058
1698
|
externalId: awsExternalIdSchema.optional(),
|
|
@@ -1061,16 +1701,18 @@ const awsTargetConfigSchema = z.object({
|
|
|
1061
1701
|
});
|
|
1062
1702
|
const GCP_MAX_TTL_SECONDS = 43200;
|
|
1063
1703
|
const gcpTargetConfigSchema = z.object({
|
|
1704
|
+
provisionerId: z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/).optional(),
|
|
1064
1705
|
provider: z.literal("gcp"),
|
|
1065
|
-
executor:
|
|
1706
|
+
executor: executorModeSchema,
|
|
1066
1707
|
serviceAccount: gcpServiceAccountEmailSchema,
|
|
1067
1708
|
scopes: z.array(gcpOauthScopeSchema).min(1).max(32).optional(),
|
|
1068
1709
|
delegates: z.array(gcpServiceAccountEmailSchema).max(8).optional(),
|
|
1069
1710
|
maxTtlSeconds: z.number().int().min(60).max(GCP_MAX_TTL_SECONDS).optional()
|
|
1070
1711
|
});
|
|
1071
1712
|
const mongoTargetConfigSchema = z.object({
|
|
1713
|
+
provisionerId: z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/).optional(),
|
|
1072
1714
|
provider: z.literal("mongodb"),
|
|
1073
|
-
executor:
|
|
1715
|
+
executor: executorModeSchema,
|
|
1074
1716
|
accessLevel: mongoAccessLevelSchema.optional(),
|
|
1075
1717
|
connection: connectionSchema,
|
|
1076
1718
|
authSource: mongoDatabaseNameSchema.optional(),
|
|
@@ -1078,16 +1720,34 @@ const mongoTargetConfigSchema = z.object({
|
|
|
1078
1720
|
tls: z.boolean().optional(),
|
|
1079
1721
|
maxTtlSeconds: z.number().int().min(60).max(604800).optional()
|
|
1080
1722
|
});
|
|
1081
|
-
const leaseTargetConfigSchema = z.
|
|
1723
|
+
const leaseTargetConfigSchema = z.union([
|
|
1082
1724
|
postgresTargetConfigSchema,
|
|
1083
1725
|
mysqlTargetConfigSchema,
|
|
1084
1726
|
redisTargetConfigSchema,
|
|
1085
1727
|
sshTargetConfigSchema,
|
|
1086
1728
|
awsTargetConfigSchema,
|
|
1087
1729
|
gcpTargetConfigSchema,
|
|
1088
|
-
mongoTargetConfigSchema
|
|
1089
|
-
|
|
1730
|
+
mongoTargetConfigSchema,
|
|
1731
|
+
managedTargetConfigSchema
|
|
1732
|
+
]).superRefine((config, ctx) => {
|
|
1733
|
+
if (config.executor === "remote" && [
|
|
1734
|
+
"ssh",
|
|
1735
|
+
"aws",
|
|
1736
|
+
"gcp",
|
|
1737
|
+
"mongodb"
|
|
1738
|
+
].includes(config.provider) && !("provisionerId" in config && config.provisionerId)) ctx.addIssue({
|
|
1739
|
+
code: "custom",
|
|
1740
|
+
path: ["provisionerId"],
|
|
1741
|
+
message: "Select a registered customer provisioner."
|
|
1742
|
+
});
|
|
1743
|
+
if ("provisionerId" in config && config.provisionerId && config.executor !== "remote") ctx.addIssue({
|
|
1744
|
+
code: "custom",
|
|
1745
|
+
path: ["executor"],
|
|
1746
|
+
message: "A provisioner target must run in your network."
|
|
1747
|
+
});
|
|
1748
|
+
});
|
|
1090
1749
|
z.object({
|
|
1750
|
+
id: z.string().regex(/^lt_[A-Za-z0-9_-]{24}$/).optional(),
|
|
1091
1751
|
name: z.string().trim().min(1).max(128),
|
|
1092
1752
|
config: leaseTargetConfigSchema,
|
|
1093
1753
|
/**
|
|
@@ -1096,7 +1756,7 @@ z.object({
|
|
|
1096
1756
|
* control plane stores only this ciphertext — it never sees the plaintext.
|
|
1097
1757
|
*/
|
|
1098
1758
|
wrappedAdminSecret: z.string().min(1)
|
|
1099
|
-
});
|
|
1759
|
+
}).refine((v) => !("provisionerId" in v.config && v.config.provisionerId) || v.wrappedAdminSecret.startsWith("wd1.") && v.wrappedAdminSecret.length <= 49152, "Encrypted provisioner configuration must be a wd1 blob no larger than 48 KiB");
|
|
1100
1760
|
/** Requested lease lifetime, shared by all providers. */
|
|
1101
1761
|
const ttlSecondsSchema = z.number().int().min(60).max(604800);
|
|
1102
1762
|
/**
|
|
@@ -1107,6 +1767,7 @@ const ttlSecondsSchema = z.number().int().min(60).max(604800);
|
|
|
1107
1767
|
const mintPostgresLeaseSchema = z.object({
|
|
1108
1768
|
provider: z.literal("postgres"),
|
|
1109
1769
|
targetId: z.string().min(1),
|
|
1770
|
+
authorization: provisionerAuthorizationSchema.optional(),
|
|
1110
1771
|
roleName: postgresRoleNameSchema,
|
|
1111
1772
|
verifier: scramVerifierSchema,
|
|
1112
1773
|
ttlSeconds: ttlSecondsSchema
|
|
@@ -1119,6 +1780,7 @@ const mintPostgresLeaseSchema = z.object({
|
|
|
1119
1780
|
const mintMysqlLeaseSchema = z.object({
|
|
1120
1781
|
provider: z.literal("mysql"),
|
|
1121
1782
|
targetId: z.string().min(1),
|
|
1783
|
+
authorization: provisionerAuthorizationSchema.optional(),
|
|
1122
1784
|
roleName: mysqlUserNameSchema,
|
|
1123
1785
|
verifier: mysqlNativeVerifierSchema,
|
|
1124
1786
|
ttlSeconds: ttlSecondsSchema
|
|
@@ -1131,6 +1793,7 @@ const mintMysqlLeaseSchema = z.object({
|
|
|
1131
1793
|
const mintRedisLeaseSchema = z.object({
|
|
1132
1794
|
provider: z.literal("redis"),
|
|
1133
1795
|
targetId: z.string().min(1),
|
|
1796
|
+
authorization: provisionerAuthorizationSchema.optional(),
|
|
1134
1797
|
roleName: redisUserNameSchema,
|
|
1135
1798
|
verifier: redisSha256VerifierSchema,
|
|
1136
1799
|
ttlSeconds: ttlSecondsSchema
|
|
@@ -1143,6 +1806,7 @@ const mintRedisLeaseSchema = z.object({
|
|
|
1143
1806
|
const mintSshLeaseSchema = z.object({
|
|
1144
1807
|
provider: z.literal("ssh"),
|
|
1145
1808
|
targetId: z.string().min(1),
|
|
1809
|
+
authorization: provisionerAuthorizationSchema.optional(),
|
|
1146
1810
|
publicKey: sshPublicKeySchema,
|
|
1147
1811
|
principals: z.array(sshPrincipalSchema).min(1).max(32),
|
|
1148
1812
|
ttlSeconds: ttlSecondsSchema
|
|
@@ -1159,6 +1823,7 @@ const mintSshLeaseSchema = z.object({
|
|
|
1159
1823
|
const mintAwsLeaseSchema = z.object({
|
|
1160
1824
|
provider: z.literal("aws"),
|
|
1161
1825
|
targetId: z.string().min(1),
|
|
1826
|
+
authorization: provisionerAuthorizationSchema.optional(),
|
|
1162
1827
|
recipientPublicKey: p256PublicKeyJwkSchema,
|
|
1163
1828
|
ttlSeconds: z.number().int().min(900).max(AWS_MAX_TTL_SECONDS)
|
|
1164
1829
|
});
|
|
@@ -1175,6 +1840,7 @@ const mintAwsLeaseSchema = z.object({
|
|
|
1175
1840
|
const mintGcpLeaseSchema = z.object({
|
|
1176
1841
|
provider: z.literal("gcp"),
|
|
1177
1842
|
targetId: z.string().min(1),
|
|
1843
|
+
authorization: provisionerAuthorizationSchema.optional(),
|
|
1178
1844
|
recipientPublicKey: p256PublicKeyJwkSchema,
|
|
1179
1845
|
ttlSeconds: z.number().int().min(60).max(GCP_MAX_TTL_SECONDS)
|
|
1180
1846
|
});
|
|
@@ -1188,9 +1854,23 @@ const mintGcpLeaseSchema = z.object({
|
|
|
1188
1854
|
const mintMongoLeaseSchema = z.object({
|
|
1189
1855
|
provider: z.literal("mongodb"),
|
|
1190
1856
|
targetId: z.string().min(1),
|
|
1857
|
+
authorization: provisionerAuthorizationSchema.optional(),
|
|
1191
1858
|
recipientPublicKey: p256PublicKeyJwkSchema,
|
|
1192
1859
|
ttlSeconds: ttlSecondsSchema
|
|
1193
1860
|
});
|
|
1861
|
+
const mintManagedLeaseSchema = z.object({
|
|
1862
|
+
provider: z.enum(MANAGED_LEASE_KINDS),
|
|
1863
|
+
targetId: z.string().min(1),
|
|
1864
|
+
authorization: provisionerAuthorizationSchema.optional(),
|
|
1865
|
+
recipientPublicKey: p256PublicKeyJwkSchema.refine((value) => {
|
|
1866
|
+
try {
|
|
1867
|
+
return !("d" in JSON.parse(value));
|
|
1868
|
+
} catch {
|
|
1869
|
+
return false;
|
|
1870
|
+
}
|
|
1871
|
+
}, "send only a public key"),
|
|
1872
|
+
ttlSeconds: ttlSecondsSchema
|
|
1873
|
+
});
|
|
1194
1874
|
z.discriminatedUnion("provider", [
|
|
1195
1875
|
mintPostgresLeaseSchema,
|
|
1196
1876
|
mintMysqlLeaseSchema,
|
|
@@ -1198,8 +1878,647 @@ z.discriminatedUnion("provider", [
|
|
|
1198
1878
|
mintSshLeaseSchema,
|
|
1199
1879
|
mintAwsLeaseSchema,
|
|
1200
1880
|
mintGcpLeaseSchema,
|
|
1201
|
-
mintMongoLeaseSchema
|
|
1881
|
+
mintMongoLeaseSchema,
|
|
1882
|
+
mintManagedLeaseSchema
|
|
1202
1883
|
]);
|
|
1884
|
+
// ../../packages/core/src/providers/aws.ts
|
|
1885
|
+
/**
|
|
1886
|
+
* Tier-2 AWS provider. Unlike the verifier-injection providers, the target
|
|
1887
|
+
* (AWS/STS) mints the credential itself, so `render` cannot produce a
|
|
1888
|
+
* zero-knowledge verifier — instead it produces an {@link AwsStsSpec} the broker
|
|
1889
|
+
* executor runs: assume `roleArn` via STS, then wrap the returned credential to
|
|
1890
|
+
* the consumer's ephemeral public key before returning it. `render` stays pure
|
|
1891
|
+
* and secret-free (it never touches the admin credential or the network); the
|
|
1892
|
+
* consumer's private key never leaves their machine, so the plaintext
|
|
1893
|
+
* credential is only ever decryptable there.
|
|
1894
|
+
*
|
|
1895
|
+
* Revocation is a no-op: STS session credentials can't be revoked individually,
|
|
1896
|
+
* so v1 relies on the short `DurationSeconds` STS itself enforces — exactly like
|
|
1897
|
+
* the SSH provider's short-TTL certificates.
|
|
1898
|
+
*/
|
|
1899
|
+
/** Clamp a requested TTL into STS's `DurationSeconds` window and the target's cap. */
|
|
1900
|
+
function clampDuration(requested, maxTtlSeconds) {
|
|
1901
|
+
return Math.max(900, Math.min(requested, Math.min(maxTtlSeconds ?? 43200, AWS_MAX_TTL_SECONDS)));
|
|
1902
|
+
}
|
|
1903
|
+
const awsProvider = {
|
|
1904
|
+
kind: "aws",
|
|
1905
|
+
zkTier: 2,
|
|
1906
|
+
render(config, req, ctx) {
|
|
1907
|
+
if (req.provider !== "aws") throw new Error("aws provider received a non-aws request");
|
|
1908
|
+
const cfg = config;
|
|
1909
|
+
awsRoleArnSchema.parse(cfg.roleArn);
|
|
1910
|
+
p256PublicKeyJwkSchema.parse(req.recipientPublicKey);
|
|
1911
|
+
const roleSessionName = awsRoleSessionNameSchema.parse(ctx.leaseId);
|
|
1912
|
+
const durationSeconds = clampDuration(req.ttlSeconds, cfg.maxTtlSeconds);
|
|
1913
|
+
return {
|
|
1914
|
+
resourceRef: roleSessionName,
|
|
1915
|
+
expiresAt: new Date(ctx.nowMs + durationSeconds * 1e3).toISOString(),
|
|
1916
|
+
provision: {
|
|
1917
|
+
kind: "aws-sts",
|
|
1918
|
+
spec: {
|
|
1919
|
+
roleArn: cfg.roleArn,
|
|
1920
|
+
roleSessionName,
|
|
1921
|
+
durationSeconds,
|
|
1922
|
+
region: cfg.region,
|
|
1923
|
+
externalId: cfg.externalId,
|
|
1924
|
+
policy: cfg.sessionPolicy,
|
|
1925
|
+
recipientPublicKey: req.recipientPublicKey
|
|
1926
|
+
}
|
|
1927
|
+
},
|
|
1928
|
+
revoke: { kind: "noop" }
|
|
1929
|
+
};
|
|
1930
|
+
},
|
|
1931
|
+
renderRevoke() {
|
|
1932
|
+
return { kind: "noop" };
|
|
1933
|
+
}
|
|
1934
|
+
};
|
|
1935
|
+
// ../../packages/core/src/providers/gcp.ts
|
|
1936
|
+
/**
|
|
1937
|
+
* Tier-2 GCP provider. Like {@link awsProvider}, the target (GCP's IAM
|
|
1938
|
+
* Credentials API) mints the credential itself, so `render` cannot produce a
|
|
1939
|
+
* zero-knowledge verifier — instead it produces a {@link GcpImpersonateSpec} the
|
|
1940
|
+
* broker executor runs: impersonate `serviceAccount` via `generateAccessToken`,
|
|
1941
|
+
* then wrap the returned OAuth token to the consumer's ephemeral public key
|
|
1942
|
+
* before returning it. `render` stays pure and secret-free (it never touches the
|
|
1943
|
+
* admin key or the network); the consumer's private key never leaves their
|
|
1944
|
+
* machine, so the plaintext token is only ever decryptable there.
|
|
1945
|
+
*
|
|
1946
|
+
* Revocation is a no-op: short-lived access tokens can't be revoked
|
|
1947
|
+
* individually, so v1 relies on the short `lifetime` GCP itself enforces —
|
|
1948
|
+
* exactly like the AWS and SSH providers.
|
|
1949
|
+
*/
|
|
1950
|
+
/** The default scope when a target sets none — full API access, IAM-scoped. */
|
|
1951
|
+
const GCP_DEFAULT_SCOPE = "https://www.googleapis.com/auth/cloud-platform";
|
|
1952
|
+
/** Clamp a requested TTL into GCP's `lifetime` window and the target's cap. */
|
|
1953
|
+
function clampLifetime(requested, maxTtlSeconds) {
|
|
1954
|
+
return Math.max(60, Math.min(requested, Math.min(maxTtlSeconds ?? 43200, GCP_MAX_TTL_SECONDS)));
|
|
1955
|
+
}
|
|
1956
|
+
const gcpProvider = {
|
|
1957
|
+
kind: "gcp",
|
|
1958
|
+
zkTier: 2,
|
|
1959
|
+
render(config, req, ctx) {
|
|
1960
|
+
if (req.provider !== "gcp") throw new Error("gcp provider received a non-gcp request");
|
|
1961
|
+
const cfg = config;
|
|
1962
|
+
gcpServiceAccountEmailSchema.parse(cfg.serviceAccount);
|
|
1963
|
+
p256PublicKeyJwkSchema.parse(req.recipientPublicKey);
|
|
1964
|
+
const scopes = cfg.scopes?.length ? cfg.scopes : [GCP_DEFAULT_SCOPE];
|
|
1965
|
+
for (const scope of scopes) gcpOauthScopeSchema.parse(scope);
|
|
1966
|
+
const lifetimeSeconds = clampLifetime(req.ttlSeconds, cfg.maxTtlSeconds);
|
|
1967
|
+
const expiresAt = new Date(ctx.nowMs + lifetimeSeconds * 1e3).toISOString();
|
|
1968
|
+
return {
|
|
1969
|
+
resourceRef: cfg.serviceAccount,
|
|
1970
|
+
expiresAt,
|
|
1971
|
+
provision: {
|
|
1972
|
+
kind: "gcp-iam",
|
|
1973
|
+
spec: {
|
|
1974
|
+
serviceAccount: cfg.serviceAccount,
|
|
1975
|
+
scopes,
|
|
1976
|
+
lifetimeSeconds,
|
|
1977
|
+
delegates: cfg.delegates,
|
|
1978
|
+
recipientPublicKey: req.recipientPublicKey
|
|
1979
|
+
}
|
|
1980
|
+
},
|
|
1981
|
+
revoke: { kind: "noop" }
|
|
1982
|
+
};
|
|
1983
|
+
},
|
|
1984
|
+
renderRevoke() {
|
|
1985
|
+
return { kind: "noop" };
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
// ../../packages/core/src/providers/managed.ts
|
|
1989
|
+
function managedLeaseProvider(kind) {
|
|
1990
|
+
return {
|
|
1991
|
+
kind,
|
|
1992
|
+
zkTier: 2,
|
|
1993
|
+
render(target, request, context) {
|
|
1994
|
+
const config = managedTargetConfigSchema.parse(target);
|
|
1995
|
+
if (config.provider !== kind || request.provider !== kind || !("recipientPublicKey" in request)) throw new Error("managed credential provider mismatch");
|
|
1996
|
+
p256PublicKeyJwkSchema.parse(request.recipientPublicKey);
|
|
1997
|
+
const name = `sk_${context.leaseId}`;
|
|
1998
|
+
if (!/^sk_[a-zA-Z0-9_-]{1,64}$/.test(name)) throw new Error("invalid lease id");
|
|
1999
|
+
const ttl = Math.min(request.ttlSeconds, config.maxTtlSeconds ?? 604800);
|
|
2000
|
+
if (kind === "kubernetes" && ttl < 900) throw new Error("Kubernetes leases require at least 15 minutes.");
|
|
2001
|
+
const expiresAt = new Date(context.nowMs + ttl * 1e3).toISOString();
|
|
2002
|
+
const spec = {
|
|
2003
|
+
config,
|
|
2004
|
+
name,
|
|
2005
|
+
expiresAt,
|
|
2006
|
+
recipientPublicKey: request.recipientPublicKey
|
|
2007
|
+
};
|
|
2008
|
+
return {
|
|
2009
|
+
resourceRef: name,
|
|
2010
|
+
expiresAt,
|
|
2011
|
+
provision: {
|
|
2012
|
+
kind: "managed-credential",
|
|
2013
|
+
spec
|
|
2014
|
+
},
|
|
2015
|
+
revoke: {
|
|
2016
|
+
kind: "managed-credential",
|
|
2017
|
+
spec: {
|
|
2018
|
+
...spec,
|
|
2019
|
+
recipientPublicKey: ""
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
},
|
|
2024
|
+
renderRevoke(target, resourceRef) {
|
|
2025
|
+
const config = managedTargetConfigSchema.parse(target);
|
|
2026
|
+
if (config.provider !== kind || !/^sk_[a-zA-Z0-9_-]{1,64}$/.test(resourceRef)) throw new Error("invalid managed credential revoke");
|
|
2027
|
+
return {
|
|
2028
|
+
kind: "managed-credential",
|
|
2029
|
+
spec: {
|
|
2030
|
+
config,
|
|
2031
|
+
name: resourceRef,
|
|
2032
|
+
recipientPublicKey: "",
|
|
2033
|
+
expiresAt: ""
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
// ../../packages/core/src/providers/mongodb.ts
|
|
2040
|
+
/**
|
|
2041
|
+
* Tier-2 MongoDB provider. Unlike the verifier-injection providers, MongoDB's
|
|
2042
|
+
* `createUser` hashes the password *server-side* (there is no supported path to
|
|
2043
|
+
* inject a precomputed SCRAM credential), so `render` cannot produce a
|
|
2044
|
+
* zero-knowledge verifier. Instead it produces a {@link MongoUserSpec} the
|
|
2045
|
+
* broker executor runs: generate a password, `createUser` with the preset
|
|
2046
|
+
* roles, then wrap the credential to the consumer's ephemeral public key before
|
|
2047
|
+
* returning it. `render` stays pure and secret-free — it never generates the
|
|
2048
|
+
* password, touches the admin credential, or hits the network; the consumer's
|
|
2049
|
+
* private key never leaves their machine, so the plaintext credential is only
|
|
2050
|
+
* ever decryptable there.
|
|
2051
|
+
*
|
|
2052
|
+
* Revocation is real (unlike AWS/SSH): the broker's alarm-driven `dropUser` ends
|
|
2053
|
+
* the lease. Access levels map to MongoDB's built-in roles — `read` /
|
|
2054
|
+
* `readWrite` on the target database — or an explicit `roles` array for custom.
|
|
2055
|
+
*/
|
|
2056
|
+
/** Clamp a requested TTL to the target's optional cap. */
|
|
2057
|
+
function clampTtl(requested, maxTtlSeconds) {
|
|
2058
|
+
return maxTtlSeconds ? Math.min(requested, maxTtlSeconds) : requested;
|
|
2059
|
+
}
|
|
2060
|
+
/** The role grants a target's access level maps to. Defaults to read-only. */
|
|
2061
|
+
function rolesFor(config) {
|
|
2062
|
+
const db = config.connection.database;
|
|
2063
|
+
if (config.accessLevel === "custom") {
|
|
2064
|
+
if (!config.roles || config.roles.length === 0) throw new Error("mongodb custom target requires a non-empty roles array");
|
|
2065
|
+
return config.roles;
|
|
2066
|
+
}
|
|
2067
|
+
const preset = config.accessLevel === "readwrite" ? "readwrite" : "readonly";
|
|
2068
|
+
return [{
|
|
2069
|
+
role: MONGO_PRESET_ROLES[preset],
|
|
2070
|
+
db
|
|
2071
|
+
}];
|
|
2072
|
+
}
|
|
2073
|
+
const mongoProvider = {
|
|
2074
|
+
kind: "mongodb",
|
|
2075
|
+
zkTier: 2,
|
|
2076
|
+
render(config, req, ctx) {
|
|
2077
|
+
if (config.provider !== "mongodb") throw new Error("mongoProvider given a non-mongodb config");
|
|
2078
|
+
if (req.provider !== "mongodb") throw new Error("mongo provider received a non-mongodb request");
|
|
2079
|
+
p256PublicKeyJwkSchema.parse(req.recipientPublicKey);
|
|
2080
|
+
const username = mongoUserNameSchema.parse(ctx.leaseId);
|
|
2081
|
+
const authSource = mongoDatabaseNameSchema.parse(config.authSource ?? "admin");
|
|
2082
|
+
const database = mongoDatabaseNameSchema.parse(config.connection.database);
|
|
2083
|
+
const roles = rolesFor(config);
|
|
2084
|
+
const ttlSeconds = clampTtl(req.ttlSeconds, config.maxTtlSeconds);
|
|
2085
|
+
const expiresAt = new Date(ctx.nowMs + ttlSeconds * 1e3).toISOString();
|
|
2086
|
+
return {
|
|
2087
|
+
resourceRef: username,
|
|
2088
|
+
expiresAt,
|
|
2089
|
+
provision: {
|
|
2090
|
+
kind: "mongo-user",
|
|
2091
|
+
spec: {
|
|
2092
|
+
username,
|
|
2093
|
+
authSource,
|
|
2094
|
+
database,
|
|
2095
|
+
roles,
|
|
2096
|
+
recipientPublicKey: req.recipientPublicKey,
|
|
2097
|
+
expiresAt
|
|
2098
|
+
}
|
|
2099
|
+
},
|
|
2100
|
+
revoke: {
|
|
2101
|
+
kind: "mongo-user",
|
|
2102
|
+
spec: {
|
|
2103
|
+
username,
|
|
2104
|
+
authSource,
|
|
2105
|
+
database: "",
|
|
2106
|
+
roles: [],
|
|
2107
|
+
recipientPublicKey: "",
|
|
2108
|
+
expiresAt: ""
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
};
|
|
2112
|
+
},
|
|
2113
|
+
renderRevoke(config, resourceRef) {
|
|
2114
|
+
if (config.provider !== "mongodb") throw new Error("mongoProvider given a non-mongodb config");
|
|
2115
|
+
return {
|
|
2116
|
+
kind: "mongo-user",
|
|
2117
|
+
spec: {
|
|
2118
|
+
username: mongoUserNameSchema.parse(resourceRef),
|
|
2119
|
+
authSource: mongoDatabaseNameSchema.parse(config.authSource ?? "admin"),
|
|
2120
|
+
database: "",
|
|
2121
|
+
roles: [],
|
|
2122
|
+
recipientPublicKey: "",
|
|
2123
|
+
expiresAt: ""
|
|
2124
|
+
}
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
};
|
|
2128
|
+
// ../../packages/core/src/providers/mysql.ts
|
|
2129
|
+
/**
|
|
2130
|
+
* Tier-1 MySQL/MariaDB provider. The consumer generated the password and its
|
|
2131
|
+
* `mysql_native_password` verifier locally (see @seekrit/crypto
|
|
2132
|
+
* `mysqlNativePasswordVerifier`); we only ever see the verifier, which
|
|
2133
|
+
* `CREATE USER … IDENTIFIED WITH mysql_native_password AS '<hash>'` stores
|
|
2134
|
+
* verbatim and which cannot be used to authenticate (login is a
|
|
2135
|
+
* challenge-response needing a `SHA1(password)` preimage). So the handed-out
|
|
2136
|
+
* credential is zero-knowledge end to end — the provider merely renders SQL.
|
|
2137
|
+
*
|
|
2138
|
+
* Unlike Postgres there is no account-level `VALID UNTIL`: the broker's
|
|
2139
|
+
* alarm-driven `DROP USER` is the sole expiry mechanism. Preset access levels
|
|
2140
|
+
* apply inline `GRANT`s (MySQL roles need activation, an awkward fit for a
|
|
2141
|
+
* plain connection URL), so there is no shared group role / setup SQL.
|
|
2142
|
+
*/
|
|
2143
|
+
const DEFAULT_HOST = "%";
|
|
2144
|
+
/** Mirror of the registration-time host schema (render must not trust inputs). */
|
|
2145
|
+
const HOST_RE = /^[A-Za-z0-9_.%:-]{1,255}$/;
|
|
2146
|
+
/** Escape a backtick-quoted identifier by doubling backticks. */
|
|
2147
|
+
function ident(name) {
|
|
2148
|
+
return name.replace(/`/g, "``");
|
|
2149
|
+
}
|
|
2150
|
+
function render$2(template, vars) {
|
|
2151
|
+
return template.replace(/\{\{(name|verifier)\}\}/g, (_, key) => key === "name" ? vars.name : vars.verifier);
|
|
2152
|
+
}
|
|
2153
|
+
/**
|
|
2154
|
+
* Concrete create/revoke templates for a target. Presets synthesize a
|
|
2155
|
+
* `CREATE USER` plus an inline `GRANT` scoped to the target database; custom
|
|
2156
|
+
* (or a legacy target with no access level) uses the admin's statements,
|
|
2157
|
+
* falling back to a bare CREATE USER / DROP USER. Host and database come from
|
|
2158
|
+
* the (trusted, registration-validated) config and are baked in directly;
|
|
2159
|
+
* only `{{name}}`/`{{verifier}}` remain as per-lease placeholders.
|
|
2160
|
+
*/
|
|
2161
|
+
function statementsFor$2(config) {
|
|
2162
|
+
const account = `'{{name}}'@'${config.userHost && HOST_RE.test(config.userHost) ? config.userHost : DEFAULT_HOST}'`;
|
|
2163
|
+
const create = `CREATE USER ${account} IDENTIFIED WITH mysql_native_password AS '{{verifier}}';`;
|
|
2164
|
+
const revoke = `DROP USER IF EXISTS ${account};`;
|
|
2165
|
+
if (config.accessLevel === "readonly" || config.accessLevel === "readwrite") {
|
|
2166
|
+
const db = ident(config.connection.database);
|
|
2167
|
+
return {
|
|
2168
|
+
create: [create, `GRANT ${config.accessLevel === "readonly" ? "SELECT" : "SELECT, INSERT, UPDATE, DELETE"} ON \`${db}\`.* TO ${account};`],
|
|
2169
|
+
revoke: [revoke]
|
|
2170
|
+
};
|
|
2171
|
+
}
|
|
2172
|
+
return {
|
|
2173
|
+
create: config.createStatements ?? [create],
|
|
2174
|
+
revoke: config.revokeStatements ?? [revoke]
|
|
2175
|
+
};
|
|
2176
|
+
}
|
|
2177
|
+
const mysqlProvider = {
|
|
2178
|
+
kind: "mysql",
|
|
2179
|
+
zkTier: 1,
|
|
2180
|
+
render(config, req, ctx) {
|
|
2181
|
+
if (config.provider !== "mysql") throw new Error("mysqlProvider given a non-mysql config");
|
|
2182
|
+
if (req.provider !== "mysql") throw new Error("mysql provider received a non-mysql request");
|
|
2183
|
+
mysqlUserNameSchema.parse(req.roleName);
|
|
2184
|
+
mysqlNativeVerifierSchema.parse(req.verifier);
|
|
2185
|
+
const expiresAt = new Date(ctx.nowMs + req.ttlSeconds * 1e3).toISOString();
|
|
2186
|
+
const vars = {
|
|
2187
|
+
name: req.roleName,
|
|
2188
|
+
verifier: req.verifier
|
|
2189
|
+
};
|
|
2190
|
+
const { create, revoke } = statementsFor$2(config);
|
|
2191
|
+
const parameters = config.executor === "remote" && config.provisionerId ? { parameters: {
|
|
2192
|
+
name: req.roleName,
|
|
2193
|
+
verifier: req.verifier,
|
|
2194
|
+
validUntil: expiresAt
|
|
2195
|
+
} } : {};
|
|
2196
|
+
return {
|
|
2197
|
+
resourceRef: req.roleName,
|
|
2198
|
+
expiresAt,
|
|
2199
|
+
provision: {
|
|
2200
|
+
kind: "sql",
|
|
2201
|
+
...parameters,
|
|
2202
|
+
statements: create.map((s) => render$2(s, vars))
|
|
2203
|
+
},
|
|
2204
|
+
revoke: {
|
|
2205
|
+
kind: "sql",
|
|
2206
|
+
...parameters,
|
|
2207
|
+
statements: revoke.map((s) => render$2(s, {
|
|
2208
|
+
name: req.roleName,
|
|
2209
|
+
verifier: ""
|
|
2210
|
+
}))
|
|
2211
|
+
}
|
|
2212
|
+
};
|
|
2213
|
+
},
|
|
2214
|
+
renderRevoke(config, resourceRef) {
|
|
2215
|
+
if (config.provider !== "mysql") throw new Error("mysqlProvider given a non-mysql config");
|
|
2216
|
+
mysqlUserNameSchema.parse(resourceRef);
|
|
2217
|
+
return {
|
|
2218
|
+
kind: "sql",
|
|
2219
|
+
statements: statementsFor$2(config).revoke.map((s) => render$2(s, {
|
|
2220
|
+
name: resourceRef,
|
|
2221
|
+
verifier: ""
|
|
2222
|
+
}))
|
|
2223
|
+
};
|
|
2224
|
+
}
|
|
2225
|
+
};
|
|
2226
|
+
// ../../packages/core/src/providers/postgres.ts
|
|
2227
|
+
/**
|
|
2228
|
+
* Tier-1 Postgres provider. The consumer generated the password and its SCRAM
|
|
2229
|
+
* verifier locally (see @seekrit/crypto `scramSha256Verifier`); we only ever
|
|
2230
|
+
* see the verifier, which `CREATE ROLE … PASSWORD` stores verbatim and which
|
|
2231
|
+
* cannot be used to authenticate. So the handed-out credential is
|
|
2232
|
+
* zero-knowledge end to end — the provider merely renders SQL.
|
|
2233
|
+
*
|
|
2234
|
+
* Per-lease inputs are strict tokens (validated role name + verifier) and the
|
|
2235
|
+
* SQL is either an admin-configured template (custom) or derived from a preset
|
|
2236
|
+
* access level backed by a shared group role, so substitution cannot inject SQL.
|
|
2237
|
+
*/
|
|
2238
|
+
const DEFAULT_CREATE$1 = [`CREATE ROLE "{{name}}" LOGIN PASSWORD '{{verifier}}' VALID UNTIL '{{valid_until}}';`];
|
|
2239
|
+
const DEFAULT_REVOKE$1 = [`DROP ROLE IF EXISTS "{{name}}";`];
|
|
2240
|
+
function render$1(template, vars) {
|
|
2241
|
+
return template.replace(/\{\{(name|verifier|valid_until)\}\}/g, (_, key) => vars[key] ?? "");
|
|
2242
|
+
}
|
|
2243
|
+
/**
|
|
2244
|
+
* The concrete create/revoke templates for a target. Read-only and read-write
|
|
2245
|
+
* create the temp role `IN ROLE <group>` so it inherits the group's grants;
|
|
2246
|
+
* custom (or a legacy target with no access level) uses the admin's statements,
|
|
2247
|
+
* falling back to a bare CREATE ROLE.
|
|
2248
|
+
*/
|
|
2249
|
+
function statementsFor$1(config) {
|
|
2250
|
+
if (config.accessLevel === "readonly" || config.accessLevel === "readwrite") return {
|
|
2251
|
+
create: [`CREATE ROLE "{{name}}" LOGIN PASSWORD '{{verifier}}' VALID UNTIL '{{valid_until}}' IN ROLE ${POSTGRES_GROUP_ROLES[config.accessLevel]};`],
|
|
2252
|
+
revoke: DEFAULT_REVOKE$1
|
|
2253
|
+
};
|
|
2254
|
+
return {
|
|
2255
|
+
create: config.createStatements ?? DEFAULT_CREATE$1,
|
|
2256
|
+
revoke: config.revokeStatements ?? DEFAULT_REVOKE$1
|
|
2257
|
+
};
|
|
2258
|
+
}
|
|
2259
|
+
const postgresProvider = {
|
|
2260
|
+
kind: "postgres",
|
|
2261
|
+
zkTier: 1,
|
|
2262
|
+
render(config, req, ctx) {
|
|
2263
|
+
if (req.provider !== "postgres") throw new Error("postgres provider received a non-postgres request");
|
|
2264
|
+
postgresRoleNameSchema.parse(req.roleName);
|
|
2265
|
+
scramVerifierSchema.parse(req.verifier);
|
|
2266
|
+
const expiresAt = new Date(ctx.nowMs + req.ttlSeconds * 1e3).toISOString();
|
|
2267
|
+
const vars = {
|
|
2268
|
+
name: req.roleName,
|
|
2269
|
+
verifier: req.verifier,
|
|
2270
|
+
valid_until: expiresAt
|
|
2271
|
+
};
|
|
2272
|
+
const { create, revoke } = statementsFor$1(config);
|
|
2273
|
+
const parameters = config.executor === "remote" && config.provisionerId ? { parameters: {
|
|
2274
|
+
name: req.roleName,
|
|
2275
|
+
verifier: req.verifier,
|
|
2276
|
+
validUntil: expiresAt
|
|
2277
|
+
} } : {};
|
|
2278
|
+
return {
|
|
2279
|
+
resourceRef: req.roleName,
|
|
2280
|
+
expiresAt,
|
|
2281
|
+
provision: {
|
|
2282
|
+
kind: "sql",
|
|
2283
|
+
...parameters,
|
|
2284
|
+
statements: create.map((s) => render$1(s, vars))
|
|
2285
|
+
},
|
|
2286
|
+
revoke: {
|
|
2287
|
+
kind: "sql",
|
|
2288
|
+
...parameters,
|
|
2289
|
+
statements: revoke.map((s) => render$1(s, {
|
|
2290
|
+
name: req.roleName,
|
|
2291
|
+
verifier: "",
|
|
2292
|
+
valid_until: ""
|
|
2293
|
+
}))
|
|
2294
|
+
}
|
|
2295
|
+
};
|
|
2296
|
+
},
|
|
2297
|
+
renderRevoke(config, resourceRef) {
|
|
2298
|
+
postgresRoleNameSchema.parse(resourceRef);
|
|
2299
|
+
return {
|
|
2300
|
+
kind: "sql",
|
|
2301
|
+
statements: statementsFor$1(config).revoke.map((s) => render$1(s, {
|
|
2302
|
+
name: resourceRef,
|
|
2303
|
+
verifier: "",
|
|
2304
|
+
valid_until: ""
|
|
2305
|
+
}))
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
};
|
|
2309
|
+
// ../../packages/core/src/providers/redis.ts
|
|
2310
|
+
/**
|
|
2311
|
+
* Tier-1 Redis (6+) provider. The consumer generated the password and its
|
|
2312
|
+
* SHA-256 hex digest locally (see @seekrit/crypto `redisSha256Verifier`); we
|
|
2313
|
+
* only ever see the digest, which `ACL SETUSER … on #<hex>` stores verbatim and
|
|
2314
|
+
* which cannot be used to authenticate (Redis `AUTH` hashes the plaintext it
|
|
2315
|
+
* receives and compares, so the stored digest is a preimage). So the handed-out
|
|
2316
|
+
* credential is zero-knowledge end to end — the provider merely renders
|
|
2317
|
+
* commands.
|
|
2318
|
+
*
|
|
2319
|
+
* Unlike Postgres there is no account-level expiry: the broker's alarm-driven
|
|
2320
|
+
* `ACL DELUSER` is the sole expiry mechanism (as with MySQL). Preset access
|
|
2321
|
+
* levels apply inline ACL rules (Redis ACL has no role inheritance), so there is
|
|
2322
|
+
* no shared group role / setup step.
|
|
2323
|
+
*
|
|
2324
|
+
* Each rendered statement is a single Redis command line; the executor
|
|
2325
|
+
* whitespace-tokenizes it into RESP arguments. The per-lease inputs are strict
|
|
2326
|
+
* tokens (validated user name + hex digest) with no whitespace or ACL-rule
|
|
2327
|
+
* characters, so substitution cannot inject an extra argument or permission.
|
|
2328
|
+
*/
|
|
2329
|
+
const DEFAULT_CREATE = ["ACL SETUSER {{name}} on #{{verifier}}"];
|
|
2330
|
+
const DEFAULT_REVOKE = ["ACL DELUSER {{name}}"];
|
|
2331
|
+
/**
|
|
2332
|
+
* Inline ACL rules each preset grants: all keys (`~*`), the read (or read+write)
|
|
2333
|
+
* command category, and `+@connection` so client-handshake commands (HELLO,
|
|
2334
|
+
* PING, AUTH) work. No pub/sub channels (`&*`) — the categories don't enable
|
|
2335
|
+
* pub/sub anyway, and `&*` needs Redis 6.2+.
|
|
2336
|
+
*/
|
|
2337
|
+
const PRESET_RULES = {
|
|
2338
|
+
readonly: "~* +@read +@connection",
|
|
2339
|
+
readwrite: "~* +@read +@write +@connection"
|
|
2340
|
+
};
|
|
2341
|
+
function render(template, vars) {
|
|
2342
|
+
return template.replace(/\{\{(name|verifier)\}\}/g, (_, key) => key === "name" ? vars.name : vars.verifier);
|
|
2343
|
+
}
|
|
2344
|
+
/**
|
|
2345
|
+
* Concrete create/revoke command lines for a target. Presets synthesize an
|
|
2346
|
+
* `ACL SETUSER` that enables the user (`on`), sets its password digest, and
|
|
2347
|
+
* grants the preset's inline rules; custom (or a legacy target with no access
|
|
2348
|
+
* level) uses the admin's statements, falling back to a no-privilege user.
|
|
2349
|
+
*/
|
|
2350
|
+
function statementsFor(config) {
|
|
2351
|
+
if (config.accessLevel === "readonly" || config.accessLevel === "readwrite") return {
|
|
2352
|
+
create: [`ACL SETUSER {{name}} on #{{verifier}} ${PRESET_RULES[config.accessLevel]}`],
|
|
2353
|
+
revoke: DEFAULT_REVOKE
|
|
2354
|
+
};
|
|
2355
|
+
return {
|
|
2356
|
+
create: config.createStatements ?? DEFAULT_CREATE,
|
|
2357
|
+
revoke: config.revokeStatements ?? DEFAULT_REVOKE
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
2360
|
+
const redisProvider = {
|
|
2361
|
+
kind: "redis",
|
|
2362
|
+
zkTier: 1,
|
|
2363
|
+
render(config, req, ctx) {
|
|
2364
|
+
if (config.provider !== "redis") throw new Error("redisProvider given a non-redis config");
|
|
2365
|
+
if (req.provider !== "redis") throw new Error("redis provider received a non-redis request");
|
|
2366
|
+
redisUserNameSchema.parse(req.roleName);
|
|
2367
|
+
redisSha256VerifierSchema.parse(req.verifier);
|
|
2368
|
+
const expiresAt = new Date(ctx.nowMs + req.ttlSeconds * 1e3).toISOString();
|
|
2369
|
+
const vars = {
|
|
2370
|
+
name: req.roleName,
|
|
2371
|
+
verifier: req.verifier
|
|
2372
|
+
};
|
|
2373
|
+
const { create, revoke } = statementsFor(config);
|
|
2374
|
+
const parameters = config.executor === "remote" && config.provisionerId ? { parameters: {
|
|
2375
|
+
name: req.roleName,
|
|
2376
|
+
verifier: req.verifier,
|
|
2377
|
+
validUntil: expiresAt
|
|
2378
|
+
} } : {};
|
|
2379
|
+
return {
|
|
2380
|
+
resourceRef: req.roleName,
|
|
2381
|
+
expiresAt,
|
|
2382
|
+
provision: {
|
|
2383
|
+
kind: "sql",
|
|
2384
|
+
...parameters,
|
|
2385
|
+
statements: create.map((s) => render(s, vars))
|
|
2386
|
+
},
|
|
2387
|
+
revoke: {
|
|
2388
|
+
kind: "sql",
|
|
2389
|
+
...parameters,
|
|
2390
|
+
statements: revoke.map((s) => render(s, {
|
|
2391
|
+
name: req.roleName,
|
|
2392
|
+
verifier: ""
|
|
2393
|
+
}))
|
|
2394
|
+
}
|
|
2395
|
+
};
|
|
2396
|
+
},
|
|
2397
|
+
renderRevoke(config, resourceRef) {
|
|
2398
|
+
if (config.provider !== "redis") throw new Error("redisProvider given a non-redis config");
|
|
2399
|
+
redisUserNameSchema.parse(resourceRef);
|
|
2400
|
+
return {
|
|
2401
|
+
kind: "sql",
|
|
2402
|
+
statements: statementsFor(config).revoke.map((s) => render(s, {
|
|
2403
|
+
name: resourceRef,
|
|
2404
|
+
verifier: ""
|
|
2405
|
+
}))
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
// ../../packages/core/src/providers/ssh.ts
|
|
2410
|
+
/**
|
|
2411
|
+
* Tier-1 SSH certificate-authority provider. The consumer generated an
|
|
2412
|
+
* ephemeral keypair locally and sent only its public key; `render` produces a
|
|
2413
|
+
* validated {@link SshCertSpec} that the broker's `SshCaExecutor` signs with the
|
|
2414
|
+
* CA key. So render itself is pure and secret-free — it never sees the CA key,
|
|
2415
|
+
* and the consumer's private key never leaves their machine.
|
|
2416
|
+
*
|
|
2417
|
+
* A clock-skew grace is applied to `validAfter` so freshly minted certs work on
|
|
2418
|
+
* hosts whose clocks lag slightly. Revocation is a no-op: certificates are
|
|
2419
|
+
* self-contained, so v1 relies on short TTLs (a KRL is a follow-up).
|
|
2420
|
+
*/
|
|
2421
|
+
/** Backdate the validity window so minor host clock skew doesn't reject certs. */
|
|
2422
|
+
const CLOCK_SKEW_GRACE_SECONDS = 60;
|
|
2423
|
+
// ../../packages/core/src/providers/index.ts
|
|
2424
|
+
/** Registry — new providers register here so callers resolve by kind. */
|
|
2425
|
+
const leaseProviders = {
|
|
2426
|
+
kafka: managedLeaseProvider("kafka"),
|
|
2427
|
+
"sap-hana": managedLeaseProvider("sap-hana"),
|
|
2428
|
+
cassandra: managedLeaseProvider("cassandra"),
|
|
2429
|
+
vertica: managedLeaseProvider("vertica"),
|
|
2430
|
+
"ibm-api-connect": managedLeaseProvider("ibm-api-connect"),
|
|
2431
|
+
ldap: managedLeaseProvider("ldap"),
|
|
2432
|
+
entra: managedLeaseProvider("entra"),
|
|
2433
|
+
kubernetes: managedLeaseProvider("kubernetes"),
|
|
2434
|
+
postgres: postgresProvider,
|
|
2435
|
+
mysql: mysqlProvider,
|
|
2436
|
+
redis: redisProvider,
|
|
2437
|
+
ssh: {
|
|
2438
|
+
kind: "ssh",
|
|
2439
|
+
zkTier: 1,
|
|
2440
|
+
render(config, req, ctx) {
|
|
2441
|
+
if (req.provider !== "ssh") throw new Error("ssh provider received a non-ssh request");
|
|
2442
|
+
const cfg = config;
|
|
2443
|
+
sshPublicKeySchema.parse(req.publicKey);
|
|
2444
|
+
const principals = req.principals.map((p) => sshPrincipalSchema.parse(p));
|
|
2445
|
+
if (cfg.allowedPrincipals?.length) {
|
|
2446
|
+
for (const p of principals) if (!cfg.allowedPrincipals.includes(p)) throw new Error(`principal "${p}" is not allowed by this target`);
|
|
2447
|
+
}
|
|
2448
|
+
const ttl = cfg.maxTtlSeconds ? Math.min(req.ttlSeconds, cfg.maxTtlSeconds) : req.ttlSeconds;
|
|
2449
|
+
const nowSec = Math.floor(ctx.nowMs / 1e3);
|
|
2450
|
+
const validAfter = nowSec - CLOCK_SKEW_GRACE_SECONDS;
|
|
2451
|
+
const validBefore = nowSec + ttl;
|
|
2452
|
+
return {
|
|
2453
|
+
resourceRef: ctx.leaseId,
|
|
2454
|
+
expiresAt: (/* @__PURE__ */ new Date(validBefore * 1e3)).toISOString(),
|
|
2455
|
+
provision: {
|
|
2456
|
+
kind: "ssh-sign",
|
|
2457
|
+
spec: {
|
|
2458
|
+
userPublicKey: req.publicKey,
|
|
2459
|
+
keyId: ctx.leaseId,
|
|
2460
|
+
principals,
|
|
2461
|
+
validAfter,
|
|
2462
|
+
validBefore,
|
|
2463
|
+
extensions: cfg.extensions
|
|
2464
|
+
}
|
|
2465
|
+
},
|
|
2466
|
+
revoke: { kind: "noop" }
|
|
2467
|
+
};
|
|
2468
|
+
},
|
|
2469
|
+
renderRevoke() {
|
|
2470
|
+
return { kind: "noop" };
|
|
2471
|
+
}
|
|
2472
|
+
},
|
|
2473
|
+
aws: awsProvider,
|
|
2474
|
+
gcp: gcpProvider,
|
|
2475
|
+
mongodb: mongoProvider,
|
|
2476
|
+
elasticsearch: managedLeaseProvider("elasticsearch"),
|
|
2477
|
+
clickhouse: managedLeaseProvider("clickhouse"),
|
|
2478
|
+
rabbitmq: managedLeaseProvider("rabbitmq"),
|
|
2479
|
+
milvus: managedLeaseProvider("milvus"),
|
|
2480
|
+
"mongodb-atlas": managedLeaseProvider("mongodb-atlas"),
|
|
2481
|
+
couchbase: managedLeaseProvider("couchbase"),
|
|
2482
|
+
snowflake: managedLeaseProvider("snowflake"),
|
|
2483
|
+
elasticache: managedLeaseProvider("elasticache"),
|
|
2484
|
+
memorydb: managedLeaseProvider("memorydb"),
|
|
2485
|
+
"azure-sql": managedLeaseProvider("azure-sql"),
|
|
2486
|
+
mssql: managedLeaseProvider("mssql"),
|
|
2487
|
+
openrouter: managedLeaseProvider("openrouter"),
|
|
2488
|
+
tailscale: managedLeaseProvider("tailscale")
|
|
2489
|
+
};
|
|
2490
|
+
function leaseProviderFor(kind) {
|
|
2491
|
+
return leaseProviders[kind];
|
|
2492
|
+
}
|
|
2493
|
+
// ../../packages/core/src/provisioners.ts
|
|
2494
|
+
const provisionerIdSchema = z.string().regex(/^prv_[A-Za-z0-9_-]{32}$/);
|
|
2495
|
+
z.object({
|
|
2496
|
+
id: provisionerIdSchema,
|
|
2497
|
+
name: z.string().trim().min(1).max(128),
|
|
2498
|
+
transport: z.enum(["pull", "push"]).default("pull"),
|
|
2499
|
+
provisionerUrl: managedEndpointSchema.optional(),
|
|
2500
|
+
publicKeyJwk: p256PublicKeyJwkSchema.refine((value) => !("d" in JSON.parse(value)), "Supply only the public key"),
|
|
2501
|
+
wrappedSigningKey: z.string().max(16384).startsWith("wd1."),
|
|
2502
|
+
bootstrap: z.string().max(4096).startsWith("pb1.")
|
|
2503
|
+
}).strict().superRefine((v, ctx) => {
|
|
2504
|
+
if (v.transport === "push" && !v.provisionerUrl) ctx.addIssue({
|
|
2505
|
+
code: "custom",
|
|
2506
|
+
path: ["provisionerUrl"],
|
|
2507
|
+
message: "Inbound mode requires an HTTPS endpoint."
|
|
2508
|
+
});
|
|
2509
|
+
if (v.transport === "pull" && v.provisionerUrl) ctx.addIssue({
|
|
2510
|
+
code: "custom",
|
|
2511
|
+
path: ["provisionerUrl"],
|
|
2512
|
+
message: "Outbound mode does not use an endpoint."
|
|
2513
|
+
});
|
|
2514
|
+
});
|
|
2515
|
+
// ../../packages/core/src/slug.ts
|
|
2516
|
+
/**
|
|
2517
|
+
* The slug rule, with no dependencies — so a caller that cannot afford zod (the
|
|
2518
|
+
* resolve gateway's bundle, see apps/api/src/gateway) validates with the same
|
|
2519
|
+
* pattern `slugSchema` uses rather than a copy of it.
|
|
2520
|
+
*/
|
|
2521
|
+
const SLUG_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
1203
2522
|
// ../../packages/core/src/types.ts
|
|
1204
2523
|
/**
|
|
1205
2524
|
* Transactional notification emails seekrit can send. Each id is one
|
|
@@ -1225,7 +2544,7 @@ const NOTIFICATION_TYPES = [
|
|
|
1225
2544
|
];
|
|
1226
2545
|
// ../../packages/core/src/schemas.ts
|
|
1227
2546
|
/** URL-safe identifier segment: `my-app`, `production`, … */
|
|
1228
|
-
const slugSchema = z.string().min(1).max(64).regex(
|
|
2547
|
+
const slugSchema = z.string().min(1).max(64).regex(SLUG_PATTERN, "must be lowercase alphanumeric with hyphens");
|
|
1229
2548
|
const nameSchema = z.string().trim().min(1).max(128);
|
|
1230
2549
|
/** An email address, normalized to trimmed lowercase before validation. */
|
|
1231
2550
|
const emailSchema = z.string().trim().toLowerCase().pipe(z.email().max(320));
|
|
@@ -1310,9 +2629,18 @@ z.object({
|
|
|
1310
2629
|
*/
|
|
1311
2630
|
recoveryWrappedDek: z.string().min(1).nullish()
|
|
1312
2631
|
});
|
|
1313
|
-
z.object({
|
|
1314
|
-
/** Opaque versioned ciphertext blob from @seekrit/crypto. */
|
|
1315
|
-
ciphertext: z.string().min(1).max(65536)
|
|
2632
|
+
z.object({
|
|
2633
|
+
/** Opaque versioned ciphertext blob from @seekrit/crypto. */
|
|
2634
|
+
ciphertext: z.string().min(1).max(65536),
|
|
2635
|
+
/**
|
|
2636
|
+
* Compare-and-swap: write only if the secret is currently at this version
|
|
2637
|
+
* (`0` = only if it does not exist yet), else 412 `precondition_failed`.
|
|
2638
|
+
* Omit for an unconditional write. This is what lets a writer that read,
|
|
2639
|
+
* changed, and wrote back — a refreshed agent login, say — find out that
|
|
2640
|
+
* someone else wrote in between instead of silently erasing their value.
|
|
2641
|
+
*/
|
|
2642
|
+
expectedVersion: z.number().int().min(0).optional()
|
|
2643
|
+
});
|
|
1316
2644
|
z.object({ version: z.number().int().positive() });
|
|
1317
2645
|
z.object({ limit: z.coerce.number().int().min(1).max(200).default(50) });
|
|
1318
2646
|
z.object({
|
|
@@ -1666,8 +2994,37 @@ z.enum([
|
|
|
1666
2994
|
"azure-key-vault",
|
|
1667
2995
|
"huggingface-spaces",
|
|
1668
2996
|
"openai-vault",
|
|
1669
|
-
"claude-managed-agents"
|
|
2997
|
+
"claude-managed-agents",
|
|
2998
|
+
"coolify"
|
|
1670
2999
|
]);
|
|
3000
|
+
const coolifyConnectionConfigSchema = z.object({
|
|
3001
|
+
provider: z.literal("coolify"),
|
|
3002
|
+
baseUrl: z.string().trim().pipe(connectUrlSchema).transform((url, ctx) => {
|
|
3003
|
+
const parsed = new URL(url);
|
|
3004
|
+
if (![
|
|
3005
|
+
"/",
|
|
3006
|
+
"/api/v1",
|
|
3007
|
+
"/api/v1/"
|
|
3008
|
+
].includes(parsed.pathname)) {
|
|
3009
|
+
ctx.addIssue({
|
|
3010
|
+
code: "custom",
|
|
3011
|
+
message: "Enter the Coolify instance origin or its /api/v1 URL."
|
|
3012
|
+
});
|
|
3013
|
+
return z.NEVER;
|
|
3014
|
+
}
|
|
3015
|
+
return parsed.origin;
|
|
3016
|
+
})
|
|
3017
|
+
});
|
|
3018
|
+
const coolifyDestinationSchema = z.object({
|
|
3019
|
+
provider: z.literal("coolify"),
|
|
3020
|
+
applicationUuid: z.string().trim().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/, "Enter the Coolify application UUID."),
|
|
3021
|
+
target: z.enum(["production", "preview"]).default("production"),
|
|
3022
|
+
availability: z.enum([
|
|
3023
|
+
"runtime",
|
|
3024
|
+
"build",
|
|
3025
|
+
"both"
|
|
3026
|
+
]).default("runtime")
|
|
3027
|
+
});
|
|
1671
3028
|
/**
|
|
1672
3029
|
* Vercel account scope. The API token itself is never here — it is wrapped to
|
|
1673
3030
|
* the connection's public key and stored as ciphertext.
|
|
@@ -2084,7 +3441,8 @@ const syncConnectionConfigSchema = z.discriminatedUnion("provider", [
|
|
|
2084
3441
|
azureKeyVaultConnectionConfigSchema,
|
|
2085
3442
|
huggingfaceSpacesConnectionConfigSchema,
|
|
2086
3443
|
openaiVaultConnectionConfigSchema,
|
|
2087
|
-
claudeManagedAgentsConnectionConfigSchema
|
|
3444
|
+
claudeManagedAgentsConnectionConfigSchema,
|
|
3445
|
+
coolifyConnectionConfigSchema
|
|
2088
3446
|
]);
|
|
2089
3447
|
const vercelDestinationSchema = z.object({
|
|
2090
3448
|
provider: z.literal("vercel"),
|
|
@@ -2961,7 +4319,8 @@ const syncDestinationSchema = z.discriminatedUnion("provider", [
|
|
|
2961
4319
|
azureKeyVaultDestinationSchema,
|
|
2962
4320
|
huggingfaceSpacesDestinationSchema,
|
|
2963
4321
|
openaiVaultDestinationSchema,
|
|
2964
|
-
claudeManagedAgentsDestinationSchema
|
|
4322
|
+
claudeManagedAgentsDestinationSchema,
|
|
4323
|
+
coolifyDestinationSchema
|
|
2965
4324
|
]);
|
|
2966
4325
|
/**
|
|
2967
4326
|
* How seekrit secret names become destination key names. Applied in order:
|
|
@@ -3750,6 +5109,57 @@ async function decryptPrivateKey(passphrase, blob) {
|
|
|
3750
5109
|
throw new SeekritCryptoError("DECRYPT_FAILED", "wrong passphrase or corrupted key blob");
|
|
3751
5110
|
}
|
|
3752
5111
|
}
|
|
5112
|
+
// ../../packages/crypto/src/policy-key.ts
|
|
5113
|
+
/**
|
|
5114
|
+
* Signing with a principal's **existing** keypair, for agent access policy.
|
|
5115
|
+
*
|
|
5116
|
+
* Policy bundles are signed in the browser so the API can serve a blob it cannot
|
|
5117
|
+
* forge (`docs/agent-access-governance.md` §1). Every user already has a P-256
|
|
5118
|
+
* keypair whose private half is passphrase-encrypted and opaque to the server
|
|
5119
|
+
* (`users.public_key_jwk`), so this feature needs **no new key material**: no
|
|
5120
|
+
* second passphrase, no wrapping, no schema, and nothing extra for an admin to
|
|
5121
|
+
* lose. That was a deliberate condition of the design.
|
|
5122
|
+
*
|
|
5123
|
+
* The catch is that WebCrypto keys are algorithm-bound. A principal key is
|
|
5124
|
+
* imported for ECDH (`deriveBits`) and cannot sign, even though the underlying
|
|
5125
|
+
* curve is the same one ECDSA uses. So the JWK is re-imported here with the
|
|
5126
|
+
* algorithm hints stripped — the same private scalar, presented as an ECDSA key.
|
|
5127
|
+
*
|
|
5128
|
+
* **The tradeoff, stated plainly:** this reuses one key for two algorithms,
|
|
5129
|
+
* which key-management hygiene (NIST SP 800-57 §5.2) advises against. We accept
|
|
5130
|
+
* it because the alternative — a second keypair per admin — is the kind of
|
|
5131
|
+
* ceremony that gets skipped, and because both uses stay inside the same trust
|
|
5132
|
+
* boundary: the key already authorizes reading every secret the admin can read,
|
|
5133
|
+
* so a signature capability adds no reach an attacker holding it wouldn't have.
|
|
5134
|
+
* If a future version wants separation, the clean path is a managed KMS `sign`
|
|
5135
|
+
* key granted to publishers — the thumbprint pinning in the proxy works
|
|
5136
|
+
* unchanged, which is why the format carries the key rather than a user id.
|
|
5137
|
+
*/
|
|
5138
|
+
const ECDSA_PARAMS$1 = {
|
|
5139
|
+
name: "ECDSA",
|
|
5140
|
+
namedCurve: "P-256"
|
|
5141
|
+
};
|
|
5142
|
+
/**
|
|
5143
|
+
* Re-import a principal's private key JWK as an ECDSA signing key.
|
|
5144
|
+
*
|
|
5145
|
+
* `key_ops`, `alg`, and `use` are dropped: they say "ECDH" on a principal key,
|
|
5146
|
+
* and WebCrypto refuses an import whose declared operations don't include the
|
|
5147
|
+
* requested usage. Everything that determines the key — `crv`, `d`, `x`, `y` —
|
|
5148
|
+
* is passed through untouched.
|
|
5149
|
+
*/
|
|
5150
|
+
async function importPolicySigningKey(privateKeyJwk) {
|
|
5151
|
+
const jwk = JSON.parse(privateKeyJwk);
|
|
5152
|
+
if (jwk.kty !== "EC" || jwk.crv !== "P-256") throw new SeekritCryptoError("MALFORMED_BLOB", "policy signing needs an EC P-256 principal key");
|
|
5153
|
+
if (!jwk.d) throw new SeekritCryptoError("MALFORMED_BLOB", "policy signing needs the private half of the key");
|
|
5154
|
+
const { kty, crv, d, x, y } = jwk;
|
|
5155
|
+
return crypto.subtle.importKey("jwk", {
|
|
5156
|
+
kty,
|
|
5157
|
+
crv,
|
|
5158
|
+
d,
|
|
5159
|
+
x,
|
|
5160
|
+
y
|
|
5161
|
+
}, ECDSA_PARAMS$1, false, ["sign"]);
|
|
5162
|
+
}
|
|
3753
5163
|
// ../../packages/crypto/src/shamir.ts
|
|
3754
5164
|
/**
|
|
3755
5165
|
* Shamir's Secret Sharing over GF(2^8) — the same field AES uses, with the
|
|
@@ -3976,7 +5386,7 @@ function isServiceToken(value) {
|
|
|
3976
5386
|
return value.startsWith(`${TOKEN_PREFIX}_`);
|
|
3977
5387
|
}
|
|
3978
5388
|
// ../cli/package.json
|
|
3979
|
-
var version$1 = "2.
|
|
5389
|
+
var version$1 = "2.9.0";
|
|
3980
5390
|
const PROJECT_FILE = "seekrit.json";
|
|
3981
5391
|
function globalConfigPath() {
|
|
3982
5392
|
return join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "seekrit", "config.json");
|
|
@@ -4046,17 +5456,78 @@ var SeekritApiError = class extends Error {
|
|
|
4046
5456
|
this.code = code;
|
|
4047
5457
|
}
|
|
4048
5458
|
};
|
|
4049
|
-
var SeekritClient = class {
|
|
5459
|
+
var SeekritClient = class SeekritClient {
|
|
4050
5460
|
baseUrl;
|
|
5461
|
+
getLeaseSigner;
|
|
4051
5462
|
auth;
|
|
4052
5463
|
fetchImpl;
|
|
4053
5464
|
client;
|
|
4054
5465
|
constructor(options) {
|
|
4055
5466
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
4056
5467
|
this.auth = options.auth;
|
|
5468
|
+
this.getLeaseSigner = options.getLeaseSigner;
|
|
4057
5469
|
this.fetchImpl = options.fetch ?? ((...args) => fetch(...args));
|
|
4058
5470
|
this.client = options.client;
|
|
4059
5471
|
}
|
|
5472
|
+
/** Reuse this session while signing leases with its unlocked customer key. */
|
|
5473
|
+
withLeaseSigner(getLeaseSigner) {
|
|
5474
|
+
return new SeekritClient({
|
|
5475
|
+
baseUrl: this.baseUrl,
|
|
5476
|
+
auth: this.auth,
|
|
5477
|
+
fetch: this.fetchImpl,
|
|
5478
|
+
client: this.client,
|
|
5479
|
+
getLeaseSigner
|
|
5480
|
+
});
|
|
5481
|
+
}
|
|
5482
|
+
getProvisionerAccess(orgId, id) {
|
|
5483
|
+
return this.request("GET", `/v1/orgs/${orgId}/leases/provisioners/${id}/access`);
|
|
5484
|
+
}
|
|
5485
|
+
grantProvisionerAccess(orgId, id, chain) {
|
|
5486
|
+
return this.request("POST", `/v1/orgs/${orgId}/leases/provisioners/${id}/access`, chain);
|
|
5487
|
+
}
|
|
5488
|
+
revokeProvisionerAccess(orgId, id, type, principalId) {
|
|
5489
|
+
return this.request("DELETE", `/v1/orgs/${orgId}/leases/provisioners/${id}/access/${type}/${principalId}`);
|
|
5490
|
+
}
|
|
5491
|
+
async authorizeLease(orgId, input) {
|
|
5492
|
+
if (input.authorization) return input;
|
|
5493
|
+
const prep = await this.request("GET", `/v1/orgs/${orgId}/leases/targets/${input.targetId}/authorization`);
|
|
5494
|
+
if (!prep.required) return input;
|
|
5495
|
+
const token = this.auth.type === "bearer" ? this.auth.token : this.auth.type === "dynamic" ? await this.auth.getToken() : null;
|
|
5496
|
+
const signingKey = token && isServiceToken(token) ? await importPolicySigningKey(JSON.stringify(await crypto.subtle.exportKey("jwk", (await parseServiceToken(token)).privateKey))) : await this.getLeaseSigner?.();
|
|
5497
|
+
if (!signingKey) throw new Error("Unlock your Seekrit key to request a customer-provisioned lease.");
|
|
5498
|
+
const access = await verifyProvisionerChain(prep.chain, orgId, prep.provisionerId);
|
|
5499
|
+
if (!access.targets.includes("*") && !access.targets.includes(input.targetId)) throw new Error("Target is outside your provisioner access grant.");
|
|
5500
|
+
const leaseId = randomId("lea");
|
|
5501
|
+
const issuedAt = Date.now();
|
|
5502
|
+
const rendered = leaseProviderFor(input.provider).render(prep.config, input, {
|
|
5503
|
+
leaseId,
|
|
5504
|
+
nowMs: issuedAt
|
|
5505
|
+
});
|
|
5506
|
+
const expiresAt = Date.parse(rendered.expiresAt);
|
|
5507
|
+
if (expiresAt > access.expiresAt) throw new Error("Your access grant expires before this lease. Use a shorter duration or ask an administrator to renew it.");
|
|
5508
|
+
const proof = {
|
|
5509
|
+
version: 1,
|
|
5510
|
+
orgId,
|
|
5511
|
+
provisionerId: prep.provisionerId,
|
|
5512
|
+
targetId: input.targetId,
|
|
5513
|
+
provider: input.provider,
|
|
5514
|
+
leaseId,
|
|
5515
|
+
instanceId: prep.instanceId,
|
|
5516
|
+
nonce: crypto.randomUUID(),
|
|
5517
|
+
targetDigest: prep.targetDigest,
|
|
5518
|
+
action: provisionerTransportAction(rendered.provision),
|
|
5519
|
+
..."recipientPublicKey" in input ? { recipientPublicKey: input.recipientPublicKey } : {},
|
|
5520
|
+
issuedAt,
|
|
5521
|
+
expiresAt
|
|
5522
|
+
};
|
|
5523
|
+
return {
|
|
5524
|
+
...input,
|
|
5525
|
+
authorization: {
|
|
5526
|
+
...prep.chain,
|
|
5527
|
+
proof: await signProvisionerEnvelope("pr1", signingKey, proof)
|
|
5528
|
+
}
|
|
5529
|
+
};
|
|
5530
|
+
}
|
|
4060
5531
|
async request(method, path, body, extraHeaders) {
|
|
4061
5532
|
const headers = {
|
|
4062
5533
|
accept: "application/json",
|
|
@@ -4346,9 +5817,17 @@ var SeekritClient = class {
|
|
|
4346
5817
|
*
|
|
4347
5818
|
* `note` is the proposer's explanation, carried as a header so it is simply
|
|
4348
5819
|
* ignored by an unprotected environment.
|
|
5820
|
+
*
|
|
5821
|
+
* `expectedVersion` makes the write a compare-and-swap: it lands only if the
|
|
5822
|
+
* secret is still at that version (`0` = does not exist yet), and otherwise
|
|
5823
|
+
* fails with a 412 `precondition_failed` {@link SeekritApiError}.
|
|
4349
5824
|
*/
|
|
4350
|
-
setSecret(orgId, envId, name, ciphertext, note) {
|
|
4351
|
-
|
|
5825
|
+
setSecret(orgId, envId, name, ciphertext, note, options = {}) {
|
|
5826
|
+
const body = options.expectedVersion === void 0 ? { ciphertext } : {
|
|
5827
|
+
ciphertext,
|
|
5828
|
+
expectedVersion: options.expectedVersion
|
|
5829
|
+
};
|
|
5830
|
+
return this.request("PUT", `/v1/orgs/${orgId}/envs/${envId}/secrets/${name}`, body, changeNoteHeader(note));
|
|
4352
5831
|
}
|
|
4353
5832
|
/** Queued for review in a protected environment — see {@link setSecret}. */
|
|
4354
5833
|
deleteSecret(orgId, envId, name, note) {
|
|
@@ -4721,6 +6200,15 @@ var SeekritClient = class {
|
|
|
4721
6200
|
getLeaseBrokerKey(orgId) {
|
|
4722
6201
|
return this.request("GET", `/v1/orgs/${orgId}/leases/broker-key`);
|
|
4723
6202
|
}
|
|
6203
|
+
listProvisioners(orgId) {
|
|
6204
|
+
return this.request("GET", `/v1/orgs/${orgId}/leases/provisioners`);
|
|
6205
|
+
}
|
|
6206
|
+
registerProvisioner(orgId, input) {
|
|
6207
|
+
return this.request("POST", `/v1/orgs/${orgId}/leases/provisioners`, input);
|
|
6208
|
+
}
|
|
6209
|
+
deleteProvisioner(orgId, id) {
|
|
6210
|
+
return this.request("DELETE", `/v1/orgs/${orgId}/leases/provisioners/${id}`);
|
|
6211
|
+
}
|
|
4724
6212
|
listLeaseTargets(orgId) {
|
|
4725
6213
|
return this.request("GET", `/v1/orgs/${orgId}/leases/targets`);
|
|
4726
6214
|
}
|
|
@@ -4782,7 +6270,7 @@ var SeekritClient = class {
|
|
|
4782
6270
|
return this.request("GET", `/v1/orgs/${orgId}/leases`);
|
|
4783
6271
|
}
|
|
4784
6272
|
mintLease(orgId, input) {
|
|
4785
|
-
return this.request("POST", `/v1/orgs/${orgId}/leases`,
|
|
6273
|
+
return this.authorizeLease(orgId, input).then((body) => this.request("POST", `/v1/orgs/${orgId}/leases`, body));
|
|
4786
6274
|
}
|
|
4787
6275
|
revokeLease(orgId, leaseId) {
|
|
4788
6276
|
return this.request("DELETE", `/v1/orgs/${orgId}/leases/${leaseId}`);
|
|
@@ -5043,15 +6531,17 @@ function tryBuildContext(dotenvVars = {}) {
|
|
|
5043
6531
|
email: devUser
|
|
5044
6532
|
};
|
|
5045
6533
|
else return null;
|
|
5046
|
-
|
|
6534
|
+
const ctx = {
|
|
5047
6535
|
client: new SeekritClient({
|
|
5048
6536
|
baseUrl: apiUrl,
|
|
5049
6537
|
auth,
|
|
5050
|
-
client: CLI_CLIENT
|
|
6538
|
+
client: CLI_CLIENT,
|
|
6539
|
+
getLeaseSigner: async () => importPolicySigningKey(JSON.stringify(await crypto.subtle.exportKey("jwk", await getPrivateKey(ctx))))
|
|
5051
6540
|
}),
|
|
5052
6541
|
auth,
|
|
5053
6542
|
apiUrl
|
|
5054
6543
|
};
|
|
6544
|
+
return ctx;
|
|
5055
6545
|
}
|
|
5056
6546
|
function isTokenAuth(ctx) {
|
|
5057
6547
|
return ctx.auth.type === "bearer" && isServiceToken(ctx.auth.token);
|
|
@@ -5417,6 +6907,8 @@ async function ensureM2mAdminToken(dotenvVars = {}) {
|
|
|
5417
6907
|
process.env.SEEKRIT_TOKEN = token;
|
|
5418
6908
|
return token;
|
|
5419
6909
|
}
|
|
6910
|
+
AGENT_LOGIN_SECRETS.codex;
|
|
6911
|
+
AGENT_LOGIN_SECRETS.claude;
|
|
5420
6912
|
// ../cli/src/cache.ts
|
|
5421
6913
|
/** Render an age for a log line, rounded to its largest whole unit. */
|
|
5422
6914
|
function humanize(ms) {
|
|
@@ -5514,6 +7006,7 @@ async function materializeEnv(ctx, opts) {
|
|
|
5514
7006
|
const privateKey = await getPrivateKey(ctx);
|
|
5515
7007
|
const values = {};
|
|
5516
7008
|
const provenance = {};
|
|
7009
|
+
const origin = {};
|
|
5517
7010
|
for (const layer of layers) {
|
|
5518
7011
|
const dek = await unwrapDek(layer.wrappedDek, privateKey);
|
|
5519
7012
|
let label;
|
|
@@ -5523,14 +7016,32 @@ async function materializeEnv(ctx, opts) {
|
|
|
5523
7016
|
for (const secret of layer.secrets) {
|
|
5524
7017
|
values[secret.name] = await decryptSecret(dek, secret.ciphertext, secretAad(layer.environmentId, secret.name));
|
|
5525
7018
|
provenance[secret.name] = label;
|
|
7019
|
+
origin[secret.name] = {
|
|
7020
|
+
envId: layer.environmentId,
|
|
7021
|
+
dek
|
|
7022
|
+
};
|
|
5526
7023
|
}
|
|
5527
7024
|
}
|
|
7025
|
+
const agentLogins = {};
|
|
7026
|
+
for (const [name, value] of Object.entries(values)) {
|
|
7027
|
+
const from = origin[name];
|
|
7028
|
+
if (!from || !isAgentLoginValue(value)) continue;
|
|
7029
|
+
agentLogins[name] = {
|
|
7030
|
+
orgId: scope.orgId,
|
|
7031
|
+
envId: from.envId,
|
|
7032
|
+
dek: from.dek,
|
|
7033
|
+
value
|
|
7034
|
+
};
|
|
7035
|
+
delete values[name];
|
|
7036
|
+
delete provenance[name];
|
|
7037
|
+
}
|
|
5528
7038
|
const loadedEnvFiles = overlayEnvFiles(values, provenance, opts.envFiles);
|
|
5529
7039
|
return {
|
|
5530
7040
|
...interpolateValues(values, opts.interpolate !== false),
|
|
5531
7041
|
provenance,
|
|
5532
7042
|
scope,
|
|
5533
|
-
loadedEnvFiles
|
|
7043
|
+
loadedEnvFiles,
|
|
7044
|
+
agentLogins
|
|
5534
7045
|
};
|
|
5535
7046
|
}
|
|
5536
7047
|
/**
|
|
@@ -5757,10 +7268,10 @@ async function materializeFor(ctx, o) {
|
|
|
5757
7268
|
});
|
|
5758
7269
|
}
|
|
5759
7270
|
const targetShape = {
|
|
5760
|
-
org: z.string().optional().describe("organization slug or id (defaults to a lone org)"),
|
|
5761
|
-
app: z.string().optional().describe("application slug or id (or set via configure_project)"),
|
|
5762
|
-
group: z.string().optional().describe("target a group environment instead of an app"),
|
|
5763
|
-
env: z.string().optional().describe("environment slug or id (a service token infers its own)")
|
|
7271
|
+
org: z$1.string().optional().describe("organization slug or id (defaults to a lone org)"),
|
|
7272
|
+
app: z$1.string().optional().describe("application slug or id (or set via configure_project)"),
|
|
7273
|
+
group: z$1.string().optional().describe("target a group environment instead of an app"),
|
|
7274
|
+
env: z$1.string().optional().describe("environment slug or id (a service token infers its own)")
|
|
5764
7275
|
};
|
|
5765
7276
|
async function runMcpServer(options = {}) {
|
|
5766
7277
|
setFailThrows(true);
|
|
@@ -5820,14 +7331,14 @@ async function runMcpServer(options = {}) {
|
|
|
5820
7331
|
};
|
|
5821
7332
|
});
|
|
5822
7333
|
tool("list_orgs", "List organizations the caller can access.", ro, {}, async () => (await getCtx().client.listOrgs()).orgs);
|
|
5823
|
-
tool("list_apps", "List applications in an organization.", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
7334
|
+
tool("list_apps", "List applications in an organization.", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
5824
7335
|
const ctx = getCtx();
|
|
5825
7336
|
const orgRef = await resolveOrg(ctx, org);
|
|
5826
7337
|
return (await ctx.client.listApps(orgRef.id)).apps;
|
|
5827
7338
|
});
|
|
5828
7339
|
tool("list_envs", "List environments of an application.", ro, {
|
|
5829
|
-
org: z.string().optional(),
|
|
5830
|
-
app: z.string()
|
|
7340
|
+
org: z$1.string().optional(),
|
|
7341
|
+
app: z$1.string()
|
|
5831
7342
|
}, async ({ org, app }) => {
|
|
5832
7343
|
const ctx = getCtx();
|
|
5833
7344
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -5837,9 +7348,9 @@ async function runMcpServer(options = {}) {
|
|
|
5837
7348
|
return (await ctx.client.listEnvs(orgRef.id, appRow.id)).environments;
|
|
5838
7349
|
});
|
|
5839
7350
|
tool("list_branches", "List ephemeral branch configs in an application (optionally just one environment's).", ro, {
|
|
5840
|
-
org: z.string().optional(),
|
|
5841
|
-
app: z.string(),
|
|
5842
|
-
env: z.string().optional()
|
|
7351
|
+
org: z$1.string().optional(),
|
|
7352
|
+
app: z$1.string(),
|
|
7353
|
+
env: z$1.string().optional()
|
|
5843
7354
|
}, async ({ org, app, env }) => {
|
|
5844
7355
|
const ctx = getCtx();
|
|
5845
7356
|
const appRef = await resolveApp(ctx, {
|
|
@@ -5854,14 +7365,14 @@ async function runMcpServer(options = {}) {
|
|
|
5854
7365
|
});
|
|
5855
7366
|
return (await ctx.client.listBranches(parent.orgId, parent.envId)).branches;
|
|
5856
7367
|
});
|
|
5857
|
-
tool("list_groups", "List shared groups (reusable secret bags) in an organization.", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
7368
|
+
tool("list_groups", "List shared groups (reusable secret bags) in an organization.", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
5858
7369
|
const ctx = getCtx();
|
|
5859
7370
|
const orgRef = await resolveOrg(ctx, org);
|
|
5860
7371
|
return (await ctx.client.listGroups(orgRef.id)).groups;
|
|
5861
7372
|
});
|
|
5862
7373
|
tool("list_group_envs", "List a group's environments (per-slug value sets).", ro, {
|
|
5863
|
-
org: z.string().optional(),
|
|
5864
|
-
group: z.string()
|
|
7374
|
+
org: z$1.string().optional(),
|
|
7375
|
+
group: z$1.string()
|
|
5865
7376
|
}, async ({ org, group }) => {
|
|
5866
7377
|
const ctx = getCtx();
|
|
5867
7378
|
const g = await resolveGroup(ctx, {
|
|
@@ -5871,9 +7382,9 @@ async function runMcpServer(options = {}) {
|
|
|
5871
7382
|
return (await ctx.client.listGroupEnvs(g.orgId, g.id)).environments;
|
|
5872
7383
|
});
|
|
5873
7384
|
tool("list_env_groups", "List the groups composed into an application environment (precedence order).", ro, {
|
|
5874
|
-
org: z.string().optional(),
|
|
5875
|
-
app: z.string(),
|
|
5876
|
-
env: z.string()
|
|
7385
|
+
org: z$1.string().optional(),
|
|
7386
|
+
app: z$1.string(),
|
|
7387
|
+
env: z$1.string()
|
|
5877
7388
|
}, async ({ org, app, env }) => {
|
|
5878
7389
|
const ctx = getCtx();
|
|
5879
7390
|
const target = await resolveAppEnv(ctx, {
|
|
@@ -5883,22 +7394,22 @@ async function runMcpServer(options = {}) {
|
|
|
5883
7394
|
});
|
|
5884
7395
|
return (await ctx.client.listEnvGroups(target.orgId, target.envId)).groups;
|
|
5885
7396
|
});
|
|
5886
|
-
tool("list_members", "List organization members and their public keys (for granting access).", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
7397
|
+
tool("list_members", "List organization members and their public keys (for granting access).", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
5887
7398
|
const ctx = getCtx();
|
|
5888
7399
|
const orgRef = await resolveOrg(ctx, org);
|
|
5889
7400
|
return (await ctx.client.listMembers(orgRef.id)).members;
|
|
5890
7401
|
});
|
|
5891
|
-
tool("kms_list_keys", "List managed KMS keys the caller can see (metadata only).", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
7402
|
+
tool("kms_list_keys", "List managed KMS keys the caller can see (metadata only).", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
5892
7403
|
const ctx = getCtx();
|
|
5893
7404
|
const orgRef = await resolveOrg(ctx, org);
|
|
5894
7405
|
return (await ctx.client.listKmsKeys(orgRef.id)).keys;
|
|
5895
7406
|
});
|
|
5896
7407
|
tool("kms_create_key", "Create an org-scoped managed key. Material is generated locally and wrapped to each grantee (self plus any listed users/tokens); the server never sees it. Use the CLI for app/group-scoped keys.", { idempotent: false }, {
|
|
5897
|
-
org: z.string().optional(),
|
|
5898
|
-
name: z.string(),
|
|
5899
|
-
purpose: z.enum(["encrypt", "sign"]),
|
|
5900
|
-
grantUsers: z.array(z.string()).optional(),
|
|
5901
|
-
grantTokens: z.array(z.string()).optional()
|
|
7408
|
+
org: z$1.string().optional(),
|
|
7409
|
+
name: z$1.string(),
|
|
7410
|
+
purpose: z$1.enum(["encrypt", "sign"]),
|
|
7411
|
+
grantUsers: z$1.array(z$1.string()).optional(),
|
|
7412
|
+
grantTokens: z$1.array(z$1.string()).optional()
|
|
5902
7413
|
}, async ({ org, name, purpose, grantUsers, grantTokens }) => {
|
|
5903
7414
|
const ctx = getCtx();
|
|
5904
7415
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -5935,10 +7446,10 @@ async function runMcpServer(options = {}) {
|
|
|
5935
7446
|
return key;
|
|
5936
7447
|
});
|
|
5937
7448
|
tool("kms_grant", "Grant a principal (user email or token id) use of a key's current version.", { idempotent: true }, {
|
|
5938
|
-
org: z.string().optional(),
|
|
5939
|
-
key: z.string(),
|
|
5940
|
-
user: z.string().optional(),
|
|
5941
|
-
token: z.string().optional()
|
|
7449
|
+
org: z$1.string().optional(),
|
|
7450
|
+
key: z$1.string(),
|
|
7451
|
+
user: z$1.string().optional(),
|
|
7452
|
+
token: z$1.string().optional()
|
|
5942
7453
|
}, async ({ org, key, user, token }) => {
|
|
5943
7454
|
const ctx = getCtx();
|
|
5944
7455
|
ensureDecryptable(ctx);
|
|
@@ -5960,10 +7471,10 @@ async function runMcpServer(options = {}) {
|
|
|
5960
7471
|
};
|
|
5961
7472
|
});
|
|
5962
7473
|
tool("kms_encrypt", "Encrypt a value under a managed encrypt key; returns a ce1 ciphertext blob. `context` (if given) is bound as AAD and must be supplied identically to decrypt.", { readOnly: true }, {
|
|
5963
|
-
org: z.string().optional(),
|
|
5964
|
-
key: z.string(),
|
|
5965
|
-
plaintext: z.string(),
|
|
5966
|
-
context: z.string().optional()
|
|
7474
|
+
org: z$1.string().optional(),
|
|
7475
|
+
key: z$1.string(),
|
|
7476
|
+
plaintext: z$1.string(),
|
|
7477
|
+
context: z$1.string().optional()
|
|
5967
7478
|
}, async ({ org, key, plaintext, context }) => {
|
|
5968
7479
|
const ctx = getCtx();
|
|
5969
7480
|
ensureDecryptable(ctx);
|
|
@@ -5977,10 +7488,10 @@ async function runMcpServer(options = {}) {
|
|
|
5977
7488
|
}, plaintext, context ?? "") };
|
|
5978
7489
|
});
|
|
5979
7490
|
tool("kms_decrypt", "Decrypt a ce1 blob. Supply the same `context` used to encrypt.", ro, {
|
|
5980
|
-
org: z.string().optional(),
|
|
5981
|
-
key: z.string(),
|
|
5982
|
-
ciphertext: z.string(),
|
|
5983
|
-
context: z.string().optional()
|
|
7491
|
+
org: z$1.string().optional(),
|
|
7492
|
+
key: z$1.string(),
|
|
7493
|
+
ciphertext: z$1.string(),
|
|
7494
|
+
context: z$1.string().optional()
|
|
5984
7495
|
}, async ({ org, key, ciphertext, context }) => {
|
|
5985
7496
|
const ctx = getCtx();
|
|
5986
7497
|
ensureDecryptable(ctx);
|
|
@@ -5991,8 +7502,8 @@ async function runMcpServer(options = {}) {
|
|
|
5991
7502
|
return { plaintext: await kmsDecrypt(material, ciphertext, context ?? "") };
|
|
5992
7503
|
});
|
|
5993
7504
|
tool("kms_generate_data_key", "Generate a data key under a managed encrypt key (envelope encryption). Returns the plaintext key (base64) and its wrapped form to store.", { readOnly: true }, {
|
|
5994
|
-
org: z.string().optional(),
|
|
5995
|
-
key: z.string()
|
|
7505
|
+
org: z$1.string().optional(),
|
|
7506
|
+
key: z$1.string()
|
|
5996
7507
|
}, async ({ org, key }) => {
|
|
5997
7508
|
const ctx = getCtx();
|
|
5998
7509
|
ensureDecryptable(ctx);
|
|
@@ -6010,9 +7521,9 @@ async function runMcpServer(options = {}) {
|
|
|
6010
7521
|
};
|
|
6011
7522
|
});
|
|
6012
7523
|
tool("kms_sign", "Sign a message with a managed signing key; returns an sg1 signature blob.", { readOnly: true }, {
|
|
6013
|
-
org: z.string().optional(),
|
|
6014
|
-
key: z.string(),
|
|
6015
|
-
message: z.string()
|
|
7524
|
+
org: z$1.string().optional(),
|
|
7525
|
+
key: z$1.string(),
|
|
7526
|
+
message: z$1.string()
|
|
6016
7527
|
}, async ({ org, key, message }) => {
|
|
6017
7528
|
const ctx = getCtx();
|
|
6018
7529
|
ensureDecryptable(ctx);
|
|
@@ -6026,10 +7537,10 @@ async function runMcpServer(options = {}) {
|
|
|
6026
7537
|
}, message) };
|
|
6027
7538
|
});
|
|
6028
7539
|
tool("kms_verify", "Verify an sg1 signature over a message using a signing key's published public key (no grant needed).", ro, {
|
|
6029
|
-
org: z.string().optional(),
|
|
6030
|
-
key: z.string(),
|
|
6031
|
-
signature: z.string(),
|
|
6032
|
-
message: z.string()
|
|
7540
|
+
org: z$1.string().optional(),
|
|
7541
|
+
key: z$1.string(),
|
|
7542
|
+
signature: z$1.string(),
|
|
7543
|
+
message: z$1.string()
|
|
6033
7544
|
}, async ({ org, key, signature, message }) => {
|
|
6034
7545
|
const ctx = getCtx();
|
|
6035
7546
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6050,15 +7561,15 @@ async function runMcpServer(options = {}) {
|
|
|
6050
7561
|
updatedAt: s.updatedAt
|
|
6051
7562
|
}));
|
|
6052
7563
|
});
|
|
6053
|
-
tool("list_tokens", "List an organization's service tokens (never the secret token strings).", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
7564
|
+
tool("list_tokens", "List an organization's service tokens (never the secret token strings).", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
6054
7565
|
const ctx = getCtx();
|
|
6055
7566
|
const orgRef = await resolveOrg(ctx, org);
|
|
6056
7567
|
return (await ctx.client.listTokens(orgRef.id)).tokens;
|
|
6057
7568
|
});
|
|
6058
7569
|
tool("audit", "Read the organization's audit trail (most recent first).", ro, {
|
|
6059
|
-
org: z.string().optional(),
|
|
6060
|
-
limit: z.number().int().min(1).max(200).optional(),
|
|
6061
|
-
action: z.string().optional().describe("filter by action, e.g. secret.updated")
|
|
7570
|
+
org: z$1.string().optional(),
|
|
7571
|
+
limit: z$1.number().int().min(1).max(200).optional(),
|
|
7572
|
+
action: z$1.string().optional().describe("filter by action, e.g. secret.updated")
|
|
6062
7573
|
}, async ({ org, limit, action }) => {
|
|
6063
7574
|
const ctx = getCtx();
|
|
6064
7575
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6068,16 +7579,16 @@ async function runMcpServer(options = {}) {
|
|
|
6068
7579
|
})).entries;
|
|
6069
7580
|
});
|
|
6070
7581
|
tool("create_org", "Create an organization. Requires a user session — service tokens cannot own a Stytch org.", { idempotent: false }, {
|
|
6071
|
-
name: z.string(),
|
|
6072
|
-
slug: z.string()
|
|
7582
|
+
name: z$1.string(),
|
|
7583
|
+
slug: z$1.string()
|
|
6073
7584
|
}, async ({ name, slug }) => (await getCtx().client.createOrg({
|
|
6074
7585
|
name,
|
|
6075
7586
|
slug
|
|
6076
7587
|
})).org);
|
|
6077
7588
|
tool("create_app", "Create an application in an organization.", { idempotent: false }, {
|
|
6078
|
-
org: z.string().optional(),
|
|
6079
|
-
name: z.string(),
|
|
6080
|
-
slug: z.string()
|
|
7589
|
+
org: z$1.string().optional(),
|
|
7590
|
+
name: z$1.string(),
|
|
7591
|
+
slug: z$1.string()
|
|
6081
7592
|
}, async ({ org, name, slug }) => {
|
|
6082
7593
|
const ctx = getCtx();
|
|
6083
7594
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6087,9 +7598,9 @@ async function runMcpServer(options = {}) {
|
|
|
6087
7598
|
})).app;
|
|
6088
7599
|
});
|
|
6089
7600
|
tool("create_group", "Create a shared group (reusable secret bag) in an organization.", { idempotent: false }, {
|
|
6090
|
-
org: z.string().optional(),
|
|
6091
|
-
name: z.string(),
|
|
6092
|
-
slug: z.string()
|
|
7601
|
+
org: z$1.string().optional(),
|
|
7602
|
+
name: z$1.string(),
|
|
7603
|
+
slug: z$1.string()
|
|
6093
7604
|
}, async ({ org, name, slug }) => {
|
|
6094
7605
|
const ctx = getCtx();
|
|
6095
7606
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6099,10 +7610,10 @@ async function runMcpServer(options = {}) {
|
|
|
6099
7610
|
})).group;
|
|
6100
7611
|
});
|
|
6101
7612
|
tool("create_env", "Create an application environment. Generates the data key locally and grants it to the caller.", { idempotent: false }, {
|
|
6102
|
-
org: z.string().optional(),
|
|
6103
|
-
app: z.string(),
|
|
6104
|
-
name: z.string(),
|
|
6105
|
-
slug: z.string()
|
|
7613
|
+
org: z$1.string().optional(),
|
|
7614
|
+
app: z$1.string(),
|
|
7615
|
+
name: z$1.string(),
|
|
7616
|
+
slug: z$1.string()
|
|
6106
7617
|
}, async ({ org, app, name, slug }) => {
|
|
6107
7618
|
const ctx = getCtx();
|
|
6108
7619
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6119,11 +7630,11 @@ async function runMcpServer(options = {}) {
|
|
|
6119
7630
|
})).environment;
|
|
6120
7631
|
});
|
|
6121
7632
|
tool("create_branch", "Fork an environment into an ephemeral branch (a per-PR / preview config). The branch inherits the parent's secrets by layering at read time — nothing is copied or re-encrypted — and holds only the values you override on it. Generates the branch's data key locally, grants it to the caller, and shares it with the parent's other readers.", { idempotent: false }, {
|
|
6122
|
-
org: z.string().optional(),
|
|
6123
|
-
app: z.string(),
|
|
6124
|
-
from: z.string().describe("the environment to branch"),
|
|
6125
|
-
slug: z.string().describe("the branch name, e.g. pr-142"),
|
|
6126
|
-
ttl: z.string().optional().describe("lifetime: 12h, 7d, 2w, … or `never` (default 7d)")
|
|
7633
|
+
org: z$1.string().optional(),
|
|
7634
|
+
app: z$1.string(),
|
|
7635
|
+
from: z$1.string().describe("the environment to branch"),
|
|
7636
|
+
slug: z$1.string().describe("the branch name, e.g. pr-142"),
|
|
7637
|
+
ttl: z$1.string().optional().describe("lifetime: 12h, 7d, 2w, … or `never` (default 7d)")
|
|
6127
7638
|
}, async ({ org, app, from, slug, ttl }) => {
|
|
6128
7639
|
const ctx = getCtx();
|
|
6129
7640
|
const parent = await resolveAppEnv(ctx, {
|
|
@@ -6154,9 +7665,9 @@ async function runMcpServer(options = {}) {
|
|
|
6154
7665
|
})).branch;
|
|
6155
7666
|
});
|
|
6156
7667
|
tool("delete_branch", "Tear down a branch config and every value it overrode. The parent environment is untouched.", destructive, {
|
|
6157
|
-
org: z.string().optional(),
|
|
6158
|
-
app: z.string(),
|
|
6159
|
-
branch: z.string()
|
|
7668
|
+
org: z$1.string().optional(),
|
|
7669
|
+
app: z$1.string(),
|
|
7670
|
+
branch: z$1.string()
|
|
6160
7671
|
}, async ({ org, app, branch }) => {
|
|
6161
7672
|
const ctx = getCtx();
|
|
6162
7673
|
const appRef = await resolveApp(ctx, {
|
|
@@ -6168,10 +7679,10 @@ async function runMcpServer(options = {}) {
|
|
|
6168
7679
|
return { deleted: target.slug };
|
|
6169
7680
|
});
|
|
6170
7681
|
tool("create_group_env", "Create a group environment. Generates the data key locally and grants it to the caller.", { idempotent: false }, {
|
|
6171
|
-
org: z.string().optional(),
|
|
6172
|
-
group: z.string(),
|
|
6173
|
-
name: z.string(),
|
|
6174
|
-
slug: z.string()
|
|
7682
|
+
org: z$1.string().optional(),
|
|
7683
|
+
group: z$1.string(),
|
|
7684
|
+
name: z$1.string(),
|
|
7685
|
+
slug: z$1.string()
|
|
6175
7686
|
}, async ({ org, group, name, slug }) => {
|
|
6176
7687
|
const ctx = getCtx();
|
|
6177
7688
|
const g = await resolveGroup(ctx, {
|
|
@@ -6188,11 +7699,11 @@ async function runMcpServer(options = {}) {
|
|
|
6188
7699
|
})).environment;
|
|
6189
7700
|
});
|
|
6190
7701
|
tool("compose_group", "Compose a group into an application environment (higher position wins on name clashes).", { idempotent: true }, {
|
|
6191
|
-
org: z.string().optional(),
|
|
6192
|
-
app: z.string(),
|
|
6193
|
-
env: z.string(),
|
|
6194
|
-
group: z.string(),
|
|
6195
|
-
position: z.number().int().min(0).optional()
|
|
7702
|
+
org: z$1.string().optional(),
|
|
7703
|
+
app: z$1.string(),
|
|
7704
|
+
env: z$1.string(),
|
|
7705
|
+
group: z$1.string(),
|
|
7706
|
+
position: z$1.number().int().min(0).optional()
|
|
6196
7707
|
}, async ({ org, app, env, group, position }) => {
|
|
6197
7708
|
const ctx = getCtx();
|
|
6198
7709
|
const target = await resolveAppEnv(ctx, {
|
|
@@ -6213,10 +7724,10 @@ async function runMcpServer(options = {}) {
|
|
|
6213
7724
|
})).group;
|
|
6214
7725
|
});
|
|
6215
7726
|
tool("uncompose_group", "Remove a composed group from an application environment.", { idempotent: true }, {
|
|
6216
|
-
org: z.string().optional(),
|
|
6217
|
-
app: z.string(),
|
|
6218
|
-
env: z.string(),
|
|
6219
|
-
group: z.string()
|
|
7727
|
+
org: z$1.string().optional(),
|
|
7728
|
+
app: z$1.string(),
|
|
7729
|
+
env: z$1.string(),
|
|
7730
|
+
group: z$1.string()
|
|
6220
7731
|
}, async ({ org, app, env, group }) => {
|
|
6221
7732
|
const ctx = getCtx();
|
|
6222
7733
|
const target = await resolveAppEnv(ctx, {
|
|
@@ -6233,9 +7744,9 @@ async function runMcpServer(options = {}) {
|
|
|
6233
7744
|
});
|
|
6234
7745
|
tool("set_secret", "Encrypt a value locally and store it in an environment. A value may reference another secret as ${OTHER_SECRET}: the reference is stored literally and expanded whenever the secret is read, so it tracks the referenced value. Write $${OTHER_SECRET} for a literal. If the environment requires approval the write is QUEUED, not stored: the result carries queued:true and a changeRequestId, and the secret keeps its old value until a human approves.", { idempotent: false }, {
|
|
6235
7746
|
...targetShape,
|
|
6236
|
-
name: z.string(),
|
|
6237
|
-
value: z.string(),
|
|
6238
|
-
note: z.string().optional()
|
|
7747
|
+
name: z$1.string(),
|
|
7748
|
+
value: z$1.string(),
|
|
7749
|
+
note: z$1.string().optional()
|
|
6239
7750
|
}, async (o) => {
|
|
6240
7751
|
const ctx = getCtx();
|
|
6241
7752
|
ensureDecryptable(ctx);
|
|
@@ -6254,10 +7765,10 @@ async function runMcpServer(options = {}) {
|
|
|
6254
7765
|
});
|
|
6255
7766
|
tool("get_secret", "Return one secret. By default only reports presence + version; pass reveal:true to decrypt the plaintext into this response (avoid unless the value is actually needed — prefer run_command). A revealed current value has its ${OTHER_SECRET} references expanded against this environment's own secrets; pass raw:true for the stored text instead. Pass `version` to read an earlier version instead of the current one (always as stored, never expanded).", ro, {
|
|
6256
7767
|
...targetShape,
|
|
6257
|
-
name: z.string(),
|
|
6258
|
-
reveal: z.boolean().optional(),
|
|
6259
|
-
raw: z.boolean().optional().describe("skip ${OTHER_SECRET} expansion (with reveal)"),
|
|
6260
|
-
version: z.number().int().positive().optional().describe("an earlier version from list_secret_versions (default: current)")
|
|
7768
|
+
name: z$1.string(),
|
|
7769
|
+
reveal: z$1.boolean().optional(),
|
|
7770
|
+
raw: z$1.boolean().optional().describe("skip ${OTHER_SECRET} expansion (with reveal)"),
|
|
7771
|
+
version: z$1.number().int().positive().optional().describe("an earlier version from list_secret_versions (default: current)")
|
|
6261
7772
|
}, async (o) => {
|
|
6262
7773
|
const ctx = getCtx();
|
|
6263
7774
|
const { orgId, envId } = await resolveEnvTarget(ctx, o);
|
|
@@ -6291,8 +7802,8 @@ async function runMcpServer(options = {}) {
|
|
|
6291
7802
|
});
|
|
6292
7803
|
tool("list_secret_versions", "List a secret's version history: who wrote each version, when, and which ones were restores. Never returns values — pair it with restore_secret to roll back, or get_secret(version, reveal:true) to inspect one.", ro, {
|
|
6293
7804
|
...targetShape,
|
|
6294
|
-
name: z.string(),
|
|
6295
|
-
limit: z.number().int().min(1).max(200).optional().describe("default 20")
|
|
7805
|
+
name: z$1.string(),
|
|
7806
|
+
limit: z$1.number().int().min(1).max(200).optional().describe("default 20")
|
|
6296
7807
|
}, async (o) => {
|
|
6297
7808
|
const ctx = getCtx();
|
|
6298
7809
|
const { orgId, envId } = await resolveEnvTarget(ctx, o);
|
|
@@ -6309,9 +7820,9 @@ async function runMcpServer(options = {}) {
|
|
|
6309
7820
|
});
|
|
6310
7821
|
tool("restore_secret", "Roll a secret back to an earlier version. The stored ciphertext is replayed as a NEW version (history is append-only, nothing is overwritten). Keyless — no decryption happens, so this works even without a key.", { idempotent: false }, {
|
|
6311
7822
|
...targetShape,
|
|
6312
|
-
name: z.string(),
|
|
6313
|
-
version: z.number().int().positive(),
|
|
6314
|
-
note: z.string().optional()
|
|
7823
|
+
name: z$1.string(),
|
|
7824
|
+
version: z$1.number().int().positive(),
|
|
7825
|
+
note: z$1.string().optional()
|
|
6315
7826
|
}, async (o) => {
|
|
6316
7827
|
const ctx = getCtx();
|
|
6317
7828
|
const { orgId, envId } = await resolveEnvTarget(ctx, o);
|
|
@@ -6330,8 +7841,8 @@ async function runMcpServer(options = {}) {
|
|
|
6330
7841
|
});
|
|
6331
7842
|
tool("delete_secret", "Delete a secret from an environment.", destructive, {
|
|
6332
7843
|
...targetShape,
|
|
6333
|
-
name: z.string(),
|
|
6334
|
-
note: z.string().optional()
|
|
7844
|
+
name: z$1.string(),
|
|
7845
|
+
note: z$1.string().optional()
|
|
6335
7846
|
}, async (o) => {
|
|
6336
7847
|
const ctx = getCtx();
|
|
6337
7848
|
const { orgId, envId } = await resolveEnvTarget(ctx, o);
|
|
@@ -6350,15 +7861,15 @@ async function runMcpServer(options = {}) {
|
|
|
6350
7861
|
destructive: true,
|
|
6351
7862
|
idempotent: false
|
|
6352
7863
|
}, {
|
|
6353
|
-
command: z.string().describe("executable to run"),
|
|
6354
|
-
args: z.array(z.string()).optional(),
|
|
6355
|
-
org: z.string().optional(),
|
|
6356
|
-
app: z.string().optional(),
|
|
6357
|
-
env: z.string().optional().describe("environment slug (token auth infers this)"),
|
|
6358
|
-
branch: z.string().optional().describe("read an ephemeral branch of that environment"),
|
|
6359
|
-
with: z.record(z.string(), z.string()).optional().describe("group=env slice overrides"),
|
|
6360
|
-
envFile: z.array(z.string()).optional().describe(".env files to overlay (default [.env])"),
|
|
6361
|
-
cwd: z.string().optional()
|
|
7864
|
+
command: z$1.string().describe("executable to run"),
|
|
7865
|
+
args: z$1.array(z$1.string()).optional(),
|
|
7866
|
+
org: z$1.string().optional(),
|
|
7867
|
+
app: z$1.string().optional(),
|
|
7868
|
+
env: z$1.string().optional().describe("environment slug (token auth infers this)"),
|
|
7869
|
+
branch: z$1.string().optional().describe("read an ephemeral branch of that environment"),
|
|
7870
|
+
with: z$1.record(z$1.string(), z$1.string()).optional().describe("group=env slice overrides"),
|
|
7871
|
+
envFile: z$1.array(z$1.string()).optional().describe(".env files to overlay (default [.env])"),
|
|
7872
|
+
cwd: z$1.string().optional()
|
|
6362
7873
|
}, async (o) => {
|
|
6363
7874
|
const ctx = getCtx();
|
|
6364
7875
|
ensureDecryptable(ctx);
|
|
@@ -6373,12 +7884,12 @@ async function runMcpServer(options = {}) {
|
|
|
6373
7884
|
};
|
|
6374
7885
|
});
|
|
6375
7886
|
tool("export_env", "Write the resolved secrets to a dotenv file on disk and return the variable names written (never the values). Use to materialize a .env for local tooling.", destructive, {
|
|
6376
|
-
file: z.string().describe("path to write, e.g. .env"),
|
|
6377
|
-
org: z.string().optional(),
|
|
6378
|
-
app: z.string().optional(),
|
|
6379
|
-
env: z.string().optional(),
|
|
6380
|
-
branch: z.string().optional().describe("read an ephemeral branch of that environment"),
|
|
6381
|
-
with: z.record(z.string(), z.string()).optional()
|
|
7887
|
+
file: z$1.string().describe("path to write, e.g. .env"),
|
|
7888
|
+
org: z$1.string().optional(),
|
|
7889
|
+
app: z$1.string().optional(),
|
|
7890
|
+
env: z$1.string().optional(),
|
|
7891
|
+
branch: z$1.string().optional().describe("read an ephemeral branch of that environment"),
|
|
7892
|
+
with: z$1.record(z$1.string(), z$1.string()).optional()
|
|
6382
7893
|
}, async (o) => {
|
|
6383
7894
|
const ctx = getCtx();
|
|
6384
7895
|
ensureDecryptable(ctx);
|
|
@@ -6392,11 +7903,11 @@ async function runMcpServer(options = {}) {
|
|
|
6392
7903
|
};
|
|
6393
7904
|
});
|
|
6394
7905
|
tool("create_token", "Mint a service token, printed once. Runtime tokens bind to one app environment (auto-granted its keys, so a command/agent can decrypt it). Pass admin:true for an org-scoped provisioning token (create apps/groups/envs, grant, mint tokens) — admin tokens need no env binding.", { idempotent: false }, {
|
|
6395
|
-
name: z.string().describe("display name, e.g. ci-deploy or agent-session"),
|
|
6396
|
-
org: z.string().optional(),
|
|
6397
|
-
app: z.string().optional().describe("bind to this app (runtime tokens)"),
|
|
6398
|
-
env: z.string().optional().describe("bind to this env (runtime tokens)"),
|
|
6399
|
-
admin: z.boolean().optional().describe("mint an org-scoped admin token")
|
|
7906
|
+
name: z$1.string().describe("display name, e.g. ci-deploy or agent-session"),
|
|
7907
|
+
org: z$1.string().optional(),
|
|
7908
|
+
app: z$1.string().optional().describe("bind to this app (runtime tokens)"),
|
|
7909
|
+
env: z$1.string().optional().describe("bind to this env (runtime tokens)"),
|
|
7910
|
+
admin: z$1.boolean().optional().describe("mint an org-scoped admin token")
|
|
6400
7911
|
}, async ({ name, org, app, env, admin }) => {
|
|
6401
7912
|
const ctx = getCtx();
|
|
6402
7913
|
const role = admin ? "admin" : "member";
|
|
@@ -6432,8 +7943,8 @@ async function runMcpServer(options = {}) {
|
|
|
6432
7943
|
};
|
|
6433
7944
|
});
|
|
6434
7945
|
tool("revoke_token", "Revoke a service token by id.", destructive, {
|
|
6435
|
-
org: z.string().optional(),
|
|
6436
|
-
tokenId: z.string()
|
|
7946
|
+
org: z$1.string().optional(),
|
|
7947
|
+
tokenId: z$1.string()
|
|
6437
7948
|
}, async ({ org, tokenId }) => {
|
|
6438
7949
|
const ctx = getCtx();
|
|
6439
7950
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6445,8 +7956,8 @@ async function runMcpServer(options = {}) {
|
|
|
6445
7956
|
});
|
|
6446
7957
|
tool("grant_env", "Grant a member (by email) or service token (by id) access to an environment's data key. Re-wraps the DEK to the grantee — the caller must already hold the key.", { idempotent: true }, {
|
|
6447
7958
|
...targetShape,
|
|
6448
|
-
user: z.string().optional().describe("org member email"),
|
|
6449
|
-
token: z.string().optional().describe("service token id (skt_…)")
|
|
7959
|
+
user: z$1.string().optional().describe("org member email"),
|
|
7960
|
+
token: z$1.string().optional().describe("service token id (skt_…)")
|
|
6450
7961
|
}, async (o) => {
|
|
6451
7962
|
if (Boolean(o.user) === Boolean(o.token)) throw new Error("pass exactly one of user or token");
|
|
6452
7963
|
const ctx = getCtx();
|
|
@@ -6487,16 +7998,16 @@ async function runMcpServer(options = {}) {
|
|
|
6487
7998
|
principalId
|
|
6488
7999
|
};
|
|
6489
8000
|
});
|
|
6490
|
-
tool("list_pg_targets", "List registered Postgres provisioning targets for temporary credentials.", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
8001
|
+
tool("list_pg_targets", "List registered Postgres provisioning targets for temporary credentials.", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
6491
8002
|
const ctx = getCtx();
|
|
6492
8003
|
const orgRef = await resolveOrg(ctx, org);
|
|
6493
8004
|
return (await ctx.client.listLeaseTargets(orgRef.id)).targets;
|
|
6494
8005
|
});
|
|
6495
8006
|
tool("create_pg_lease", "Mint a short-lived Postgres credential against a target and return a ready-to-use connection URL. The password is generated on THIS machine and only its SCRAM verifier is sent to the API — the plaintext never reaches seekrit or Postgres at rest. The role auto-expires; revoke early with revoke_pg_lease.", { idempotent: false }, {
|
|
6496
|
-
org: z.string().optional(),
|
|
6497
|
-
target: z.string().describe("target id or name"),
|
|
6498
|
-
role: z.string().optional().describe("role name to create (default: random tmp_ name)"),
|
|
6499
|
-
ttlSeconds: z.number().int().min(60).max(604800).optional().describe("lifetime (default 3600)")
|
|
8007
|
+
org: z$1.string().optional(),
|
|
8008
|
+
target: z$1.string().describe("target id or name"),
|
|
8009
|
+
role: z$1.string().optional().describe("role name to create (default: random tmp_ name)"),
|
|
8010
|
+
ttlSeconds: z$1.number().int().min(60).max(604800).optional().describe("lifetime (default 3600)")
|
|
6500
8011
|
}, async ({ org, target, role, ttlSeconds }) => {
|
|
6501
8012
|
const ctx = getCtx();
|
|
6502
8013
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6521,14 +8032,14 @@ async function runMcpServer(options = {}) {
|
|
|
6521
8032
|
note: "short-lived credential; it auto-expires and the plaintext is not stored anywhere"
|
|
6522
8033
|
};
|
|
6523
8034
|
});
|
|
6524
|
-
tool("list_pg_leases", "List Postgres leases (the ledger — never secret material).", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
8035
|
+
tool("list_pg_leases", "List Postgres leases (the ledger — never secret material).", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
6525
8036
|
const ctx = getCtx();
|
|
6526
8037
|
const orgRef = await resolveOrg(ctx, org);
|
|
6527
8038
|
return (await ctx.client.listLeases(orgRef.id)).leases;
|
|
6528
8039
|
});
|
|
6529
8040
|
tool("revoke_pg_lease", "Revoke a Postgres lease now (drops the role immediately).", destructive, {
|
|
6530
|
-
org: z.string().optional(),
|
|
6531
|
-
leaseId: z.string()
|
|
8041
|
+
org: z$1.string().optional(),
|
|
8042
|
+
leaseId: z$1.string()
|
|
6532
8043
|
}, async ({ org, leaseId }) => {
|
|
6533
8044
|
const ctx = getCtx();
|
|
6534
8045
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6538,16 +8049,16 @@ async function runMcpServer(options = {}) {
|
|
|
6538
8049
|
leaseId
|
|
6539
8050
|
};
|
|
6540
8051
|
});
|
|
6541
|
-
tool("list_mysql_targets", "List registered MySQL/MariaDB provisioning targets for temporary credentials.", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
8052
|
+
tool("list_mysql_targets", "List registered MySQL/MariaDB provisioning targets for temporary credentials.", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
6542
8053
|
const ctx = getCtx();
|
|
6543
8054
|
const orgRef = await resolveOrg(ctx, org);
|
|
6544
8055
|
return (await ctx.client.listLeaseTargets(orgRef.id)).targets.filter((t) => t.provider === "mysql");
|
|
6545
8056
|
});
|
|
6546
8057
|
tool("create_mysql_lease", "Mint a short-lived MySQL/MariaDB credential against a target and return a ready-to-use connection URL. The password is generated on THIS machine and only its mysql_native_password hash is sent to the API — the plaintext never reaches seekrit or MySQL at rest. The user auto-expires; revoke early with revoke_mysql_lease.", { idempotent: false }, {
|
|
6547
|
-
org: z.string().optional(),
|
|
6548
|
-
target: z.string().describe("target id or name"),
|
|
6549
|
-
user: z.string().optional().describe("user name to create (default: random tmp_ name)"),
|
|
6550
|
-
ttlSeconds: z.number().int().min(60).max(604800).optional().describe("lifetime (default 3600)")
|
|
8058
|
+
org: z$1.string().optional(),
|
|
8059
|
+
target: z$1.string().describe("target id or name"),
|
|
8060
|
+
user: z$1.string().optional().describe("user name to create (default: random tmp_ name)"),
|
|
8061
|
+
ttlSeconds: z$1.number().int().min(60).max(604800).optional().describe("lifetime (default 3600)")
|
|
6551
8062
|
}, async ({ org, target, user, ttlSeconds }) => {
|
|
6552
8063
|
const ctx = getCtx();
|
|
6553
8064
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6573,14 +8084,14 @@ async function runMcpServer(options = {}) {
|
|
|
6573
8084
|
note: "short-lived credential; it auto-expires and the plaintext is not stored anywhere"
|
|
6574
8085
|
};
|
|
6575
8086
|
});
|
|
6576
|
-
tool("list_mysql_leases", "List MySQL/MariaDB leases (the ledger — never secret material).", ro, { org: z.string().optional() }, async ({ org }) => {
|
|
8087
|
+
tool("list_mysql_leases", "List MySQL/MariaDB leases (the ledger — never secret material).", ro, { org: z$1.string().optional() }, async ({ org }) => {
|
|
6577
8088
|
const ctx = getCtx();
|
|
6578
8089
|
const orgRef = await resolveOrg(ctx, org);
|
|
6579
8090
|
return (await ctx.client.listLeases(orgRef.id)).leases.filter((l) => l.provider === "mysql");
|
|
6580
8091
|
});
|
|
6581
8092
|
tool("revoke_mysql_lease", "Revoke a MySQL/MariaDB lease now (drops the user immediately).", destructive, {
|
|
6582
|
-
org: z.string().optional(),
|
|
6583
|
-
leaseId: z.string()
|
|
8093
|
+
org: z$1.string().optional(),
|
|
8094
|
+
leaseId: z$1.string()
|
|
6584
8095
|
}, async ({ org, leaseId }) => {
|
|
6585
8096
|
const ctx = getCtx();
|
|
6586
8097
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6591,9 +8102,9 @@ async function runMcpServer(options = {}) {
|
|
|
6591
8102
|
};
|
|
6592
8103
|
});
|
|
6593
8104
|
tool("configure_project", "Link a directory to an org/app by writing seekrit.json (like `seekrit init`). The environment is chosen by the service token at runtime.", destructive, {
|
|
6594
|
-
org: z.string(),
|
|
6595
|
-
app: z.string(),
|
|
6596
|
-
dir: z.string().optional()
|
|
8105
|
+
org: z$1.string(),
|
|
8106
|
+
app: z$1.string(),
|
|
8107
|
+
dir: z$1.string().optional()
|
|
6597
8108
|
}, async ({ org, app, dir }) => {
|
|
6598
8109
|
const ctx = getCtx();
|
|
6599
8110
|
const orgRef = await resolveOrg(ctx, org);
|
|
@@ -6627,7 +8138,7 @@ async function runMcpServer(options = {}) {
|
|
|
6627
8138
|
* `seekrit mcp`. tsdown bundles the shared server source in at build time, so the
|
|
6628
8139
|
* published package is self-contained and needs no `@seekrit/cli` install.
|
|
6629
8140
|
*/
|
|
6630
|
-
runMcpServer({ version: "0.
|
|
8141
|
+
runMcpServer({ version: "0.10.0" }).catch((err) => {
|
|
6631
8142
|
const message = err instanceof Error ? err.message : String(err);
|
|
6632
8143
|
process.stderr.write(`seekrit-mcp: fatal: ${message}\n`);
|
|
6633
8144
|
process.exit(1);
|