isa-auth-mcp 0.2.2 → 0.2.3

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -76,7 +76,7 @@ function parseSiwe(message) {
76
76
  var server = new import_server.Server(
77
77
  {
78
78
  name: "isa-auth-mcp",
79
- version: "0.2.2"
79
+ version: "0.2.3"
80
80
  },
81
81
  {
82
82
  capabilities: {
@@ -238,8 +238,8 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
238
238
  };
239
239
  }
240
240
  try {
241
- const header = JSON.parse(Buffer.from(parts[0], "base64").toString("utf8"));
242
- const payload = JSON.parse(Buffer.from(parts[1], "base64").toString("utf8"));
241
+ const header = JSON.parse(Buffer.from(parts[0], "base64url").toString("utf8"));
242
+ const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
243
243
  const now = Math.floor(Date.now() / 1e3);
244
244
  const exp = payload.exp;
245
245
  const isExpired = exp ? exp < now : false;
@@ -248,7 +248,9 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
248
248
  if (secret) {
249
249
  const dataToSign = `${parts[0]}.${parts[1]}`;
250
250
  const expectedSig = crypto.createHmac("sha256", secret).update(dataToSign).digest("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
251
- signatureValid = parts[2] === expectedSig;
251
+ const sigBuf = Buffer.from(parts[2]);
252
+ const expectedBuf = Buffer.from(expectedSig);
253
+ signatureValid = sigBuf.length === expectedBuf.length && crypto.timingSafeEqual(sigBuf, expectedBuf);
252
254
  }
253
255
  return {
254
256
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isa-auth-mcp",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Model Context Protocol (MCP) server for isa-auth, providing AI agents with RBAC permission checking, JWT inspection, Web3 SIWE verification, and auth scaffolding tools",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",