@armoriq/sdk-dev 0.6.3 → 0.6.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/_build_env.d.ts.map +1 -1
- package/dist/_build_env.js +1 -1
- package/dist/_build_env.js.map +1 -1
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +14 -2
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/policy.d.ts +39 -0
- package/dist/cli/commands/policy.d.ts.map +1 -0
- package/dist/cli/commands/policy.js +315 -0
- package/dist/cli/commands/policy.js.map +1 -0
- package/dist/cli/index.d.ts +8 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +93 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/client.d.ts +8 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +22 -8
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/integrations/google_adk.d.ts +10 -0
- package/dist/integrations/google_adk.d.ts.map +1 -1
- package/dist/integrations/google_adk.js +44 -1
- package/dist/integrations/google_adk.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +5 -3
- package/dist/session.js.map +1 -1
- package/package.json +2 -2
- package/dist/integrations/microsoft_copilot.d.ts +0 -84
- package/dist/integrations/microsoft_copilot.d.ts.map +0 -1
- package/dist/integrations/microsoft_copilot.js +0 -126
- package/dist/integrations/microsoft_copilot.js.map +0 -1
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ArmorIQ - Microsoft Copilot Studio integration (TypeScript).
|
|
4
|
-
*
|
|
5
|
-
* Provides the building blocks for hosting an ArmorCopilot webhook
|
|
6
|
-
* receiver that fronts the Microsoft Copilot Studio external security
|
|
7
|
-
* webhook (`POST /analyze-tool-execution`).
|
|
8
|
-
*
|
|
9
|
-
* import {
|
|
10
|
-
* verifyCopilotStudioSignature,
|
|
11
|
-
* translateCopilotStudioPayload,
|
|
12
|
-
* } from '@armoriq/sdk/integrations/microsoft_copilot';
|
|
13
|
-
*
|
|
14
|
-
* The MS side sends each tool invocation with an HMAC-SHA256 signature
|
|
15
|
-
* computed over `<timestamp>.<rawBody>` using a shared secret the tenant
|
|
16
|
-
* configured in Copilot Studio admin. We verify, translate the payload
|
|
17
|
-
* to our internal tool-call shape, then run the request through
|
|
18
|
-
* ArmorIQ policy enforcement.
|
|
19
|
-
*
|
|
20
|
-
* The verifier here is pure crypto: it does not call the backend. The
|
|
21
|
-
* caller is responsible for routing the verified request through the
|
|
22
|
-
* regular SDK enforce path (or future plan-less enforce endpoint) once
|
|
23
|
-
* the signature has been confirmed.
|
|
24
|
-
*/
|
|
25
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26
|
-
if (k2 === undefined) k2 = k;
|
|
27
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
28
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
29
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
30
|
-
}
|
|
31
|
-
Object.defineProperty(o, k2, desc);
|
|
32
|
-
}) : (function(o, m, k, k2) {
|
|
33
|
-
if (k2 === undefined) k2 = k;
|
|
34
|
-
o[k2] = m[k];
|
|
35
|
-
}));
|
|
36
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
37
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
38
|
-
}) : function(o, v) {
|
|
39
|
-
o["default"] = v;
|
|
40
|
-
});
|
|
41
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
42
|
-
var ownKeys = function(o) {
|
|
43
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
44
|
-
var ar = [];
|
|
45
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
46
|
-
return ar;
|
|
47
|
-
};
|
|
48
|
-
return ownKeys(o);
|
|
49
|
-
};
|
|
50
|
-
return function (mod) {
|
|
51
|
-
if (mod && mod.__esModule) return mod;
|
|
52
|
-
var result = {};
|
|
53
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
54
|
-
__setModuleDefault(result, mod);
|
|
55
|
-
return result;
|
|
56
|
-
};
|
|
57
|
-
})();
|
|
58
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.verifyCopilotStudioSignature = verifyCopilotStudioSignature;
|
|
60
|
-
exports.translateCopilotStudioPayload = translateCopilotStudioPayload;
|
|
61
|
-
exports.toCopilotStudioDecision = toCopilotStudioDecision;
|
|
62
|
-
const crypto = __importStar(require("crypto"));
|
|
63
|
-
const MAX_SKEW_SECONDS = 300;
|
|
64
|
-
/**
|
|
65
|
-
* Verify the HMAC signature MS Copilot Studio attaches to a webhook
|
|
66
|
-
* request. Pure crypto — no backend calls. Constant-time comparison.
|
|
67
|
-
*/
|
|
68
|
-
function verifyCopilotStudioSignature(args) {
|
|
69
|
-
if (!args.signature)
|
|
70
|
-
return { ok: false, reason: 'missing-signature' };
|
|
71
|
-
if (args.timestamp === undefined || args.timestamp === null) {
|
|
72
|
-
return { ok: false, reason: 'missing-timestamp' };
|
|
73
|
-
}
|
|
74
|
-
const tsNum = typeof args.timestamp === 'number'
|
|
75
|
-
? args.timestamp
|
|
76
|
-
: Number(args.timestamp);
|
|
77
|
-
if (Number.isNaN(tsNum)) {
|
|
78
|
-
return { ok: false, reason: 'invalid-timestamp' };
|
|
79
|
-
}
|
|
80
|
-
const drift = Math.abs(Date.now() / 1000 - tsNum);
|
|
81
|
-
const maxSkew = args.maxSkewSeconds ?? MAX_SKEW_SECONDS;
|
|
82
|
-
if (drift > maxSkew)
|
|
83
|
-
return { ok: false, reason: 'timestamp-skew' };
|
|
84
|
-
const body = typeof args.rawBody === 'string'
|
|
85
|
-
? args.rawBody
|
|
86
|
-
: args.rawBody.toString('utf8');
|
|
87
|
-
const expected = crypto
|
|
88
|
-
.createHmac('sha256', args.secret)
|
|
89
|
-
.update(`${tsNum}.${body}`)
|
|
90
|
-
.digest('hex');
|
|
91
|
-
const provided = args.signature.startsWith('sha256=')
|
|
92
|
-
? args.signature.slice(7)
|
|
93
|
-
: args.signature;
|
|
94
|
-
if (provided.length !== expected.length) {
|
|
95
|
-
return { ok: false, reason: 'bad-signature' };
|
|
96
|
-
}
|
|
97
|
-
const match = crypto.timingSafeEqual(Buffer.from(provided, 'hex'), Buffer.from(expected, 'hex'));
|
|
98
|
-
return match ? { ok: true } : { ok: false, reason: 'bad-signature' };
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Translate a Copilot Studio webhook payload into the
|
|
102
|
-
* `{ toolName, args, ...meta }` shape ArmorIQ enforce paths expect.
|
|
103
|
-
*/
|
|
104
|
-
function translateCopilotStudioPayload(payload) {
|
|
105
|
-
const toolName = payload.toolDefinition?.name ??
|
|
106
|
-
payload.toolDefinition?.id ??
|
|
107
|
-
'unknown';
|
|
108
|
-
return {
|
|
109
|
-
toolName: String(toolName),
|
|
110
|
-
args: payload.toolInputValues ?? {},
|
|
111
|
-
userMessage: payload.userMessage,
|
|
112
|
-
agentMetadata: payload.agentMetadata,
|
|
113
|
-
userMetadata: payload.userMetadata,
|
|
114
|
-
conversationMetadata: payload.conversationMetadata,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Sentinel mapping: a non-allow enforce result -> Copilot Studio response.
|
|
119
|
-
*/
|
|
120
|
-
function toCopilotStudioDecision(enforced) {
|
|
121
|
-
if (enforced.allowed && enforced.action !== 'block') {
|
|
122
|
-
return { action: 'allow' };
|
|
123
|
-
}
|
|
124
|
-
return { action: 'block', reason: enforced.reason };
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=microsoft_cop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