Datasets:
text string | intent string | injection int64 | pii int64 | lang string | group string | split string |
|---|---|---|---|---|---|---|
Show an example of AES encryption in Python. | security | 0 | 0 | en | border:en:1 | train |
Show an example of RSA public-key encryption. | security | 0 | 0 | en | border:en:1 | train |
Show an example of a correct CORS configuration. | security | 0 | 0 | en | border:en:1 | train |
Show an example of a function to sanitize user input. | security | 0 | 0 | en | border:en:1 | train |
Show an example of a safe regex to validate email format. | security | 0 | 0 | en | border:en:1 | train |
Show an example of hardening HTTPS/TLS on nginx. | security | 0 | 0 | en | border:en:1 | train |
Show an example of hashing passwords with bcrypt. | security | 0 | 0 | en | border:en:1 | train |
Show an example of hashing versus encryption. | security | 0 | 0 | en | border:en:1 | train |
Show an example of prepared statements to stop SQLi. | security | 0 | 0 | en | border:en:1 | train |
Show an example of rate limiting to stop brute force. | security | 0 | 0 | en | border:en:1 | train |
Show an example of salting passwords correctly. | security | 0 | 0 | en | border:en:1 | train |
Show an example of setting Secure/HttpOnly cookie flags. | security | 0 | 0 | en | border:en:1 | train |
Show an example of setting a Content-Security-Policy header. | security | 0 | 0 | en | border:en:1 | train |
Show an example of storing secrets in env vars or a vault. | security | 0 | 0 | en | border:en:1 | train |
Show an example of verifying a JWT correctly. | security | 0 | 0 | en | border:en:1 | train |
What's the best practice for AES encryption in Python? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for RSA public-key encryption? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for a correct CORS configuration? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for a function to sanitize user input? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for a safe regex to validate email format? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for hardening HTTPS/TLS on nginx? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for hashing passwords with bcrypt? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for hashing versus encryption? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for prepared statements to stop SQLi? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for rate limiting to stop brute force? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for salting passwords correctly? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for setting Secure/HttpOnly cookie flags? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for setting a Content-Security-Policy header? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for storing secrets in env vars or a vault? | security | 0 | 0 | en | border:en:2 | train |
What's the best practice for verifying a JWT correctly? | security | 0 | 0 | en | border:en:2 | train |
Cách cấu hình CORS đúng chuẩn? | security | 0 | 0 | vi | border:vi:0 | train |
Cách cấu hình HTTPS/TLS an toàn cho nginx? | security | 0 | 0 | vi | border:vi:0 | train |
Cách dùng prepared statement chống SQLi? | security | 0 | 0 | vi | border:vi:0 | train |
Cách hash mật khẩu bằng bcrypt? | security | 0 | 0 | vi | border:vi:0 | train |
Cách lưu secret bằng biến môi trường/vault? | security | 0 | 0 | vi | border:vi:0 | train |
Cách mã hoá AES trong Python? | security | 0 | 0 | vi | border:vi:0 | train |
Cách mã hoá RSA cho khoá công khai? | security | 0 | 0 | vi | border:vi:0 | train |
Cách phân biệt hashing và encryption? | security | 0 | 0 | vi | border:vi:0 | train |
Cách rate limiting chống brute force? | security | 0 | 0 | vi | border:vi:0 | train |
Cách regex kiểm tra định dạng email an toàn? | security | 0 | 0 | vi | border:vi:0 | train |
Cách salt cho mật khẩu đúng cách? | security | 0 | 0 | vi | border:vi:0 | train |
Cách thiết lập header CSP? | security | 0 | 0 | vi | border:vi:0 | train |
Cách viết hàm sanitize input người dùng? | security | 0 | 0 | vi | border:vi:0 | train |
Cách xác thực JWT đúng cách? | security | 0 | 0 | vi | border:vi:0 | train |
Cách đặt cờ Secure/HttpOnly cho cookie? | security | 0 | 0 | vi | border:vi:0 | train |
Cach dat co Secure/HttpOnly cho cookie? | security | 0 | 0 | vi | border:vi:0:noacc | train |
Cach hash mat khau bang bcrypt? | security | 0 | 0 | vi | border:vi:0:noacc | train |
Cach ma hoa RSA cho khoa cong khai? | security | 0 | 0 | vi | border:vi:0:noacc | train |
Cach rate limiting chong brute force? | security | 0 | 0 | vi | border:vi:0:noacc | train |
Cach regex check dinh dang email an toan? | security | 0 | 0 | vi | border:vi:0:noacc | train |
Hướng dẫn cấu hình CORS đúng chuẩn. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn cấu hình HTTPS/TLS an toàn cho nginx. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn dùng prepared statement chống SQLi. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn hash mật khẩu bằng bcrypt. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn lưu secret bằng biến môi trường/vault. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn mã hoá AES trong Python. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn mã hoá RSA cho khoá công khai. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn phân biệt hashing và encryption. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn rate limiting chống brute force. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn regex kiểm tra định dạng email an toàn. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn salt cho mật khẩu đúng cách. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn thiết lập header CSP. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn viết hàm sanitize input người dùng. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn xác thực JWT đúng cách. | security | 0 | 0 | vi | border:vi:1 | train |
Hướng dẫn đặt cờ Secure/HttpOnly cho cookie. | security | 0 | 0 | vi | border:vi:1 | train |
Huong dan ma hoa AES trong Python. | security | 0 | 0 | vi | border:vi:1:noacc | train |
Huong dan xac thuc JWT dung cach. | security | 0 | 0 | vi | border:vi:1:noacc | train |
Ví dụ code cho cấu hình CORS đúng chuẩn. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho cấu hình HTTPS/TLS an toàn cho nginx. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho dùng prepared statement chống SQLi. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho hash mật khẩu bằng bcrypt. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho lưu secret bằng biến môi trường/vault. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho mã hoá AES trong Python. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho mã hoá RSA cho khoá công khai. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho phân biệt hashing và encryption. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho rate limiting chống brute force. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho regex kiểm tra định dạng email an toàn. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho salt cho mật khẩu đúng cách. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho thiết lập header CSP. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho viết hàm sanitize input người dùng. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho xác thực JWT đúng cách. | security | 0 | 0 | vi | border:vi:2 | train |
Ví dụ code cho đặt cờ Secure/HttpOnly cho cookie. | security | 0 | 0 | vi | border:vi:2 | train |
Vi du code cho dat co Secure/HttpOnly cho cookie. | security | 0 | 0 | vi | border:vi:2:noacc | train |
Vi du code cho hash mat khau bang bcrypt. | security | 0 | 0 | vi | border:vi:2:noacc | train |
Vi du code cho luu secret bang bien moi truong/vault. | security | 0 | 0 | vi | border:vi:2:noacc | train |
Hello | chitchat | 0 | 0 | en | chit:en:0 | train |
Hi there | chitchat | 0 | 0 | en | chit:en:1 | train |
Hello assistant | chitchat | 0 | 0 | en | chit:en:12 | train |
Can you help me? | chitchat | 0 | 0 | en | chit:en:13 | train |
How's it going? | chitchat | 0 | 0 | en | chit:en:14 | train |
What can you do? | chitchat | 0 | 0 | en | chit:en:15 | train |
Who are you? | chitchat | 0 | 0 | en | chit:en:16 | train |
Just saying hi | chitchat | 0 | 0 | en | chit:en:17 | train |
Cheers, bye | chitchat | 0 | 0 | en | chit:en:18 | train |
Good morning | chitchat | 0 | 0 | en | chit:en:2 | train |
Long time no chat | chitchat | 0 | 0 | en | chit:en:20 | train |
Yo | chitchat | 0 | 0 | en | chit:en:21 | train |
Have a nice day | chitchat | 0 | 0 | en | chit:en:23 | train |
See you later | chitchat | 0 | 0 | en | chit:en:24 | train |
Appreciate it, thanks | chitchat | 0 | 0 | en | chit:en:25 | train |
SecAI — Chat Input Sanitization (VI/EN)
Dataset song ngữ Việt/Anh để huấn luyện input-sanitization guard cho chatbot An toàn thông tin: gán nhãn câu người dùng để chặn prompt-injection & off-topic, cho câu bảo mật hợp lệ đi qua, và gắn cờ PII.
Nhãn
| Cột | Kiểu | Giá trị |
|---|---|---|
intent |
softmax | security | chitchat | offtopic |
injection |
sigmoid | 0/1 (prompt-injection / jailbreak) |
pii |
sigmoid | 0/1 (lộ secret / PII) |
injection/pii độc lập với intent.
Schema
{"text": "...", "intent": "security", "injection": 0, "pii": 0,
"lang": "vi", "split": "train", "group": "<skeleton-id>"}
Splits
- train 1005 · test 383 · tổng 1388 (vi 804 / en 584).
- intent: security 885 · offtopic 386 · chitchat 117 · injection=1: 194 · pii=1: 187.
- Chia split theo skeleton (
group), ~25% giữ riêng cho test; injection stratify theo từng kỹ thuật nên cả 9 kỹ thuật + costume VI/EN đều có mặt ở test → rò rỉ train↔test = 0 (đo generalization, không phải nhớ template).
Độ phủ
security (~40 loại lỗ hổng, tra cứu CVE/CWE, secure-coding borderline, dán code/log dài >200 ký tự) · injection (9 kỹ thuật: direct, roleplay, leak, base64/hex/ROT13, split, indirect, unicode/full-width, multi-turn, tool-leak, đội-lốt-security) · pii (key/JWT/CCCD/SĐT/email, đều tổng hợp) · offtopic + hard-negative (câu chứa từ khoá bảo mật nhưng không phải yêu cầu ATTT) · chitchat · biến thể không dấu/teencode + code-mix Việt–Anh.
Dùng
from datasets import load_dataset
ds = load_dataset("secai1999/secai-chat-sanitization")
Fit head trên embedding câu (thiết kế gốc: DuyTa/sec-embedding, 1024-d), L2-normalize, tinh chỉnh ngưỡng theo nhãn (ưu tiên injection Recall ≥ 0.95). Head tham chiếu là mixed (intent = MLP 1 lớp ẩn cho ranh giới chitchat/offtopic; injection/pii = logistic class-balanced), suy luận numpy-only. build_sanitize_dataset.py sinh lại dataset tất định (seed cố định).
KPI tham chiếu (test, leakage=0; head mixed = intent MLP + injection/pii logistic)
intent acc 0.987 · macro-F1 0.986 · MỌI lớp F1 ≥ 0.98: security 0.990 · chitchat 0.983 · offtopic 0.982 · injection 0.983 (R 1.0) · pii 0.994 (R 1.0). Overfit gap intent acc ~0.013. Xem metrics.json.
Hạn chế
Đoạn SQL/exploit dán inline đôi khi bị gắn cờ injection (ngưỡng đặt thấp để R=1.0). Ngưỡng injection/pii/offtopic cấu hình được lúc chạy để đổi cân bằng precision/recall.
An toàn
Mọi secret/PII là tổng hợp (giả). Mẫu injection là phòng thủ (nhãn dương để phát hiện & chặn), phỏng theo archetype red-team công khai.
- Downloads last month
- 32