feat: storage template file move hardening (#5917)

* fix: pgvecto.rs extension breaks typeorm schema:drop command

* fix: parse postgres bigints to javascript number types when selecting data

* feat: verify file size is the same as original asset after copying file for storage template job

* feat: allow disabling of storage template job, defaults to disabled for new instances

* fix: don't allow setting concurrency for storage template migration, can cause race conditions above 1

* feat: add checksum verification when file is copied for storage template job

* fix: extract metadata for assets that aren't visible on timeline
This commit is contained in:
Zack Pollard 2023-12-29 18:41:33 +00:00 committed by GitHub
parent 5f6bd4ae7e
commit 2e38fa73bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 686 additions and 225 deletions

View file

@ -25,7 +25,6 @@
JobName.SmartSearch,
JobName.RecognizeFaces,
JobName.VideoConversion,
JobName.StorageTemplateMigration,
JobName.Migration,
];

View file

@ -15,6 +15,7 @@
import SettingInputField, { SettingInputFieldType } from '../setting-input-field.svelte';
import { user } from '$lib/stores/user.store';
import type { ResetOptions } from '$lib/utils/dipatch';
import SettingSwitch from '$lib/components/admin-page/settings/setting-switch.svelte';
export let storageConfig: SystemConfigStorageTemplateDto;
export let disabled = false;
@ -145,7 +146,23 @@
<section class="dark:text-immich-dark-fg">
{#await getConfigs() then}
<div id="directory-path-builder" class="m-4">
<div id="directory-path-builder" class="flex flex-col gap-4 m-4">
<SettingSwitch
title="ENABLED"
{disabled}
subtitle="Enable storage template engine"
bind:checked={storageConfig.enabled}
/>
<SettingSwitch
title="HASH VERIFICATION ENABLED"
{disabled}
subtitle="Enables hash verification, don't disable this unless you're certain of the implications"
bind:checked={storageConfig.hashVerificationEnabled}
/>
<hr />
<h3 class="text-base font-medium text-immich-primary dark:text-immich-dark-primary">Variables</h3>
<section class="support-date">
@ -191,8 +208,8 @@
<div class="flex flex-col my-2">
<label class="text-sm" for="preset-select">PRESET</label>
<select
class="p-2 mt-2 text-sm rounded-lg bg-slate-200 hover:cursor-pointer dark:bg-gray-600"
{disabled}
class="immich-form-input p-2 mt-2 text-sm rounded-lg bg-slate-200 hover:cursor-pointer dark:bg-gray-600"
disabled={disabled || !storageConfig.enabled}
name="presets"
id="preset-select"
bind:value={selectedPreset}
@ -206,7 +223,7 @@
<div class="flex gap-2 align-bottom">
<SettingInputField
label="TEMPLATE"
{disabled}
disabled={disabled || !storageConfig.enabled}
required
inputType={SettingInputFieldType.TEXT}
bind:value={storageConfig.template}
@ -239,7 +256,6 @@
</p>
</section>
</div>
<SettingButtonsRow
on:reset={({ detail }) => handleReset(detail)}
on:save={saveSetting}