mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 06:43:45 +02:00
Change the way API keys are stored and validated; clarify API namespacing
Previously, a single key was used to access the API, this has not changed in terms of what the user sees. However, API keys now use an identifier and token internally. The identifier is the first 16 characters of the key, and the token is the remaining 32. The token is stored encrypted at rest in the database and the identifier is used by the API middleware to grab that record and make a timing attack safe comparison.
This commit is contained in:
@@ -83,4 +83,5 @@ return [
|
||||
'fri' => 'Friday',
|
||||
'sat' => 'Saturday',
|
||||
],
|
||||
'last_used' => 'Last Used',
|
||||
];
|
||||
|
||||
@@ -31,26 +31,26 @@
|
||||
<table class="table table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>@lang('strings.public_key')</th>
|
||||
<th>@lang('strings.memo')</th>
|
||||
<th class="text-center hidden-sm hidden-xs">@lang('strings.created')</th>
|
||||
<th class="text-center hidden-sm hidden-xs">@lang('strings.expires')</th>
|
||||
<th>@lang('strings.public_key')</th>
|
||||
<th class="text-right hidden-sm hidden-xs">@lang('strings.last_used')</th>
|
||||
<th class="text-right hidden-sm hidden-xs">@lang('strings.created')</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@foreach ($keys as $key)
|
||||
<tr>
|
||||
<td><code>{{ $key->token }}</code></td>
|
||||
<td>{{ $key->memo }}</td>
|
||||
<td class="text-center hidden-sm hidden-xs">
|
||||
{{ (new Carbon($key->created_at))->toDayDateTimeString() }}
|
||||
</td>
|
||||
<td class="text-center hidden-sm hidden-xs">
|
||||
@if(is_null($key->expires_at))
|
||||
<span class="label label-default">@lang('strings.never')</span>
|
||||
<td><code>{{ $key->identifier . decrypt($key->token) }}</code></td>
|
||||
<td class="text-right hidden-sm hidden-xs">
|
||||
@if(!is_null($key->last_used_at))
|
||||
@datetimeHuman($key->last_used_at)
|
||||
@else
|
||||
{{ (new Carbon($key->expires_at))->toDayDateTimeString() }}
|
||||
—
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-right hidden-sm hidden-xs">
|
||||
@datetimeHuman($key->created_at)
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a href="#delete" class="text-danger" data-action="delete" data-attr="{{ $key->token }}"><i class="fa fa-trash"></i></a>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user