fix: redact environment variables exposed by mittwald_stack_list - #76
Open
martin-helmich wants to merge 3 commits into
Open
fix: redact environment variables exposed by mittwald_stack_list#76martin-helmich wants to merge 3 commits into
martin-helmich wants to merge 3 commits into
Conversation
mittwald_stack_list exposed each service's deployedState/pendingState envs verbatim, leaking secrets on a plain discovery call. Redact values by default and add a revealEnvironmentVariables opt-in parameter to get real values. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace the hand-rolled RawStack/RawService/RawServiceState shapes with MittwaldAPIV2.Components.Schemas.ContainerStackResponse/ContainerServiceResponse/ ContainerServiceState from @mittwald/api-client, matching the convention already used in src/types/mittwald/container.ts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mittwald_stack_deploy's description told callers to read the existing stack via a "mittwald_stack_get" tool that doesn't exist (only list, ps, deploy and delete are registered for stack). Point it at mittwald_stack_list instead, which returns full service/volume config for merging. Also add a regression test proving mittwald_stack_ps does not leak service environment variables: formatServices() in ps-cli.ts only whitelists id/name/state/image/ports/stackId/createdAt/updatedAt, so the deployedState/pendingState.envs the underlying API response carries never reaches the tool output. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
martin-helmich
marked this pull request as ready for review
August 31, 2026 10:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mittwald_stack_listechoed each service'sdeployedState/pendingState.envsverbatim, leaking container environment variables (including secrets) on a plain discovery call. Values are now redacted to[REDACTED]by default, with a new opt-inrevealEnvironmentVariablesparameter to get real values when explicitly needed.RawStack/RawService/RawServiceStateshapes with the realMittwaldAPIV2.Components.Schemas.ContainerStackResponse/ContainerServiceResponse/ContainerServiceStatetypes from@mittwald/api-client, matching the convention insrc/types/mittwald/container.ts.mittwald_stack_deploy's description told callers to pre-read the existing stack via amittwald_stack_gettool that doesn't exist (onlylist/ps/deploy/deleteare registered forstack). Pointed it atmittwald_stack_listinstead, which does return full service/volume config for merging.mittwald_stack_psdoes not have the same leak:formatServices()builds its output via an explicit field allowlist rather than passing the raw service object through, soenvsnever gets copied into the response even though the underlying API call returns the sameContainerServiceResponseshape.docs/referencepages (npm run docs:generate), scoped to thestackdomain plus the manifest/openapi files.Test plan
npm run type-checknpx eslinton all touched filesnpx vitest run tests/unit— 33 files / 360 tests passing, including two new test files:tests/unit/handlers/tools/mittwald-cli/stack/list-cli.test.ts(redaction default + opt-in reveal)tests/unit/handlers/tools/mittwald-cli/stack/ps-cli.test.ts(confirms no env var leak)🤖 Generated with Claude Code