Skip to content

fix: redact compose service response secrets - #5

Merged
agentHits merged 1 commit into
AgentHits-Devfrom
fix/redact-compose-response-secrets
Oct 6, 2026
Merged

agentHits merged 1 commit into
AgentHits-Devfrom
fix/redact-compose-response-secrets

Conversation

@agentHits

Copy link
Copy Markdown
Collaborator

What is this PR about?

Ports 9b80df3a0 fix: redact compose service response secrets, which only existed on the deleted agentHits-prod release line (local copy backup/agentHits-Prod-before-delete-20261006). The 7da5612c0 sync replaced compose.ts with the AgentHits-Dev version, so the fix never reached AgentHits-Dev.

On AgentHits-Dev, compose router responses already redact env and git provider secrets. But compose.one, create, update, delete, deployTemplate and move still returned two fields to anyone with read access to the service:

  • customGitUrl with embedded credentials (https://token@host/...);
  • composeFile with inline secrets.

The environment router already redacts both fields.

Changes

  • A new redactComposeSecrets helper in the compose router is used by all six responses. It redacts env and git provider secrets as before, and now also masks customGitUrl credentials (redactSensitiveText).
  • composeFile is always redacted in mutation responses; the UI only reads composeId from them.
  • In compose.one, composeFile is redacted only for callers without envVars.read. The compose file editor loads the file from compose.one, so a verbatim port would show __DOKPLOY_REDACTED_SECRET__ in the editor. The static owner, admin and member roles all have envVars.read, so only custom roles without it get the placeholder.
  • service-environment-reveal.test.ts covers compose.one with and without envVars.read, and the update response, including the placeholder round trip on save.

Behaviour changes

  • A credentialed custom Git URL now shows a placeholder instead of the token. Saving the form unchanged keeps the stored URL (the existing preserveSecretPlaceholderFields path). To change the URL, paste it in full; edits around the placeholder are discarded.
  • Out of scope: getConvertedCompose (requires service.create) still returns the compose file, and application.one still returns a raw customGitUrl.

Checklist

  • Dedicated branch fix/redact-compose-response-secrets from origin/AgentHits-Dev (e52547d4d).
  • bun run test -- --run service-environment-reveal: 6 passed. Against the old compose.ts, the 3 compose tests fail.
  • Related suites (__test__/security/, the compose router importers, the environment secret boundary): 18 files / 175 tests passed.
  • bun run test -- --run: 232 files passed. Only deploy/application.real.test.ts fails, because no local Docker socket is available.
  • bun run typecheck in apps/dokploy: passed.
  • Biome on the changed files and git diff --check: passed.
  • The UI was not checked in a browser.

🤖 Generated with Claude Code

Что:
- Перенесен фикс 9b80df3 с удаленной ветки agentHits-prod (локальная копия backup/agentHits-Prod-before-delete-20261006): при синхронизации 7da5612 он выпал и в AgentHits-Dev не попал.
- В compose router добавлен helper redactComposeSecrets для ответов create, one, update, delete, deployTemplate и move: env и секреты git provider скрываются как раньше, креды в customGitUrl теперь маскируются.
- composeFile в ответах мутаций скрывается всегда, а в compose.one только для пользователей без права envVars.read: редактор compose-файла в UI берет файл из compose.one, поэтому дословный перенос сломал бы его.
- Тест service-environment-reveal проверяет compose.one с правом envVars.read и без него, а также ответ update.
Зачем:
- compose.one, create и update отдавали customGitUrl с токеном и composeFile с inline-секретами всем, у кого есть доступ к сервису на чтение, хотя роутер environment эти поля уже скрывал.
Риски:
- customGitUrl с кредами в UI и API теперь показывается с placeholder вместо токена. Сохранение без правки оставляет прежний URL; чтобы сменить URL, его нужно вставить целиком, иначе сервер оставит старое значение.
- Роли без envVars.read (бывают только среди custom roles) видят placeholder вместо compose-файла; getConvertedCompose (требует service.create) по-прежнему возвращает файл, это вне scope.
Проверки:
- Команды и результаты: `bun install --frozen-lockfile` в отдельном worktree - passed; в apps/dokploy `bun run test -- --run service-environment-reveal` - passed (1 файл / 6 тестов), контрольный прогон того же теста на compose.ts из origin/AgentHits-Dev - 3 compose-теста упали, как и ожидалось; `bun run test -- --run __test__/security/ __test__/compose/provider-status.test.ts __test__/deployment/cloud-deploy-idempotency.test.ts __test__/git-provider/deploy-source-credential-access.test.ts __test__/placement/deploy-target-boundary.test.ts __test__/placement/service-create-environment-boundary.test.ts __test__/environment/environment-secret-boundary.test.ts` - passed (18 файлов / 175 тестов); полный набор `bun run test -- --run` - 232 файла passed, 1 skipped, упал только __test__/deploy/application.real.test.ts (4 теста реальной сборки, connect ECONNREFUSED /Users/agent/.docker/run/docker.sock); `bun run typecheck` - passed; `./node_modules/.bin/biome check` по двум измененным файлам - passed; `git diff --check` - passed.
- Ограничения: application.real.test.ts требует локальный Docker socket и роутер compose не импортирует; UI в браузере не проверялся; push и деплой не выполнялись.

What:
- Ported fix 9b80df3 from the deleted agentHits-prod branch (local copy backup/agentHits-Prod-before-delete-20261006): the 7da5612 sync dropped it, so it never reached AgentHits-Dev.
- Added a redactComposeSecrets helper to the compose router for the create, one, update, delete, deployTemplate, and move responses: env and git provider secrets stay redacted as before, and customGitUrl credentials are now masked.
- composeFile is always redacted in mutation responses, while compose.one redacts it only for users without the envVars.read permission: the UI compose file editor reads the file from compose.one, so a verbatim port would break it.
- The service-environment-reveal test covers compose.one with and without envVars.read, plus the update response.
Why:
- compose.one, create, and update returned customGitUrl with its token and composeFile with inline secrets to anyone with read access to the service, even though the environment router already redacted these fields.
Risks:
- A credentialed customGitUrl now shows a placeholder instead of the token in the UI and API. Saving without edits keeps the stored URL; to change the URL it must be pasted in full, otherwise the server keeps the old value.
- Roles without envVars.read (only possible with custom roles) see a placeholder instead of the compose file; getConvertedCompose (requires service.create) still returns the file, which is out of scope.
Checks:
- Commands and results: `bun install --frozen-lockfile` in a separate worktree - passed; in apps/dokploy `bun run test -- --run service-environment-reveal` - passed (1 file / 6 tests), a control run of the same test against compose.ts from origin/AgentHits-Dev - 3 compose tests failed as expected; `bun run test -- --run __test__/security/ __test__/compose/provider-status.test.ts __test__/deployment/cloud-deploy-idempotency.test.ts __test__/git-provider/deploy-source-credential-access.test.ts __test__/placement/deploy-target-boundary.test.ts __test__/placement/service-create-environment-boundary.test.ts __test__/environment/environment-secret-boundary.test.ts` - passed (18 files / 175 tests); the full `bun run test -- --run` suite - 232 files passed, 1 skipped, only __test__/deploy/application.real.test.ts failed (4 real build tests, connect ECONNREFUSED /Users/agent/.docker/run/docker.sock); `bun run typecheck` - passed; `./node_modules/.bin/biome check` on both changed files - passed; `git diff --check` - passed.
- Limitations: application.real.test.ts needs a local Docker socket and does not import the compose router; the UI was not checked in a browser; nothing was pushed or deployed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agentHits
agentHits force-pushed the fix/redact-compose-response-secrets branch from 3c08d1a to 5f9fec3 Compare October 6, 2026 18:12
@agentHits
agentHits merged commit ed73d7b into AgentHits-Dev Oct 6, 2026
8 checks passed
@agentHits
agentHits deleted the fix/redact-compose-response-secrets branch October 6, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant