protect-mcp 0.7.4 → 0.7.6

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.d.mts CHANGED
@@ -1683,7 +1683,7 @@ declare const POLICY_PACKS: PolicyPack[];
1683
1683
  declare function getPolicyPack(id: string): PolicyPack | undefined;
1684
1684
  declare function policyPackIds(): string[];
1685
1685
 
1686
- type ConnectorPilotId = 'github' | 'email-gmail' | 'filesystem-git' | 'slack-teams' | 'finance-pms';
1686
+ type ConnectorPilotId = 'github' | 'email-gmail' | 'filesystem-git' | 'slack-teams' | 'finance-pms' | 'nautilus-trader';
1687
1687
  interface ConnectorEnvVar {
1688
1688
  name: string;
1689
1689
  required: boolean;
@@ -1696,6 +1696,11 @@ interface ConnectorAction {
1696
1696
  mode: 'observe' | 'require_approval' | 'deny';
1697
1697
  description: string;
1698
1698
  }
1699
+ interface ConnectorArtifact {
1700
+ path: string;
1701
+ contents: string;
1702
+ executable?: boolean;
1703
+ }
1699
1704
  interface ConnectorPilot {
1700
1705
  id: ConnectorPilotId;
1701
1706
  category: string;
@@ -1709,6 +1714,7 @@ interface ConnectorPilot {
1709
1714
  setup: string[];
1710
1715
  config: Record<string, unknown>;
1711
1716
  cedar: string;
1717
+ artifacts?: ConnectorArtifact[];
1712
1718
  }
1713
1719
  interface InstalledConnectorPilot {
1714
1720
  id: string;
@@ -2166,6 +2172,29 @@ interface ApprovalResult {
2166
2172
  contextHash: string;
2167
2173
  /** Timestamp of approval */
2168
2174
  approvedAt: string;
2175
+ /** On failure, a machine-readable reason (e.g. 'invalid_signature'). */
2176
+ reason?: string;
2177
+ }
2178
+ /**
2179
+ * The registered credential public key, extracted from the COSE_Key at
2180
+ * registration. ES256 keys are an uncompressed P-256 point; EdDSA keys are a
2181
+ * 32-byte Ed25519 public key.
2182
+ */
2183
+ interface CredentialPublicKey {
2184
+ /** COSE algorithm: -7 = ES256 (P-256 / ECDSA), -8 = EdDSA (Ed25519). */
2185
+ alg: -7 | -8;
2186
+ /** Public key, hex. ES256: 65-byte uncompressed point (0x04 || x || y). EdDSA: 32-byte key. */
2187
+ publicKeyHex: string;
2188
+ }
2189
+ interface VerifyAssertionOptions {
2190
+ /** Allowed origin(s) the assertion must come from, e.g. 'https://app.scopeblind.com'. Defaults to https://<rpId>. */
2191
+ expectedOrigin?: string | string[];
2192
+ /** Require the UV (user-verified / biometric or PIN) flag. Default true. */
2193
+ requireUserVerification?: boolean;
2194
+ /** The signCount stored from the previous assertion; a non-increasing counter signals a cloned authenticator. */
2195
+ prevSignCount?: number;
2196
+ /** Override 'now' (ms) for testing. */
2197
+ now?: number;
2169
2198
  }
2170
2199
  /**
2171
2200
  * Create a WebAuthn challenge for approving a tool call.
@@ -2202,17 +2231,22 @@ declare function toCredentialRequestOptions(challenge: ApprovalChallenge, allowC
2202
2231
  };
2203
2232
  };
2204
2233
  /**
2205
- * Verify a WebAuthn assertion from the client.
2206
- *
2207
- * This is a simplified verification that checks the structure
2208
- * and extracts the authenticator data. For production use with
2209
- * full signature verification, use the @simplewebauthn/server package.
2210
- *
2211
- * @param challenge - The original challenge
2212
- * @param assertion - The assertion from navigator.credentials.get()
2213
- * @returns ApprovalResult with verification details
2214
- */
2215
- declare function verifyApprovalAssertion(challenge: ApprovalChallenge, assertion: ApprovalAssertion): ApprovalResult;
2234
+ * Verify a WebAuthn assertion: full, fail-closed verification of a passkey or
2235
+ * security-key co-sign. This proves a SPECIFIC human authorized a SPECIFIC
2236
+ * action with a hardware-held key the host operator cannot exfiltrate. It
2237
+ * checks, in order: challenge freshness; clientDataJSON type, challenge, and
2238
+ * origin; the rpIdHash; the UP (and, by default, UV) flags; the authenticator
2239
+ * signature over authenticatorData || SHA-256(clientDataJSON) using the
2240
+ * registered credential public key (ES256 or EdDSA); and signCount monotonicity
2241
+ * (clone detection) when a previous count is supplied. Any failure returns
2242
+ * valid:false with a reason; nothing is trusted on a partial check.
2243
+ *
2244
+ * @param challenge - the original challenge
2245
+ * @param assertion - the assertion from navigator.credentials.get()
2246
+ * @param credentialPublicKey - the registered public key for assertion.credentialId
2247
+ * @param opts - origin / UV / signCount / clock options
2248
+ */
2249
+ declare function verifyApprovalAssertion(challenge: ApprovalChallenge, assertion: ApprovalAssertion, credentialPublicKey?: CredentialPublicKey, opts?: VerifyAssertionOptions): ApprovalResult;
2216
2250
  /**
2217
2251
  * Create the approval receipt payload for embedding in an Acta receipt.
2218
2252
  *
package/dist/index.d.ts CHANGED
@@ -1683,7 +1683,7 @@ declare const POLICY_PACKS: PolicyPack[];
1683
1683
  declare function getPolicyPack(id: string): PolicyPack | undefined;
1684
1684
  declare function policyPackIds(): string[];
1685
1685
 
1686
- type ConnectorPilotId = 'github' | 'email-gmail' | 'filesystem-git' | 'slack-teams' | 'finance-pms';
1686
+ type ConnectorPilotId = 'github' | 'email-gmail' | 'filesystem-git' | 'slack-teams' | 'finance-pms' | 'nautilus-trader';
1687
1687
  interface ConnectorEnvVar {
1688
1688
  name: string;
1689
1689
  required: boolean;
@@ -1696,6 +1696,11 @@ interface ConnectorAction {
1696
1696
  mode: 'observe' | 'require_approval' | 'deny';
1697
1697
  description: string;
1698
1698
  }
1699
+ interface ConnectorArtifact {
1700
+ path: string;
1701
+ contents: string;
1702
+ executable?: boolean;
1703
+ }
1699
1704
  interface ConnectorPilot {
1700
1705
  id: ConnectorPilotId;
1701
1706
  category: string;
@@ -1709,6 +1714,7 @@ interface ConnectorPilot {
1709
1714
  setup: string[];
1710
1715
  config: Record<string, unknown>;
1711
1716
  cedar: string;
1717
+ artifacts?: ConnectorArtifact[];
1712
1718
  }
1713
1719
  interface InstalledConnectorPilot {
1714
1720
  id: string;
@@ -2166,6 +2172,29 @@ interface ApprovalResult {
2166
2172
  contextHash: string;
2167
2173
  /** Timestamp of approval */
2168
2174
  approvedAt: string;
2175
+ /** On failure, a machine-readable reason (e.g. 'invalid_signature'). */
2176
+ reason?: string;
2177
+ }
2178
+ /**
2179
+ * The registered credential public key, extracted from the COSE_Key at
2180
+ * registration. ES256 keys are an uncompressed P-256 point; EdDSA keys are a
2181
+ * 32-byte Ed25519 public key.
2182
+ */
2183
+ interface CredentialPublicKey {
2184
+ /** COSE algorithm: -7 = ES256 (P-256 / ECDSA), -8 = EdDSA (Ed25519). */
2185
+ alg: -7 | -8;
2186
+ /** Public key, hex. ES256: 65-byte uncompressed point (0x04 || x || y). EdDSA: 32-byte key. */
2187
+ publicKeyHex: string;
2188
+ }
2189
+ interface VerifyAssertionOptions {
2190
+ /** Allowed origin(s) the assertion must come from, e.g. 'https://app.scopeblind.com'. Defaults to https://<rpId>. */
2191
+ expectedOrigin?: string | string[];
2192
+ /** Require the UV (user-verified / biometric or PIN) flag. Default true. */
2193
+ requireUserVerification?: boolean;
2194
+ /** The signCount stored from the previous assertion; a non-increasing counter signals a cloned authenticator. */
2195
+ prevSignCount?: number;
2196
+ /** Override 'now' (ms) for testing. */
2197
+ now?: number;
2169
2198
  }
2170
2199
  /**
2171
2200
  * Create a WebAuthn challenge for approving a tool call.
@@ -2202,17 +2231,22 @@ declare function toCredentialRequestOptions(challenge: ApprovalChallenge, allowC
2202
2231
  };
2203
2232
  };
2204
2233
  /**
2205
- * Verify a WebAuthn assertion from the client.
2206
- *
2207
- * This is a simplified verification that checks the structure
2208
- * and extracts the authenticator data. For production use with
2209
- * full signature verification, use the @simplewebauthn/server package.
2210
- *
2211
- * @param challenge - The original challenge
2212
- * @param assertion - The assertion from navigator.credentials.get()
2213
- * @returns ApprovalResult with verification details
2214
- */
2215
- declare function verifyApprovalAssertion(challenge: ApprovalChallenge, assertion: ApprovalAssertion): ApprovalResult;
2234
+ * Verify a WebAuthn assertion: full, fail-closed verification of a passkey or
2235
+ * security-key co-sign. This proves a SPECIFIC human authorized a SPECIFIC
2236
+ * action with a hardware-held key the host operator cannot exfiltrate. It
2237
+ * checks, in order: challenge freshness; clientDataJSON type, challenge, and
2238
+ * origin; the rpIdHash; the UP (and, by default, UV) flags; the authenticator
2239
+ * signature over authenticatorData || SHA-256(clientDataJSON) using the
2240
+ * registered credential public key (ES256 or EdDSA); and signCount monotonicity
2241
+ * (clone detection) when a previous count is supplied. Any failure returns
2242
+ * valid:false with a reason; nothing is trusted on a partial check.
2243
+ *
2244
+ * @param challenge - the original challenge
2245
+ * @param assertion - the assertion from navigator.credentials.get()
2246
+ * @param credentialPublicKey - the registered public key for assertion.credentialId
2247
+ * @param opts - origin / UV / signCount / clock options
2248
+ */
2249
+ declare function verifyApprovalAssertion(challenge: ApprovalChallenge, assertion: ApprovalAssertion, credentialPublicKey?: CredentialPublicKey, opts?: VerifyAssertionOptions): ApprovalResult;
2216
2250
  /**
2217
2251
  * Create the approval receipt payload for embedding in an Acta receipt.
2218
2252
  *