Skip to content

Commit 628ea49

Browse files
authored
Don't return api keys through the api (#3399)
1 parent 6c30cb9 commit 628ea49

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

src/exports/api.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import * as path from "path"
66
import { getWorkspacePath } from "../utils/path"
77
import { ClineProvider } from "../core/webview/ClineProvider"
88
import { openClineInNewTab } from "../activate/registerCommands"
9-
import { RooCodeSettings, RooCodeEvents, RooCodeEventName, ProviderSettings, ProviderSettingsEntry } from "../schemas"
9+
import {
10+
RooCodeSettings,
11+
RooCodeEvents,
12+
RooCodeEventName,
13+
ProviderSettings,
14+
ProviderSettingsEntry,
15+
isSecretStateKey,
16+
} from "../schemas"
1017
import { IpcOrigin, IpcMessageType, TaskCommandName, TaskEvent } from "../schemas/ipc"
1118

1219
import { RooCodeAPI } from "./interface"
@@ -246,8 +253,10 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
246253

247254
// Global Settings Management
248255

249-
public getConfiguration() {
250-
return this.sidebarProvider.getValues()
256+
public getConfiguration(): RooCodeSettings {
257+
return Object.fromEntries(
258+
Object.entries(this.sidebarProvider.getValues()).filter(([key]) => !isSecretStateKey(key)),
259+
)
251260
}
252261

253262
public async setConfiguration(values: RooCodeSettings) {
@@ -266,10 +275,6 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
266275
return this.sidebarProvider.getProviderProfileEntry(name)
267276
}
268277

269-
public async getProfile(name: string): Promise<ProviderSettings | undefined> {
270-
return this.sidebarProvider.providerSettingsManager.getProfile({ name })
271-
}
272-
273278
public async createProfile(name: string, profile?: ProviderSettings, activate: boolean = true) {
274279
const entry = this.getProfileEntry(name)
275280

src/exports/interface.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@ export interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
120120
*/
121121
getProfileEntry(name: string): ProviderSettingsEntry | undefined
122122

123-
/**
124-
* Returns the profile for a given name
125-
* @param name The name of the profile
126-
* @returns The profile, or undefined if the profile does not exist
127-
*/
128-
getProfile(name: string): Promise<ProviderSettings | undefined>
129-
130123
/**
131124
* Creates a new API configuration profile
132125
* @param name The name of the profile

src/exports/roo-code.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -638,12 +638,6 @@ interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
638638
* @returns The profile entry, or undefined if the profile does not exist
639639
*/
640640
getProfileEntry(name: string): ProviderSettingsEntry | undefined
641-
/**
642-
* Returns the profile for a given name
643-
* @param name The name of the profile
644-
* @returns The profile, or undefined if the profile does not exist
645-
*/
646-
getProfile(name: string): Promise<ProviderSettings | undefined>
647641
/**
648642
* Creates a new API configuration profile
649643
* @param name The name of the profile

0 commit comments

Comments
 (0)