fix: 收口审查发现的 CI 与授权边界
将 admin identity helper 移到共享边界,清理跨 feature 导入;修复 CI 集成环境、浏览器数据库/Playwright 配置;增强 doctor source hash 对重命名文件的处理,并补充 logout API 文档。
This commit is contained in:
1 parent
bd129a3069
commit
0788480ce3
12 files changed
+35
-16
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"scope": "模板完成证据登记,保留命令、日志与产物哈希",
|
"scope": "模板完成证据登记,保留命令、日志与产物哈希",
|
||||||
"generatedAt": "2026-10-19T00:40:00+08:00",
|
"generatedAt": "2026-10-19T01:15:00+08:00",
|
||||||
"templates": {
|
"templates": {
|
||||||
"acheng-campus-food": {
|
"acheng-campus-food": {
|
||||||
"real-manifest-interaction": {
|
"real-manifest-interaction": {
|
||||||
@@ -292,5 +292,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sourceTreeHash": "ff1ad5d31af376ed6c2aa019533b168805bdf5cfaf306418b8327fb432dbeee3"
|
"sourceTreeHash": "7c75d6c3fe05b9c09e1392deaa8114a18dedaa1074e0a9d9022e4ee757ae930e"
|
||||||
}
|
}
|
||||||
@@ -87,6 +87,15 @@ jobs:
|
|||||||
node-version: 24
|
node-version: 24
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
|
- name: Prepare API test env
|
||||||
|
working-directory: apps/api
|
||||||
|
run: |
|
||||||
|
cat > .env <<EOF
|
||||||
|
DATABASE_URL=$DATABASE_URL
|
||||||
|
DEFAULT_BRAND_ID=$DEFAULT_BRAND_ID
|
||||||
|
SESSION_SECRET=$SESSION_SECRET
|
||||||
|
SEED_ADMIN_PASSWORD=$SEED_ADMIN_PASSWORD
|
||||||
|
EOF
|
||||||
- run: pnpm --filter @personal-brand/api test:integration
|
- run: pnpm --filter @personal-brand/api test:integration
|
||||||
|
|
||||||
taro:
|
taro:
|
||||||
@@ -147,9 +156,18 @@ jobs:
|
|||||||
cache: pnpm
|
cache: pnpm
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
- run: pnpm --filter @personal-brand/taro exec playwright install --with-deps chromium
|
- run: pnpm --filter @personal-brand/taro exec playwright install --with-deps chromium
|
||||||
|
- name: Prepare API test env
|
||||||
|
working-directory: apps/api
|
||||||
|
run: |
|
||||||
|
cat > .env <<EOF
|
||||||
|
DATABASE_URL=$DATABASE_URL
|
||||||
|
DEFAULT_BRAND_ID=$DEFAULT_BRAND_ID
|
||||||
|
SESSION_SECRET=$SESSION_SECRET
|
||||||
|
SEED_ADMIN_PASSWORD=$SEED_ADMIN_PASSWORD
|
||||||
|
EOF
|
||||||
|
- run: pnpm --filter @personal-brand/api db:migrate:deploy
|
||||||
|
- run: pnpm --filter @personal-brand/api db:seed
|
||||||
- run: pnpm --filter @personal-brand/api test:integration
|
- run: pnpm --filter @personal-brand/api test:integration
|
||||||
env:
|
|
||||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/personal_brand
|
|
||||||
- name: Start API
|
- name: Start API
|
||||||
run: pnpm --filter @personal-brand/api start > /tmp/api.log 2>&1 &
|
run: pnpm --filter @personal-brand/api start > /tmp/api.log 2>&1 &
|
||||||
env:
|
env:
|
||||||
@@ -175,3 +193,5 @@ jobs:
|
|||||||
curl --retry 30 --retry-delay 1 --retry-connrefused -fsS http://localhost:3002
|
curl --retry 30 --retry-delay 1 --retry-connrefused -fsS http://localhost:3002
|
||||||
curl --retry 30 --retry-delay 1 --retry-connrefused -fsS http://localhost:3000
|
curl --retry 30 --retry-delay 1 --retry-connrefused -fsS http://localhost:3000
|
||||||
- run: pnpm --filter @personal-brand/taro exec playwright test --config=playwright.config.ts --reporter=line
|
- run: pnpm --filter @personal-brand/taro exec playwright test --config=playwright.config.ts --reporter=line
|
||||||
|
env:
|
||||||
|
ADMIN_URL: http://localhost:3000
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { ForbiddenException, UnauthorizedException } from "@nestjs/common";
|
import { ForbiddenException, UnauthorizedException } from "@nestjs/common";
|
||||||
import type { FastifyRequest } from "fastify";
|
import type { FastifyRequest } from "fastify";
|
||||||
import { readIdentity } from "../../auth.js";
|
import { readIdentity } from "./auth.js";
|
||||||
|
|
||||||
export type AdminIdentity = {
|
export type AdminIdentity = {
|
||||||
subject: string;
|
subject: string;
|
||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
UpdateTrustContentDto,
|
UpdateTrustContentDto,
|
||||||
} from "../../admin.dto.js";
|
} from "../../admin.dto.js";
|
||||||
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
|
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
|
||||||
import { requireAdminIdentity } from "../workspace/admin-access.identity.js";
|
import { requireAdminIdentity } from "../../admin-access.identity.js";
|
||||||
import { AdminBrandConfigService } from "./admin-brand-config.service.js";
|
import { AdminBrandConfigService } from "./admin-brand-config.service.js";
|
||||||
|
|
||||||
@Controller("admin/config")
|
@Controller("admin/config")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Body, Controller, Get, Param, Patch, Post, Req } from "@nestjs/common";
|
import { Body, Controller, Get, Param, Patch, Post, Req } from "@nestjs/common";
|
||||||
import type { FastifyRequest } from "fastify";
|
import type { FastifyRequest } from "fastify";
|
||||||
import { AdminAccessService } from "../../admin-access.service.js";
|
import { AdminAccessService } from "../../admin-access.service.js";
|
||||||
import { requireAdminIdentity } from "../workspace/admin-access.identity.js";
|
import { requireAdminIdentity } from "../../admin-access.identity.js";
|
||||||
import { CreateBrandMemberDto, UpdateBrandMemberDto } from "../../admin.dto.js";
|
import { CreateBrandMemberDto, UpdateBrandMemberDto } from "../../admin.dto.js";
|
||||||
import { TenantService } from "./tenant.service.js";
|
import { TenantService } from "./tenant.service.js";
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
PreviewTemplateSampleDto,
|
PreviewTemplateSampleDto,
|
||||||
UpdateCapabilityInstallationDto,
|
UpdateCapabilityInstallationDto,
|
||||||
} from "../../admin.dto.js";
|
} from "../../admin.dto.js";
|
||||||
import { requireAdminIdentity } from "./admin-access.identity.js";
|
import { requireAdminIdentity } from "../../admin-access.identity.js";
|
||||||
import { AdminSampleContentService } from "./admin-sample-content.service.js";
|
import { AdminSampleContentService } from "./admin-sample-content.service.js";
|
||||||
import { AdminWorkspaceCapabilitiesService } from "./admin-workspace-capabilities.service.js";
|
import { AdminWorkspaceCapabilitiesService } from "./admin-workspace-capabilities.service.js";
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
UpdateInquiryFormDto,
|
UpdateInquiryFormDto,
|
||||||
UpdateInquirySubmissionDto,
|
UpdateInquirySubmissionDto,
|
||||||
} from "../../admin.dto.js";
|
} from "../../admin.dto.js";
|
||||||
import { requireAdminIdentity } from "./admin-access.identity.js";
|
import { requireAdminIdentity } from "../../admin-access.identity.js";
|
||||||
import { AdminInquiryService } from "./admin-inquiry.service.js";
|
import { AdminInquiryService } from "./admin-inquiry.service.js";
|
||||||
|
|
||||||
@Controller("admin/workspace")
|
@Controller("admin/workspace")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Req } from "@nestjs/common";
|
import { Body, Controller, Delete, Get, Param, Patch, Post, Req } from "@nestjs/common";
|
||||||
import type { FastifyRequest } from "fastify";
|
import type { FastifyRequest } from "fastify";
|
||||||
import { CreateOfferingDto, UpdateOfferingDto } from "../../admin.dto.js";
|
import { CreateOfferingDto, UpdateOfferingDto } from "../../admin.dto.js";
|
||||||
import { requireAdminIdentity } from "./admin-access.identity.js";
|
import { requireAdminIdentity } from "../../admin-access.identity.js";
|
||||||
import { AdminOfferingService } from "./admin-offering.service.js";
|
import { AdminOfferingService } from "./admin-offering.service.js";
|
||||||
|
|
||||||
@Controller("admin/workspace")
|
@Controller("admin/workspace")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Body, Controller, Get, Post, Req } from "@nestjs/common";
|
|||||||
import type { FastifyRequest } from "fastify";
|
import type { FastifyRequest } from "fastify";
|
||||||
import { RollbackTemplateDto, UpgradeTemplateDto } from "../../admin.dto.js";
|
import { RollbackTemplateDto, UpgradeTemplateDto } from "../../admin.dto.js";
|
||||||
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
|
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
|
||||||
import { requireAdminIdentity } from "./admin-access.identity.js";
|
import { requireAdminIdentity } from "../../admin-access.identity.js";
|
||||||
|
|
||||||
@Controller("admin/workspace")
|
@Controller("admin/workspace")
|
||||||
class AdminTemplateController {
|
class AdminTemplateController {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Controller, Get, Post, Body, Req } from "@nestjs/common";
|
|||||||
import type { FastifyRequest } from "fastify";
|
import type { FastifyRequest } from "fastify";
|
||||||
import { InstallTemplateDto, SelectTemplateVersionDto } from "../../admin.dto.js";
|
import { InstallTemplateDto, SelectTemplateVersionDto } from "../../admin.dto.js";
|
||||||
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
|
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
|
||||||
import { requireAdminIdentity } from "./admin-access.identity.js";
|
import { requireAdminIdentity } from "../../admin-access.identity.js";
|
||||||
import { AdminWorkspaceService } from "./admin-workspace.service.js";
|
import { AdminWorkspaceService } from "./admin-workspace.service.js";
|
||||||
|
|
||||||
@Controller("admin/workspace")
|
@Controller("admin/workspace")
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ export default defineConfig({
|
|||||||
viewport: { width: 375, height: 812 },
|
viewport: { width: 375, height: 812 },
|
||||||
screenshot: "only-on-failure",
|
screenshot: "only-on-failure",
|
||||||
launchOptions: {
|
launchOptions: {
|
||||||
executablePath:
|
...(process.env.CHROMIUM_PATH ? { executablePath: process.env.CHROMIUM_PATH } : {}),
|
||||||
process.env.CHROMIUM_PATH ||
|
|
||||||
"/home/que01/.cache/ms-playwright/chromium-1228/chrome-linux64/chrome",
|
|
||||||
args: ["--no-sandbox"],
|
args: ["--no-sandbox"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -444,7 +444,8 @@ export function sourceTreeHash(root) {
|
|||||||
.toString("utf8")
|
.toString("utf8")
|
||||||
.split("\0")
|
.split("\0")
|
||||||
.filter((file) => file && !file.startsWith(".codex-tasks/"))
|
.filter((file) => file && !file.startsWith(".codex-tasks/"))
|
||||||
.map((file) => path.join(rootPath, file));
|
.map((file) => path.join(rootPath, file))
|
||||||
|
.filter((file) => fs.existsSync(file) && fs.statSync(file).isFile());
|
||||||
} else {
|
} else {
|
||||||
files = walkRepositoryFiles(rootPath).filter(
|
files = walkRepositoryFiles(rootPath).filter(
|
||||||
(file) => !path.relative(rootPath, file).startsWith(".codex-tasks/"),
|
(file) => !path.relative(rootPath, file).startsWith(".codex-tasks/"),
|
||||||
|
|||||||
Reference in new issue
Block a user