aegis-bridge 2.15.7 → 2.16.0

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/config.js CHANGED
@@ -42,7 +42,7 @@ const defaults = {
42
42
  tgTopicTtlMs: 24 * 60 * 60 * 1000,
43
43
  webhooks: [],
44
44
  defaultSessionEnv: {},
45
- defaultPermissionMode: 'bypassPermissions',
45
+ defaultPermissionMode: 'default',
46
46
  stallThresholdMs: computeStallThreshold(),
47
47
  sseMaxConnections: 100,
48
48
  sseMaxPerIp: 10,
@@ -32,6 +32,7 @@ export type HttpHookEvent = typeof HTTP_HOOK_EVENTS[number];
32
32
  interface HttpHookConfig {
33
33
  type: 'http';
34
34
  url: string;
35
+ headers?: Record<string, string>;
35
36
  }
36
37
  /** Shape of the `hooks` section in CC settings.json. */
37
38
  export interface HookSettings {
@@ -129,15 +129,16 @@ export function generateHookSettings(baseUrl, sessionId, hookSecret) {
129
129
  const hooks = {};
130
130
  const callbackBaseUrl = normalizeHookBaseUrl(baseUrl);
131
131
  for (const event of HTTP_HOOK_EVENTS) {
132
- const secretParam = hookSecret ? `&secret=${hookSecret}` : '';
132
+ const hookConfig = {
133
+ type: 'http',
134
+ url: `${callbackBaseUrl}/v1/hooks/${event}?sessionId=${sessionId}`,
135
+ };
136
+ if (hookSecret) {
137
+ hookConfig.headers = { 'X-Hook-Secret': hookSecret };
138
+ }
133
139
  hooks[event] = [
134
140
  {
135
- hooks: [
136
- {
137
- type: 'http',
138
- url: `${callbackBaseUrl}/v1/hooks/${event}?sessionId=${sessionId}${secretParam}`,
139
- },
140
- ],
141
+ hooks: [hookConfig],
141
142
  },
142
143
  ];
143
144
  }
package/dist/hooks.js CHANGED
@@ -128,8 +128,9 @@ export function registerHookRoutes(app, deps) {
128
128
  if (!session) {
129
129
  return reply.status(404).send({ error: `Session ${sessionId} not found` });
130
130
  }
131
- // Issue #629: Validate per-session hook secret (defense in depth also checked in auth middleware)
132
- const hookSecret = req.query?.secret;
131
+ // Issue #629/#1131: Validate hook secret from X-Hook-Secret header (query param fallback)
132
+ const hookSecret = req.headers['x-hook-secret']
133
+ || req.query?.secret;
133
134
  if (session.hookSecret && hookSecret !== session.hookSecret) {
134
135
  return reply.status(401).send({ error: 'Unauthorized — invalid hook secret' });
135
136
  }
package/dist/server.js CHANGED
@@ -266,8 +266,9 @@ function setupAuth(authManager) {
266
266
  if (hookSessionId) {
267
267
  const session = sessions.getSession(hookSessionId);
268
268
  if (session) {
269
- // Issue #629: Validate hook secret from query param
270
- const hookSecret = req.query?.secret;
269
+ // Issue #629/#1131: Validate hook secret from X-Hook-Secret header (query param fallback)
270
+ const hookSecret = req.headers['x-hook-secret']
271
+ || req.query?.secret;
271
272
  if (!hookSecret || hookSecret !== session.hookSecret) {
272
273
  return reply.status(401).send({ error: 'Unauthorized — invalid hook secret' });
273
274
  }
@@ -869,7 +870,7 @@ async function spawnChildHandler(req, reply) {
869
870
  if (typeof safeChildWorkDir === 'object') {
870
871
  return reply.status(400).send({ error: `Invalid workDir: ${safeChildWorkDir.error}`, code: safeChildWorkDir.code });
871
872
  }
872
- const childPermMode = permissionMode ?? parent.permissionMode ?? 'bypassPermissions';
873
+ const childPermMode = permissionMode ?? parent.permissionMode ?? 'default';
873
874
  const childSession = await sessions.createSession({ workDir: safeChildWorkDir, name: childName, parentId, permissionMode: childPermMode });
874
875
  let promptDelivery;
875
876
  if (prompt) {
package/dist/session.js CHANGED
@@ -510,7 +510,7 @@ export class SessionManager {
510
510
  const effectivePermissionMode = opts.permissionMode
511
511
  ?? (opts.autoApprove === true ? 'bypassPermissions' : opts.autoApprove === false ? 'default' : undefined)
512
512
  ?? this.config.defaultPermissionMode
513
- ?? 'bypassPermissions';
513
+ ?? 'default';
514
514
  let settingsPatched = false;
515
515
  if (effectivePermissionMode !== 'bypassPermissions') {
516
516
  settingsPatched = await neutralizeBypassPermissions(opts.workDir, effectivePermissionMode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aegis-bridge",
3
- "version": "2.15.7",
3
+ "version": "2.16.0",
4
4
  "type": "module",
5
5
  "description": "Orchestrate Claude Code sessions via API. Create, brief, monitor, refine, ship.",
6
6
  "main": "dist/server.js",