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 +1 -1
- package/dist/hook-settings.d.ts +1 -0
- package/dist/hook-settings.js +8 -7
- package/dist/hooks.js +3 -2
- package/dist/server.js +4 -3
- package/dist/session.js +1 -1
- package/package.json +1 -1
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: '
|
|
45
|
+
defaultPermissionMode: 'default',
|
|
46
46
|
stallThresholdMs: computeStallThreshold(),
|
|
47
47
|
sseMaxConnections: 100,
|
|
48
48
|
sseMaxPerIp: 10,
|
package/dist/hook-settings.d.ts
CHANGED
package/dist/hook-settings.js
CHANGED
|
@@ -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
|
|
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
|
|
132
|
-
const hookSecret = req.
|
|
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.
|
|
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 ?? '
|
|
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
|
-
?? '
|
|
513
|
+
?? 'default';
|
|
514
514
|
let settingsPatched = false;
|
|
515
515
|
if (effectivePermissionMode !== 'bypassPermissions') {
|
|
516
516
|
settingsPatched = await neutralizeBypassPermissions(opts.workDir, effectivePermissionMode);
|