136 lines
2.4 KiB
Markdown
136 lines
2.4 KiB
Markdown
# 🔐 Security Policy
|
|
## Project: AINATIVE_OKR_CLAUDE_GHCP
|
|
|
|
---
|
|
|
|
# 1. Purpose
|
|
|
|
Tài liệu này định nghĩa chính sách bảo mật cho AI System nhằm:
|
|
|
|
- Ngăn chặn prompt injection
|
|
- Bảo vệ dữ liệu nhạy cảm (PII, secret)
|
|
- Kiểm soát hành vi của LLM/Agent
|
|
- Đảm bảo an toàn khi vận hành production
|
|
|
|
---
|
|
|
|
# 2. Scope
|
|
|
|
Áp dụng cho toàn bộ hệ thống:
|
|
|
|
- Prompt / LLM interaction
|
|
- Agent workflow
|
|
- Template generation (SpecKit)
|
|
- Script automation
|
|
- Logging & monitoring
|
|
|
|
---
|
|
|
|
# 3. Security Principles
|
|
|
|
- ✅ **Zero Trust Input**: Không tin bất kỳ input nào từ user
|
|
- ✅ **Least Privilege**: Tool/Agent chỉ có quyền tối thiểu
|
|
- ✅ **Defense in Depth**: nhiều lớp bảo vệ
|
|
- ✅ **Auditability**: mọi hoạt động phải log được
|
|
- ✅ **Fail Safe**: khi nghi ngờ → block hoặc require approval
|
|
|
|
---
|
|
|
|
# 4. Threat Model (OWASP LLM Top 10 based)
|
|
|
|
| Threat | Description |
|
|
|------|-------------|
|
|
| Prompt Injection | User cố override system |
|
|
| Data Leakage | Lộ thông tin nội bộ |
|
|
| Secret Exposure | Lộ API key / credential |
|
|
| Unsafe Tool Call | Agent thực thi hành động nguy hiểm |
|
|
| Hallucination Risk | Output sai nhưng có vẻ đúng |
|
|
|
|
---
|
|
|
|
# 5. Input Security Policy
|
|
|
|
## 5.1 Prompt Injection Protection
|
|
|
|
Block các pattern:
|
|
|
|
- "ignore previous instruction"
|
|
- "bypass system"
|
|
- "override policy"
|
|
|
|
### Action
|
|
|
|
| Level | Action |
|
|
|------|--------|
|
|
| High | Block |
|
|
| Medium | Require Approval |
|
|
| Low | Log |
|
|
|
|
---
|
|
|
|
## 5.2 PII Detection
|
|
|
|
Detect:
|
|
|
|
- Email
|
|
- Phone number
|
|
- Personal ID
|
|
- Address
|
|
|
|
### Action
|
|
|
|
- Mask trước khi gửi LLM
|
|
- Log sự kiện
|
|
|
|
---
|
|
|
|
## 5.3 Secret Detection
|
|
|
|
Detect:
|
|
|
|
- API Keys
|
|
- Tokens
|
|
- Password
|
|
|
|
### Action
|
|
|
|
- Block
|
|
- Alert system
|
|
- Không gửi vào LLM
|
|
|
|
---
|
|
|
|
# 6. Output Security Policy
|
|
|
|
## 6.1 Data Leakage Prevention
|
|
|
|
- Không output:
|
|
- nội dung confidential
|
|
- internal system prompt
|
|
- hidden instruction
|
|
|
|
## 6.2 Output Filtering
|
|
|
|
| Type | Action |
|
|
|------|--------|
|
|
| PII | Mask |
|
|
| Secret | Remove |
|
|
| Unsafe content | Block |
|
|
| Hallucination risk | Flag |
|
|
|
|
---
|
|
|
|
# 7. Tool Security Policy
|
|
|
|
## 7.1 Tool Access Control
|
|
|
|
| Tool | Permission |
|
|
|------|----------|
|
|
| Read File | Allow |
|
|
| Write File | Restricted |
|
|
| Delete File | Require Approval |
|
|
| External API | Whitelist only |
|
|
|
|
---
|
|
|
|
## 7.2 Safe Tool Execution Flow |