From b812bc74219bf96c10000b6a15bb3a6f79e5c368 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 5 Aug 2026 07:34:21 +0200 Subject: [PATCH] Task/guard system tags in admin control panel (#7532) * Guard system tags against deletion and renaming * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/endpoints/tags/tags.controller.ts | 5 +++-- .../components/admin-tag/admin-tag.component.html | 12 ++++++++++-- .../app/components/admin-tag/admin-tag.component.ts | 9 +++++++-- libs/common/src/lib/config.ts | 8 +++++++- libs/common/src/lib/helper.ts | 9 ++++++++- 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb6b3ef37..426cca929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added the platform logo to the account selector in the create or update activity dialog +### Changed + +- Guarded the system tags against deletion and renaming in the tag management of the admin control panel + ## 3.42.0 - 2026-08-04 ### Changed diff --git a/apps/api/src/app/endpoints/tags/tags.controller.ts b/apps/api/src/app/endpoints/tags/tags.controller.ts index 21e29c6ab..cd043b593 100644 --- a/apps/api/src/app/endpoints/tags/tags.controller.ts +++ b/apps/api/src/app/endpoints/tags/tags.controller.ts @@ -2,6 +2,7 @@ import { HasPermission } from '@ghostfolio/api/decorators/has-permission.decorat import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard'; import { TagService } from '@ghostfolio/api/services/tag/tag.service'; import { CreateTagDto, UpdateTagDto } from '@ghostfolio/common/dtos'; +import { isSystemTag } from '@ghostfolio/common/helper'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { RequestWithUser } from '@ghostfolio/common/types'; @@ -69,7 +70,7 @@ export class TagsController { id }); - if (!originalTag) { + if (!originalTag || isSystemTag(originalTag)) { throw new HttpException( getReasonPhrase(StatusCodes.FORBIDDEN), StatusCodes.FORBIDDEN @@ -94,7 +95,7 @@ export class TagsController { id }); - if (!originalTag) { + if (!originalTag || isSystemTag(originalTag)) { throw new HttpException( getReasonPhrase(StatusCodes.FORBIDDEN), StatusCodes.FORBIDDEN diff --git a/apps/client/src/app/components/admin-tag/admin-tag.component.html b/apps/client/src/app/components/admin-tag/admin-tag.component.html index 2edad000d..c7cbe37c0 100644 --- a/apps/client/src/app/components/admin-tag/admin-tag.component.html +++ b/apps/client/src/app/components/admin-tag/admin-tag.component.html @@ -83,7 +83,11 @@ -