@@ -538,7 +538,7 @@ export default class OtomiStack {
538538 const app = this . getApp ( id )
539539 this . filterExcludedApp ( app )
540540
541- if ( teamId === 'admin' ) return app
541+ if ( teamId === 'admin' ) return this . filterAppSecrets ( app )
542542 return { id : app . id , enabled : app . enabled }
543543 }
544544
@@ -564,7 +564,8 @@ export default class OtomiStack {
564564
565565 if ( teamId === 'admin' )
566566 return providerSpecificApps . map ( ( app ) => {
567- return { ...app , enabled : Boolean ( app . values ?. enabled ?? true ) } as App
567+ const filtered = this . filterAppSecrets ( app )
568+ return { ...filtered , enabled : Boolean ( app . values ?. enabled ?? true ) } as App
568569 } )
569570
570571 const core = this . getCore ( )
@@ -574,7 +575,10 @@ export default class OtomiStack {
574575 const inTeamApps = ! ! core . teamApps . find ( ( a ) => a . name === app . id )
575576 if ( isShared || inTeamApps ) return app
576577 } )
577- . filter ( ( app ) : app is App => app !== undefined ) // Ensures no `undefined` elements
578+ . filter ( ( app ) : app is App => app !== undefined )
579+
580+ // Filter secrets from team apps
581+ teamApps = teamApps . map ( ( app ) => this . filterAppSecrets ( app ) )
578582
579583 if ( ! picks ) return teamApps
580584
@@ -2328,6 +2332,25 @@ export default class OtomiStack {
23282332 return globalPaths . filter ( ( path ) => path . startsWith ( appPrefix ) ) . map ( ( path ) => path . replace ( appPrefix , '' ) )
23292333 }
23302334
2335+ private filterAppSecrets ( app : App ) : App {
2336+ if ( ! app . values ) return app
2337+
2338+ const globalSecretPaths = getSecretPaths ( )
2339+ const appSecretPaths = this . extractAppSecretPaths ( app . id , globalSecretPaths )
2340+
2341+ if ( appSecretPaths . length === 0 ) return app
2342+
2343+ // Clone the app to avoid mutating original
2344+ const filteredApp = cloneDeep ( app )
2345+
2346+ // Remove each secret path from the values
2347+ appSecretPaths . forEach ( ( secretPath ) => {
2348+ unset ( filteredApp . values , secretPath )
2349+ } )
2350+
2351+ return filteredApp
2352+ }
2353+
23312354 private extractSettingsSecretPaths ( kind : AplKind , globalPaths : string [ ] ) : string [ ] {
23322355 const settingsPrefixMap : Record < string , string > = {
23332356 AplDns : 'dns.' ,
0 commit comments