Skip to content

Commit 1bf377f

Browse files
committed
Merge remote-tracking branch 'origin/main' into APL-1351
2 parents 3908cc5 + 50b6548 commit 1bf377f

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

src/otomi-stack.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ export default class OtomiStack {
537537
const app = this.getApp(id)
538538
this.filterExcludedApp(app)
539539

540-
if (teamId === 'admin') return app
540+
if (teamId === 'admin') return this.filterAppSecrets(app)
541541
return { id: app.id, enabled: app.enabled }
542542
}
543543

@@ -563,7 +563,8 @@ export default class OtomiStack {
563563

564564
if (teamId === 'admin')
565565
return providerSpecificApps.map((app) => {
566-
return { ...app, enabled: Boolean(app.values?.enabled ?? true) } as App
566+
const filtered = this.filterAppSecrets(app)
567+
return { ...filtered, enabled: Boolean(app.values?.enabled ?? true) } as App
567568
})
568569

569570
const core = this.getCore()
@@ -573,7 +574,10 @@ export default class OtomiStack {
573574
const inTeamApps = !!core.teamApps.find((a) => a.name === app.id)
574575
if (isShared || inTeamApps) return app
575576
})
576-
.filter((app): app is App => app !== undefined) // Ensures no `undefined` elements
577+
.filter((app): app is App => app !== undefined)
578+
579+
// Filter secrets from team apps
580+
teamApps = teamApps.map((app) => this.filterAppSecrets(app))
577581

578582
if (!picks) return teamApps
579583

@@ -2327,6 +2331,25 @@ export default class OtomiStack {
23272331
return globalPaths.filter((path) => path.startsWith(appPrefix)).map((path) => path.replace(appPrefix, ''))
23282332
}
23292333

2334+
private filterAppSecrets(app: App): App {
2335+
if (!app.values) return app
2336+
2337+
const globalSecretPaths = getSecretPaths()
2338+
const appSecretPaths = this.extractAppSecretPaths(app.id, globalSecretPaths)
2339+
2340+
if (appSecretPaths.length === 0) return app
2341+
2342+
// Clone the app to avoid mutating original
2343+
const filteredApp = cloneDeep(app)
2344+
2345+
// Remove each secret path from the values
2346+
appSecretPaths.forEach((secretPath) => {
2347+
unset(filteredApp.values, secretPath)
2348+
})
2349+
2350+
return filteredApp
2351+
}
2352+
23302353
private extractSettingsSecretPaths(kind: AplKind, globalPaths: string[]): string[] {
23312354
const settingsPrefixMap: Record<string, string> = {
23322355
AplDns: 'dns.',

0 commit comments

Comments
 (0)