@amerged/ohmyhost-mcp 0.1.49 → 0.1.52
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/README.md +1 -1
- package/dist/{chunk-GLPFLQD6.js → chunk-EAD7RRAF.js} +5 -5
- package/dist/index.js +1 -1
- package/dist/stdio-main.js +555 -5
- package/package.json +1 -1
- package/src/apps/mcp/package.json +1 -1
- package/src/apps/mcp/src/local-client.ts +5 -0
- package/src/apps/mcp/src/local-server.ts +307 -1
- package/src/apps/product-cli/package.json +1 -1
- package/src/apps/product-cli/src/cli.ts +22 -0
- package/src/apps/product-cli/src/command.ts +235 -0
- package/src/apps/product-cli/src/composition.ts +7 -2
- package/src/apps/product-cli/src/index.ts +1 -0
- package/src/apps/product-cli/src/native-auth.ts +172 -0
- package/src/apps/product-cli/src/product-api.ts +6 -0
- package/src/packages/agent-skills/src/generated-skill-resources.ts +4 -4
- package/src/packages/contracts/package.json +10 -0
- package/src/packages/contracts/src/framework-admission.ts +5 -0
- package/src/packages/contracts/src/framework-source-rules.ts +9 -0
- package/src/packages/contracts/src/index.ts +1 -1
- package/src/packages/contracts/src/native-auth.ts +158 -0
- package/src/packages/contracts/src/previews.ts +179 -0
- package/src/packages/contracts/src/problem-policy.ts +8 -1
- package/src/packages/contracts/src/project-exports.ts +11 -3
- package/src/packages/sdk-ts/package.json +1 -1
- package/src/packages/sdk-ts/src/generated/index.ts +81 -0
- package/src/packages/sdk-ts/src/generated/sdk.gen.ts +604 -0
- package/src/packages/sdk-ts/src/generated/types.gen.ts +995 -4
- package/src/packages/workos-auth-contracts/src/webhooks.ts +30 -13
|
@@ -16,6 +16,7 @@ export interface VerifyWorkosWebhookInput {
|
|
|
16
16
|
readonly rawBody: Uint8Array;
|
|
17
17
|
readonly signatureHeader: string;
|
|
18
18
|
readonly secret: string;
|
|
19
|
+
readonly additionalSecrets?: readonly string[];
|
|
19
20
|
readonly now: Date;
|
|
20
21
|
readonly toleranceMs: number;
|
|
21
22
|
readonly maximumBodyBytes: number;
|
|
@@ -66,9 +67,20 @@ export const parseWorkosWebhookEnvelope = (value: unknown): WorkosWebhookEnvelop
|
|
|
66
67
|
export const verifyAndParseWorkosWebhook = async (
|
|
67
68
|
input: VerifyWorkosWebhookInput,
|
|
68
69
|
): Promise<WorkosWebhookEnvelope> => {
|
|
69
|
-
if (
|
|
70
|
+
if (
|
|
71
|
+
typeof input.secret !== "string" ||
|
|
72
|
+
input.secret.length === 0 ||
|
|
73
|
+
(input.additionalSecrets !== undefined &&
|
|
74
|
+
(!Array.isArray(input.additionalSecrets) ||
|
|
75
|
+
input.additionalSecrets.length > 1 ||
|
|
76
|
+
(input.additionalSecrets.length === 1 &&
|
|
77
|
+
(!Object.hasOwn(input.additionalSecrets, 0) ||
|
|
78
|
+
typeof input.additionalSecrets[0] !== "string" ||
|
|
79
|
+
input.additionalSecrets[0].length === 0))))
|
|
80
|
+
) {
|
|
70
81
|
throw new WorkosContractError("invalid_webhook_secret", "Webhook secret is invalid");
|
|
71
82
|
}
|
|
83
|
+
const secrets = [...new Set([input.secret, ...(input.additionalSecrets ?? [])])];
|
|
72
84
|
if (
|
|
73
85
|
!Number.isSafeInteger(input.maximumBodyBytes) ||
|
|
74
86
|
input.maximumBodyBytes <= 0 ||
|
|
@@ -94,11 +106,11 @@ export const verifyAndParseWorkosWebhook = async (
|
|
|
94
106
|
const message = new Uint8Array(prefix.byteLength + input.rawBody.byteLength);
|
|
95
107
|
message.set(prefix);
|
|
96
108
|
message.set(input.rawBody, prefix.byteLength);
|
|
97
|
-
const importKey = async () => {
|
|
109
|
+
const importKey = async (secret: string) => {
|
|
98
110
|
try {
|
|
99
111
|
return await globalThis.crypto.subtle.importKey(
|
|
100
112
|
"raw",
|
|
101
|
-
new TextEncoder().encode(
|
|
113
|
+
new TextEncoder().encode(secret),
|
|
102
114
|
{ name: "HMAC", hash: "SHA-256" },
|
|
103
115
|
false,
|
|
104
116
|
["verify"],
|
|
@@ -107,21 +119,26 @@ export const verifyAndParseWorkosWebhook = async (
|
|
|
107
119
|
throw new WorkosContractError("invalid_webhook_secret", "Webhook secret is invalid");
|
|
108
120
|
}
|
|
109
121
|
};
|
|
110
|
-
const
|
|
122
|
+
const keys = await Promise.all(secrets.map(importKey));
|
|
111
123
|
let valid = false;
|
|
112
|
-
for (const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
124
|
+
for (const key of keys) {
|
|
125
|
+
for (const expectedHexDigest of signature.signatures) {
|
|
126
|
+
const expected = Uint8Array.from(expectedHexDigest.match(/.{2}/gu) ?? [], (byte) =>
|
|
127
|
+
Number.parseInt(byte, 16),
|
|
128
|
+
);
|
|
129
|
+
try {
|
|
130
|
+
valid = (await globalThis.crypto.subtle.verify("HMAC", key, expected, message)) || valid;
|
|
131
|
+
} catch {
|
|
132
|
+
// Only a verified signature can change the accumulated result.
|
|
133
|
+
}
|
|
120
134
|
}
|
|
121
135
|
}
|
|
122
136
|
if (!valid)
|
|
123
137
|
throw new WorkosContractError("invalid_webhook_signature", "Webhook signature is invalid");
|
|
138
|
+
// Parse the authenticated snapshot, never caller-owned bytes which may change across awaits.
|
|
124
139
|
return parseWorkosWebhookEnvelope(
|
|
125
|
-
parseJsonObject(
|
|
140
|
+
parseJsonObject(
|
|
141
|
+
new TextDecoder("utf-8", { fatal: true }).decode(message.subarray(prefix.byteLength)),
|
|
142
|
+
),
|
|
126
143
|
);
|
|
127
144
|
};
|