Repository navigation
fix: redact compose service response secrets - #5
Merged
Merged
Conversation
Что: - Перенесен фикс 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
force-pushed
the
fix/redact-compose-response-secrets
branch
from
October 6, 2026 18:12
3c08d1a to
5f9fec3
Compare
agentHits
force-pushed
the
AgentHits-Dev
branch
from
October 6, 2026 18:12
befcbd7 to
58219e3
Compare
5 tasks done
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.
What is this PR about?
Ports
9b80df3a0 fix: redact compose service response secrets, which only existed on the deletedagentHits-prodrelease line (local copybackup/agentHits-Prod-before-delete-20261006). The7da5612c0sync replacedcompose.tswith the AgentHits-Dev version, so the fix never reached AgentHits-Dev.On AgentHits-Dev, compose router responses already redact
envand git provider secrets. Butcompose.one,create,update,delete,deployTemplateandmovestill returned two fields to anyone with read access to the service:customGitUrlwith embedded credentials (https://token@host/...);composeFilewith inline secrets.The environment router already redacts both fields.
Changes
redactComposeSecretshelper in the compose router is used by all six responses. It redacts env and git provider secrets as before, and now also maskscustomGitUrlcredentials (redactSensitiveText).composeFileis always redacted in mutation responses; the UI only readscomposeIdfrom them.compose.one,composeFileis redacted only for callers withoutenvVars.read. The compose file editor loads the file fromcompose.one, so a verbatim port would show__DOKPLOY_REDACTED_SECRET__in the editor. The static owner, admin and member roles all haveenvVars.read, so only custom roles without it get the placeholder.service-environment-reveal.test.tscoverscompose.onewith and withoutenvVars.read, and theupdateresponse, including the placeholder round trip on save.Behaviour changes
preserveSecretPlaceholderFieldspath). To change the URL, paste it in full; edits around the placeholder are discarded.getConvertedCompose(requiresservice.create) still returns the compose file, andapplication.onestill returns a rawcustomGitUrl.Checklist
fix/redact-compose-response-secretsfromorigin/AgentHits-Dev(e52547d4d).bun run test -- --run service-environment-reveal: 6 passed. Against the oldcompose.ts, the 3 compose tests fail.__test__/security/, the compose router importers, the environment secret boundary): 18 files / 175 tests passed.bun run test -- --run: 232 files passed. Onlydeploy/application.real.test.tsfails, because no local Docker socket is available.bun run typecheckinapps/dokploy: passed.git diff --check: passed.🤖 Generated with Claude Code