Skip to content

Commit 3716969

Browse files
authored
fix(status): resolve gateway auth secrets for deep audit
Resolve gateway auth SecretRef targets in status deep audit. The static secret target coverage now includes gateway auth and remote token/password keys for both status and security audit scans. Focused status/secret-target tests passed, Auto Review reported no actionable findings, and CI is running on rebased head 41b052a. Fixes #87815
1 parent 909c24e commit 3716969

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

src/cli/command-secret-targets.import.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ describe("command secret targets module import", () => {
165165
expect(targets.has("channels.discord.token")).toBe(false);
166166
expect(targets.has("channels.telegram.gatewayToken")).toBe(false);
167167
expect(targets.has("channels.telegram.gatewayTokenRef")).toBe(false);
168+
expect(targets.has("gateway.auth.token")).toBe(true);
169+
expect(targets.has("gateway.auth.password")).toBe(true);
170+
expect(targets.has("gateway.remote.token")).toBe(true);
171+
expect(targets.has("gateway.remote.password")).toBe(true);
168172
expect(targets.has("agents.defaults.memorySearch.remote.apiKey")).toBe(true);
169173
const pluginCall = listReadOnlyChannelPluginsForConfig.mock.calls[0] as unknown as
170174
| [unknown, { includePersistedAuthState?: boolean }]
@@ -202,6 +206,10 @@ describe("command secret targets module import", () => {
202206
);
203207

204208
expect(targets.has("agents.defaults.memorySearch.remote.apiKey")).toBe(true);
209+
expect(targets.has("gateway.auth.token")).toBe(true);
210+
expect(targets.has("gateway.auth.password")).toBe(true);
211+
expect(targets.has("gateway.remote.token")).toBe(true);
212+
expect(targets.has("gateway.remote.password")).toBe(true);
205213
expect(targets.has("channels.telegram.botToken")).toBe(false);
206214
expect(listReadOnlyChannelPluginsForConfig).not.toHaveBeenCalled();
207215
expect(listSecretTargetRegistryEntries).not.toHaveBeenCalled();

src/cli/command-secret-targets.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ import {
249249
getQrRemoteCommandSecretTargetIds,
250250
getScopedChannelsCommandSecretTargets,
251251
getSecurityAuditCommandSecretTargetIds,
252+
getStatusCommandSecretTargetIds,
252253
} from "./command-secret-targets.js";
253254

254255
describe("command secret target ids", () => {
@@ -273,6 +274,20 @@ describe("command secret target ids", () => {
273274
expect(ids.has("channels.discord.token")).toBe(false);
274275
});
275276

277+
it("includes gateway auth targets for status command scans", () => {
278+
const ids = getStatusCommandSecretTargetIds(undefined, undefined, {
279+
includeChannelTargets: false,
280+
});
281+
282+
expect(ids.has("gateway.auth.token")).toBe(true);
283+
expect(ids.has("gateway.auth.password")).toBe(true);
284+
expect(ids.has("gateway.remote.token")).toBe(true);
285+
expect(ids.has("gateway.remote.password")).toBe(true);
286+
expect(ids.has("agents.defaults.memorySearch.remote.apiKey")).toBe(true);
287+
expect(ids.has("agents.list[].memorySearch.remote.apiKey")).toBe(true);
288+
expect(ids.has("channels.discord.token")).toBe(false);
289+
});
290+
276291
it("scopes capability web search commands to search credential surfaces only", () => {
277292
const ids = getCapabilityWebSearchCommandSecretTargetIds();
278293
expect(ids.has("tools.web.search.apiKey")).toBe(true);

src/cli/command-secret-targets.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,18 @@ const STATIC_TTS_TARGET_IDS = [
5454
"agents.list[].tts.providers.*.apiKey",
5555
"messages.tts.providers.*.apiKey",
5656
] as const;
57-
const STATIC_STATUS_TARGET_IDS = [
58-
"agents.defaults.memorySearch.remote.apiKey",
59-
"agents.list[].memorySearch.remote.apiKey",
60-
] as const;
61-
const STATIC_SECURITY_AUDIT_TARGET_IDS = [
57+
const STATIC_GATEWAY_AUTH_TARGET_IDS = [
6258
"gateway.auth.token",
6359
"gateway.auth.password",
6460
"gateway.remote.token",
6561
"gateway.remote.password",
6662
] as const;
63+
const STATIC_STATUS_TARGET_IDS = [
64+
...STATIC_GATEWAY_AUTH_TARGET_IDS,
65+
"agents.defaults.memorySearch.remote.apiKey",
66+
"agents.list[].memorySearch.remote.apiKey",
67+
] as const;
68+
const STATIC_SECURITY_AUDIT_TARGET_IDS = [...STATIC_GATEWAY_AUTH_TARGET_IDS] as const;
6769

6870
function idsByPrefix(prefixes: readonly string[]): string[] {
6971
return listSecretTargetRegistryEntries()

0 commit comments

Comments
 (0)