@meru2802/aux-server 1.0.23 → 1.0.25

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.
@@ -18,7 +18,7 @@ class HealthController extends BaseController_1.BaseController {
18
18
  this.status = (req, res) => {
19
19
  const response = {
20
20
  service: "aux-server",
21
- version: "1.0.22",
21
+ version: "1.0.25",
22
22
  meshCentral: {
23
23
  connected: this.isWebSocketConnected,
24
24
  server: this.meshServer,
@@ -1 +1 @@
1
- {"version":3,"file":"authMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/authMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,qBAAa,cAAe,SAAQ,cAAc;gBACpC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,QAAQ,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,UAgLhE;IAEK,WAAW,GAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,YAAY,KACjB,OAAO,CAAC,IAAI,CAAC,CAmFd;CACH"}
1
+ {"version":3,"file":"authMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/authMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,qBAAa,cAAe,SAAQ,cAAc;gBACpC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,QAAQ,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,UAuLhE;IAEK,WAAW,GAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,YAAY,KACjB,OAAO,CAAC,IAAI,CAAC,CAmFd;CACH"}
@@ -45,10 +45,16 @@ class AuthMiddleware extends BaseMiddleware_1.BaseMiddleware {
45
45
  constructor(serviceContainer) {
46
46
  super(serviceContainer);
47
47
  this.hmacAuth = (req, res, next) => {
48
+ var _a;
48
49
  try {
49
50
  const signature = req.headers["x-hmac-signature"];
50
51
  const timestamp = req.headers["x-hmac-timestamp"];
51
52
  const nonce = req.headers["x-hmac-nonce"];
53
+ const hostname = ((_a = req.headers.host) === null || _a === void 0 ? void 0 : _a.trim()) || req.hostname.trim();
54
+ const rawHostname = req.headers.host || req.hostname;
55
+ console.log(`Raw hostname bytes: ${Buffer.from(rawHostname).toString("hex")}`);
56
+ console.log(`Raw hostname length: ${rawHostname.length}`);
57
+ console.log(`Raw hostname charCodes: ${[...rawHostname].map((c) => c.charCodeAt(0)).join(", ")}`);
52
58
  if (!signature || !timestamp || !nonce) {
53
59
  const unauthorizedResponse = {
54
60
  error: "UnauthorizedException",
@@ -127,8 +133,6 @@ class AuthMiddleware extends BaseMiddleware_1.BaseMiddleware {
127
133
  return;
128
134
  }
129
135
  console.log(`HMAC Body hash: ${bodyHash}`);
130
- console.log(`HMAC req.hostname: "${req.hostname}"`);
131
- console.log(`HMAC req.headers.host: "${req.headers.host}"`);
132
136
  let message;
133
137
  try {
134
138
  message = [
@@ -136,7 +140,7 @@ class AuthMiddleware extends BaseMiddleware_1.BaseMiddleware {
136
140
  req.originalUrl,
137
141
  timestamp,
138
142
  nonce,
139
- `content-type:application/json;host:${req.hostname}`,
143
+ `content-type:application/json;host:${hostname}`,
140
144
  bodyHash,
141
145
  ].join("\n");
142
146
  console.log(`HMAC Message: ${message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meru2802/aux-server",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Nexus EPM auxillary server to facilitate additional functionality required by Scogo Iceberg",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -23,8 +23,8 @@
23
23
  "@types/ws": "^8.5.12",
24
24
  "eslint": "^9.26.0",
25
25
  "typescript": "5.8.2",
26
- "@repo/typescript-config": "0.0.0",
27
- "@repo/eslint-config": "0.0.0"
26
+ "@repo/eslint-config": "0.0.0",
27
+ "@repo/typescript-config": "0.0.0"
28
28
  },
29
29
  "keywords": [],
30
30
  "author": "meru2802",