Skip to content

Commit

Permalink
fix(backend): add missing kind definition for admin endpoints to impr…
Browse files Browse the repository at this point in the history
…ove security
  • Loading branch information
syuilo committed Dec 18, 2023
1 parent 776eea7 commit 5150053
Show file tree
Hide file tree
Showing 77 changed files with 153 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
- Fix: アカウントをブロックした際に、自身のユーザーのページでノートが相手に表示される問題を修正
- Fix: モデレーションログがモデレーターは閲覧できないように修正
- Fix: HTTP Digestヘッダのアルゴリズム部分に大文字の"SHA-256"しか使えない
- Fix: 管理者用APIのアクセス権限が適切に設定されていない問題を修正

## 2023.11.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { AbuseUserReportEntityService } from '@/core/entities/AbuseUserReportEnt
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

res: {
type: 'object',
optional: false, nullable: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireAdmin: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ApiError } from '@/server/api/error.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireAdmin: true,

Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/ad/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ModerationLogService } from '@/core/ModerationLogService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/ad/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,

Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/ad/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/ad/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { AnnouncementService } from '@/core/AnnouncementService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { IdService } from '@/core/IdService.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageAvatarDecorations',
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageAvatarDecorations',
errors: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireRolePolicy: 'canManageAvatarDecorations',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageAvatarDecorations',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireAdmin: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireAdmin: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { QueueService } from '@/core/QueueService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.j
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',
} as const;
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/emoji/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',

Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/emoji/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
import { QueueService } from '@/core/QueueService.js';

export const meta = {
secure: true,
kind: 'write:admin',
requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { sqlLikeEscape } from '@/misc/sql-like-escape.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',

Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/emoji/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { QueueService } from '@/core/QueueService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { ModerationLogService } from '@/core/ModerationLogService.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const meta = {
requireCredential: true,
requireAdmin: true,

kind: 'read:admin',

tags: ['admin'],
} as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const meta = {
requireCredential: true,
requireAdmin: true,

kind: 'read:admin',

tags: ['admin'],

res: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { IdService } from '@/core/IdService.js';
export const meta = {
tags: ['admin'],

kind: 'read:admin',

requireCredential: true,
requireModerator: true,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { ApiError } from '../../../error.js';
export const meta = {
tags: ['admin'],

kind: 'write:admin',

requireCredential: true,
requireModerator: true,

Expand Down
Loading

0 comments on commit 5150053

Please sign in to comment.