Files
coolify/resources/views/livewire/project/shared/environment-variable/show-hardcoded.blade.php
T
Andras Bacsai c70463fb9f fix(env): hide hardcoded compose values from users who cannot edit
Hardcoded variables parsed from docker-compose are now redacted in the
environment variable list unless the user can update the resource. The
value is nulled server-side and flagged with is_value_hidden, so it no
longer reaches the Livewire snapshot or rendered HTML.

ShowHardcoded gets a locked isValueHidden property. When it is set, the
copy button is hidden and the details modal shows "Hidden (only admins
can view)" in place of the value. Previously the view checked member
role only.

Add tests covering redaction for members and visibility for owners.
2026-09-30 11:31:29 +02:00

64 lines
3.4 KiB
PHP

<div class="env-table-item"
x-show="typeof envFilter === 'undefined' || envFilter === 'all' || envFilter === '{{ $isPreview ? 'preview' : 'production' }}'">
<div class="data-table-row env-table-grid {{ $showEnvironmentType ? '' : 'env-table-grid-no-type' }}">
<div class="flex min-w-0 items-center gap-2">
<button type="button" data-env-name-trigger
class="env-key-label min-w-0 truncate text-left font-mono text-[13px] text-black dark:text-fg"
title="{{ $key }}"
@click="$el.closest('.data-table-row').querySelector('[data-env-settings-trigger]').click()">
{{ $key }}
</button>
@if (filled($comment))
<x-helper :helper="e($comment)" />
@endif
@if ($serviceName)
<span class="table-badge shrink-0">{{ $serviceName }}</span>
@endif
</div>
<span class="env-managed-desktop data-table-cell-check">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2"
stroke="currentColor" class="size-4">
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" />
</svg>
</span>
@if ($showEnvironmentType)
<div class="env-type-desktop text-[13px] text-neutral-500 dark:text-fg-dim">{{ $isPreview ? 'Preview' : 'Production' }}</div>
@endif
<span class="data-table-cell-dash">-</span>
<span class="data-table-cell-dash">-</span>
<span class="data-table-cell-dash">-</span>
<span class="data-table-cell-dash">-</span>
<div class="flex items-center gap-0.5 justify-self-end">
@unless ($isValueHidden)
<x-copy-button resolve="$wire.copyValue()" label="Copy value" />
@endunless
<x-modal-input title="Environment variable details" :closeOutside="false">
<x-slot:content>
<button type="button" data-env-settings-trigger class="icon-button shrink-0"
title="View environment variable" aria-label="View environment variable">
<x-reicon name="settings" class="size-3.5" />
</button>
</x-slot:content>
<div class="flex w-full flex-col gap-4">
<x-forms.input label="Name" :value="$key" readonly />
@if ($isValueHidden)
<div class="w-full">
<label class="mb-1 flex items-center gap-1 text-sm font-medium">Value</label>
<input disabled type="text" value="Hidden (only admins can view)"
class="input w-full italic !text-neutral-500 dark:!text-neutral-500" />
</div>
@else
<x-forms.input label="Value" :value="$value ?? ''" readonly />
@endif
@if (filled($comment))
<x-forms.input label="Comment" :value="$comment" readonly />
@endif
<x-callout type="info" title="Managed by Docker Compose">
Update this value in the Compose file.
</x-callout>
</div>
</x-modal-input>
</div>
</div>
</div>