File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ import { Mode, modes } from "../../shared/modes"
66import { telemetryService } from "../../services/telemetry/TelemetryService"
77
88const providerSettingsWithIdSchema = providerSettingsSchema . extend ( { id : z . string ( ) . optional ( ) } )
9+ const discriminatedProviderSettingsWithIdSchema = providerSettingsSchemaDiscriminated . and (
10+ z . object ( { id : z . string ( ) . optional ( ) } ) ,
11+ )
912
1013type ProviderSettingsWithId = z . infer < typeof providerSettingsWithIdSchema >
1114
@@ -385,7 +388,15 @@ export class ProviderSettingsManager {
385388
386389 public async export ( ) {
387390 try {
388- return await this . lock ( async ( ) => providerProfilesSchema . parse ( await this . load ( ) ) )
391+ return await this . lock ( async ( ) => {
392+ const profiles = providerProfilesSchema . parse ( await this . load ( ) )
393+ const configs = profiles . apiConfigs
394+ for ( const name in configs ) {
395+ // Avoid leaking properties from other providers.
396+ configs [ name ] = discriminatedProviderSettingsWithIdSchema . parse ( configs [ name ] )
397+ }
398+ return profiles
399+ } )
389400 } catch ( error ) {
390401 throw new Error ( `Failed to export provider profiles: ${ error } ` )
391402 }
You can’t perform that action at this time.
0 commit comments