跳轉到

合規套件

NextPDF SaaS Foundation 合規套件提供構建符合 GDPR、CCPA、SOC 2 Type II 及 ISO 27001 要求的 PDF SaaS 平台所需的技術基礎設施與文件範本。

重要聲明:合規套件提供技術實作工具,不構成法律建議。如需確認法規遵循,請諮詢具有相關行業經驗的法律專業人士。


DPA(資料處理協議)範本

當您以 NextPDF 構建 B2B SaaS 平台時,您需要與客戶簽署 DPA(Data Processing Agreement)。以下為基礎範本結構:

DPA 核心條款摘要

資料控制者:您的 SaaS 平台(及其最終客戶)
資料處理者:您的 SaaS 平台
次處理者:
  - NextPDF Labs(PDF 處理引擎)
  - Cloudflare, Inc.(邊緣基礎設施、KV、R2、D1)
  - [您的向量資料庫供應商](RAG 功能)

處理目的:依照客戶指示提供 PDF 生成、解析、簽章及文件智慧服務
資料類別:客戶上傳的 PDF 文件、文件元資料、操作日誌
資料主體:客戶的最終用戶
保留期限:依租戶設定,最長 7 年(法規要求期限)
刪除時限:請求後 30 天內完成

安全措施:
  - AES-256 加密(靜態)
  - TLS 1.3(傳輸)
  - mTLS(Enterprise 服務間通訊)
  - 定期安全審計(SOC 2 Type II 流程)

資料主權(Data Residency)

支援的資料區域

區域代碼 說明 啟用條件
ap-east-1 亞太(香港) Enterprise
ap-northeast-1 亞太(東京) Enterprise
eu-west-1 歐洲(都柏林) Enterprise
us-east-1 美東(維吉尼亞) Pro+
us-west-2 美西(奧勒岡) Pro+

資料主權設定

<?php

declare(strict_types=1);

use NextPDF\Enterprise\Compliance\DataResidency;
use NextPDF\Enterprise\Compliance\Region;

// 租戶設定資料主權
$residency = new DataResidency(
    region: Region::AP_NORTHEAST_1,  // 資料必須留在東京
    enforcementMode: DataResidency::STRICT,  // 違反時拋出異常
    allowedSubprocessors: [
        'cloudflare',   // Cloudflare 支援 Regional Services
        'prisma',       // Prisma 實例部署在同區域
    ],
);

Cloudflare Regional Services 設定

# wrangler.toml
[env.production]
# 強制資料處理在特定地理區域
smart_placement = { enabled = false }

# 使用 Cloudflare Regional Services
[[env.production.d1_databases]]
binding = "AUDIT_DB"
database_name = "nextpdf-audit-ap-northeast-1"
database_id = "your-d1-id"

審計日誌 Schema

不可變事件鏈設計

審計日誌採用不可變設計,每個事件包含前一事件的雜湊值,形成可驗證的事件鏈:

{
  "$schema": "https://docs.nextpdf.dev/schemas/audit-log-event-v1.json",
  "id": "evt_550e8400e29b41d4a716446655440000",
  "version": "1",
  "tenant_id": "tenant-abc123",
  "user_id": "user-456",
  "session_id": "sess-789",
  "operation": "pdf.sign",
  "resource": {
    "type": "pdf_document",
    "id": "doc-001",
    "name": "contract-final.pdf"
  },
  "outcome": "success",
  "metadata": {
    "signature_level": "pades-b-lta",
    "certificate_subject": "CN=王小明, O=ACME Corp, C=TW",
    "timestamp_server": "http://timestamp.digicert.com"
  },
  "actor": {
    "ip_address": "203.0.113.1",
    "user_agent": "Mozilla/5.0...",
    "auth_method": "jwt"
  },
  "timing": {
    "created_at": "2026-03-04T10:30:00.000Z",
    "duration_ms": 2345
  },
  "chain": {
    "previous_event_id": "evt_abc123...",
    "previous_event_hash": "sha256:a1b2c3d4...",
    "this_hash": "sha256:e5f6g7h8..."
  }
}

事件類型清單

操作代碼 說明 GDPR 相關
pdf.generate 生成 PDF
pdf.parse 解析 PDF
pdf.sign 數位簽章
pdf.redact 文字塗黑
pdf.encrypt 加密
rag.embed 向量索引
rag.search 語意搜尋
tenant.data_export 資料匯出
tenant.data_purge 資料清除 ✓(必記錄)
user.consent_given 同意書簽署
user.consent_withdrawn 撤回同意

審計日誌查詢 API

GET /v1/audit-log?tenant_id=tenant-abc123&operation=pdf.sign&from=2026-01-01&to=2026-03-31
Authorization: Bearer {admin-token}

