App secrets export fails / leaks env values when an env-var override is defined (regression from #35859)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Problem
PR #35860 (issue #35859) added env-var / Kubernetes-secret overrides for app secrets: AppsAPIImpl.getSecrets() now overlays env-var tiers onto the resolved AppSecrets.
The export path (AppsAPIImpl.collectSecretsForExport) builds the export from getSecrets(), so when an env-var override is defined for an app:
- the export fails / produces a corrupt file — a locked (tier-1) env secret carries its value in
envVarValuewith anullstoredvalue, which breaks the export round-trip; and - env-sourced values leak into the export file, even though they belong to the target environment, not the exported config.
Expected
Exporting app config must never include env-var overrides. The export should contain only persisted (stored) secrets. A value that is masked by an env override should still export its real stored value.
Fix
collectSecretsForExport reads the persisted secrets blob directly (readStoredSecrets) instead of getSecrets(), so no env value can enter an export. Apps provisioned purely from env (no stored blob — note appKeysByHost() lists env-backed apps) are skipped; the existing empty-result guard still errors when nothing remains to export.
Tests (integration)
- success: stored secret masked by a host env override → export succeeds, round-trip restores the stored value, nothing is
fromEnv. - failure: env-only app (no stored blob) → export throws
IllegalArgumentExceptioninstead of leaking the env value.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with AppsAPIImpl.collectSecretsForExport(), compare its current source with getSecrets() and readStoredSecrets(), and inspect the integration tests described in the issue. Verify that a stored secret masked by a host environment override exports and round-trips its stored value, while an env-only app is skipped and causes the existing empty-result error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100