@aria_asi/cli 0.2.15 → 0.2.16
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/sdk/BUNDLED.json
CHANGED
package/package.json
CHANGED
|
@@ -163,6 +163,36 @@ describe('logout()', () => {
|
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
+
// ── 2b. harnessClient shim attaches x-aria-owner when owner-token exists ───
|
|
167
|
+
|
|
168
|
+
describe('harnessClient shim owner header injection', () => {
|
|
169
|
+
it('sends x-aria-owner: true when owner-token exists', async () => {
|
|
170
|
+
const ownerJWT = buildOwnerJWT();
|
|
171
|
+
// Write a real owner-token so the shim's ownerHeaders() picks it up.
|
|
172
|
+
fs.mkdirSync(TEST_ARIA_DIR, { recursive: true });
|
|
173
|
+
fs.writeFileSync(TEST_OWNER_TOKEN_PATH, ownerJWT, { mode: 0o600 });
|
|
174
|
+
|
|
175
|
+
mockFetch.mockResolvedValueOnce({
|
|
176
|
+
ok: true,
|
|
177
|
+
json: async () => ({}),
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Import harnessClient after the mock is set up — homedir() is mocked.
|
|
181
|
+
const { harnessClient } = await import('../harness-client');
|
|
182
|
+
await harnessClient.get('/api/test').catch(() => {});
|
|
183
|
+
|
|
184
|
+
const [_url, init] = mockFetch.mock.calls[0];
|
|
185
|
+
expect(init.headers['x-aria-owner']).toBe('true');
|
|
186
|
+
expect(init.headers['Authorization']).toBe(`Bearer ${ownerJWT}`);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
afterEach(() => {
|
|
190
|
+
// Remove owner-token so other tests start clean.
|
|
191
|
+
try { fs.unlinkSync(TEST_OWNER_TOKEN_PATH); } catch {}
|
|
192
|
+
jest.resetModules(); // Force re-import with fresh module state.
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
166
196
|
// ── 3. ownerMiddleware JWT validation logic (unit-tested inline) ────────────
|
|
167
197
|
// The middleware lives in server.ts (Express runtime). We test the JWT
|
|
168
198
|
// verification logic directly here — same HMAC-HS256 algorithm.
|