HTTP/1.1 200 OK
Content-Type: application/json

{
  "events": [...],
  "pagination": {
    "page": 1,
    "per_page": 50,
    "total": 342,
    "cursor": "evt_..."
  },
  "chain_verified": true
}

GDPR 資料清除

清除請求流程

sequenceDiagram
    participant User as 資料主體
    participant Platform as SaaS 平台
    participant NextPDF as NextPDF Enterprise
    participant R2 as Cloudflare R2
    participant VDB as 向量資料庫

    User->>Platform: 資料刪除請求(GDPR 第 17 條)
    Platform->>Platform: 驗證身份 + 記錄請求
    Platform->>NextPDF: DELETE /v1/tenants/{id}/user/{user_id}/data
    NextPDF->>R2: 標記相關 PDF 文件(軟刪除)
    NextPDF->>VDB: 刪除 user_id 相關向量
    NextPDF->>Platform: 清除任務 ID(非同步)
    Note over NextPDF,R2: T+30 天後硬刪除
    NextPDF-->>Platform: Webhook: data_purge.completed
    Platform->>User: 確認資料已刪除

PHP 實作

<?php

declare(strict_types=1);

use NextPDF\Enterprise\Compliance\GdprErasureService;
use NextPDF\Enterprise\Compliance\ErasureScope;

final class GdprController
{
    public function __construct(
        private readonly GdprErasureService $erasureService,
    ) {}

    public function handleErasureRequest(
        string $tenantId,
        string $userId,
        string $requestReason,
    ): ErasureTicket {
        $ticket = $this->erasureService->initiate(
            tenantId: $tenantId,
            userId: $userId,
            scope: ErasureScope::ALL,  // 或 ErasureScope::DOCUMENTS_ONLY
            requestReason: $requestReason,
            requestedAt: new DateTimeImmutable(),
        );

        // 系統自動:
        // 1. 立即軟刪除(用戶無法再存取)
        // 2. 匿名化審計日誌(保留操作類型,移除個人識別資訊)
        // 3. 刪除向量嵌入
        // 4. 排程 T+30 天硬刪除
        // 5. 記錄不可刪除的清除事件(審計合規)

        return $ticket;
    }
}

清除完成驗證

// 驗證清除是否完整(可提供給資料主體作為證明)
$proof = $erasureService->generateErasureProof(
    ticketId: $ticket->getId(),
    format: 'pdf',  // 生成 PDF 形式的清除證明書
);

資料保留政策

預設保留期限

資料類型 預設保留期 最長可設定期 法規要求最低期
生成的 PDF 文件 90 天 7 年
操作審計日誌 1 年 10 年 依法規而定
計量 / 計費記錄 7 年 不限 7 年(稅務)
電子簽章文件 10 年 30 年 10 年(商業法)
個人資料(PII) 服務期間 7 年

自動生命週期管理

use NextPDF\Enterprise\Compliance\RetentionPolicy;

// 租戶級別的保留政策設定
$policy = new RetentionPolicy(
    tenantId: 'tenant-abc123',
    rules: [
        RetentionPolicy::rule('pdf.generated', days: 90),
        RetentionPolicy::rule('pdf.signed', days: 3650),  // 10 年
        RetentionPolicy::rule('audit.log', days: 365),
        RetentionPolicy::rule('billing.records', days: 2555),  // 7 年
    ],
    onExpiry: RetentionPolicy::ACTION_PURGE,
    notifyBeforeDays: 14,  // 到期前 14 天通知
);

CCPA 合規

消費者隱私權

CCPA 要求提供以下端點:

# 知情權(Know)
GET /v1/privacy/data-export?user_id={id}

# 刪除權(Delete)
DELETE /v1/privacy/data/{user_id}

# 不出售個人資訊(Do Not Sell)
POST /v1/privacy/do-not-sell
Body: {"user_id": "...", "opt_out": true}

SOC 2 Type II 對照

SOC 2 控制項 NextPDF 實作
CC6.1(邏輯存取) JWT/mTLS 驗證 + RBAC
CC6.2(系統帳戶管理) 租戶隔離 + 最小權限
CC6.3(系統存取撤銷) 即時 JWT 撤銷 + Blocklist
CC7.2(系統監控) Prometheus + OpenTelemetry
CC7.4(事件回應) 審計日誌 + Webhook 告警
A1.1(系統可用性) Circuit Breaker + HPA
PI1.1(個人資訊收集) 資料最小化 + 明確同意
PI1.4(個人資訊刪除) GDPR 清除 + 驗證機制

參見

Commercial License

This feature requires a commercial license. Contact our team for pricing and deployment support.

Contact Sales