2
0
Files
gitcaddy-vault/templates/repo/vault/list.tmpl
logikonline fcb720736b
All checks were successful
Build and Release / Tests (push) Successful in 1m11s
Build and Release / Lint (push) Successful in 1m33s
Build and Release / Create Release (push) Successful in 0s
feat(vault): add lockbox encryption mode to secrets
Added encryption_mode field to secrets supporting "standard" (server-side) and "lockbox" (client-side E2E) modes. Updated API to validate lockbox format (lockbox:v1:salt:ciphertext). Enhanced UI to display lock icons and badges for lockbox secrets. Lockbox secrets show locked state in web UI, requiring CLI/SDK for decryption.
2026-02-07 02:14:26 -05:00

136 lines
6.3 KiB
Cheetah

{{template "repo/vault/layout_head" (dict "ctxData" . "pageClass" "repository vault secrets")}}
{{if not .VaultConfigured}}
<div class="ui placeholder segment tw-text-center">
<div class="ui icon header">
{{svg "octicon-alert" 48}}
<h2>{{ctx.Locale.Tr "vault.config_error_title"}}</h2>
<p>{{ctx.Locale.Tr "vault.config_error_message"}}</p>
{{if .VaultConfigError}}
<p><code>{{.VaultConfigError}}</code></p>
{{end}}
<p class="text grey">{{ctx.Locale.Tr "vault.config_error_fix"}}</p>
</div>
</div>
{{else}}
<div class="ui segment">
<div class="tw-flex tw-items-center tw-justify-between tw-w-full">
<h4 class="ui header tw-mb-0">
{{svg "octicon-lock" 20}} {{ctx.Locale.Tr "vault.secrets"}}
<div class="sub header">{{ctx.Locale.Tr "vault.secrets_description"}}</div>
</h4>
<div class="tw-flex tw-items-center tw-gap-2 tw-ml-auto">
<select class="ui dropdown" id="type-filter" onchange="window.location.href='{{.RepoLink}}/vault?type=' + this.value">
<option value="">{{ctx.Locale.Tr "vault.all_types"}}</option>
<option value="generic" {{if eq .FilterType "generic"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_generic"}}</option>
<option value="password" {{if eq .FilterType "password"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_password"}}</option>
<option value="api_key" {{if eq .FilterType "api_key"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_api_key"}}</option>
<option value="certificate" {{if eq .FilterType "certificate"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_certificate"}}</option>
<option value="ssh_key" {{if eq .FilterType "ssh_key"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_ssh_key"}}</option>
<option value="file" {{if eq .FilterType "file"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_file"}}</option>
</select>
{{if .CanWrite}}
<a class="ui primary button" href="{{.RepoLink}}/vault/secrets/new">
{{svg "octicon-plus" 16}} {{ctx.Locale.Tr "vault.new_secret"}}
</a>
{{end}}
</div>
</div>
</div>
{{if .Secrets}}
{{range $type, $secrets := .SecretsByType}}
<div class="ui segment">
<h5 class="ui header">
{{if eq $type "generic"}}{{svg "octicon-key" 16}} {{ctx.Locale.Tr "vault.type_generic"}}
{{else if eq $type "password"}}{{svg "octicon-lock" 16}} {{ctx.Locale.Tr "vault.type_password"}}
{{else if eq $type "api_key"}}{{svg "octicon-key-asterisk" 16}} {{ctx.Locale.Tr "vault.type_api_key"}}
{{else if eq $type "certificate"}}{{svg "octicon-shield-check" 16}} {{ctx.Locale.Tr "vault.type_certificate"}}
{{else if eq $type "ssh_key"}}{{svg "octicon-key" 16}} {{ctx.Locale.Tr "vault.type_ssh_key"}}
{{else if eq $type "file"}}{{svg "octicon-file" 16}} {{ctx.Locale.Tr "vault.type_file"}}
{{else}}{{svg "octicon-key" 16}} {{$type}}
{{end}}
<span class="ui grey label">{{len $secrets}}</span>
</h5>
<table class="ui very basic striped table">
<thead>
<tr>
<th class="tw-w-full">{{ctx.Locale.Tr "vault.secret_name"}}</th>
<th class="tw-text-center tw-whitespace-nowrap" style="width: 70px;">{{ctx.Locale.Tr "vault.version"}}</th>
<th class="tw-text-center tw-whitespace-nowrap" style="width: 120px;">{{ctx.Locale.Tr "vault.updated"}}</th>
<th class="tw-text-center tw-whitespace-nowrap" style="width: 120px;">{{ctx.Locale.Tr "actions"}}</th>
</tr>
</thead>
<tbody>
{{range $secrets}}
<tr{{if .IsDeleted}} class="negative"{{end}}>
<td>
<a href="{{$.RepoLink}}/vault/secrets/{{.Name}}">
{{if eq .EncryptionMode "lockbox"}}{{svg "octicon-lock" 16}}{{else}}{{svg "octicon-key" 16}}{{end}} <strong>{{.Name}}</strong>
</a>
{{if eq .EncryptionMode "lockbox"}}
<span class="ui tiny blue label" data-tooltip="End-to-end encrypted">{{svg "octicon-shield-lock" 10}} Lock-Box</span>
{{end}}
{{if .Description}}
<br><small class="text grey">{{.Description}}</small>
{{end}}
{{if .IsDeleted}}
<span class="ui red label">{{ctx.Locale.Tr "vault.deleted"}}</span>
{{end}}
</td>
<td class="tw-text-center tw-whitespace-nowrap">v{{.CurrentVersion}}</td>
<td class="tw-text-center tw-whitespace-nowrap">{{DateUtils.TimeSince .UpdatedUnix}}</td>
<td class="tw-text-center tw-whitespace-nowrap">
<a class="ui tiny button" href="{{$.RepoLink}}/vault/secrets/{{.Name}}">
{{svg "octicon-eye" 14}} {{ctx.Locale.Tr "view"}}
</a>
{{if $.CanWrite}}
{{if .IsDeleted}}
<form class="ui inline tw-inline" action="{{$.RepoLink}}/vault/secrets/{{.Name}}/restore" method="post">
{{$.CsrfTokenHtml}}
<button class="ui tiny green button">
{{svg "octicon-history" 14}} {{ctx.Locale.Tr "vault.restore"}}
</button>
</form>
{{else}}
<form class="ui inline tw-inline" action="{{$.RepoLink}}/vault/secrets/{{.Name}}/delete" method="post">
{{$.CsrfTokenHtml}}
<button class="ui tiny red button">
{{svg "octicon-trash" 14}} {{ctx.Locale.Tr "delete"}}
</button>
</form>
{{end}}
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}
{{else}}
<div class="ui placeholder segment tw-text-center">
<div class="ui icon header">
{{svg "octicon-lock" 48}}
<h2>{{ctx.Locale.Tr "vault.no_secrets"}}</h2>
<p>{{ctx.Locale.Tr "vault.no_secrets_description"}}</p>
</div>
{{if .CanWrite}}
<div class="tw-mt-4">
<a class="ui primary button" href="{{.RepoLink}}/vault/secrets/new">
{{svg "octicon-plus" 16}} {{ctx.Locale.Tr "vault.create_first_secret"}}
</a>
</div>
{{end}}
</div>
{{end}}
{{if .ShowDeleted}}
<div class="ui segment">
<div class="ui checkbox">
<input type="checkbox" id="show-deleted" {{if .IncludeDeleted}}checked{{end}} onchange="window.location.href='{{.RepoLink}}/vault?include_deleted=' + this.checked">
<label for="show-deleted">{{ctx.Locale.Tr "vault.show_deleted"}}</label>
</div>
</div>
{{end}}
{{end}}
{{template "repo/vault/layout_footer" .}}