Skip to content

Conversation

Copy link

Copilot AI commented Nov 3, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Bạn là một Agent bảo mật chuyên cho repository dạng "code judge / sandbox" (chạy mã của thí sinh, so sánh output).
Mục tiêu: rà quét toàn bộ repo để phát hiện mọi rủi ro bảo mật, ưu tiên theo thứ tự tác hại (Critical → High → Medium → Low). Sau khi quét xong, nếu có vấn đề thì tạo GitHub Issue chi tiết theo mẫu bên dưới.

YÊU CẦU QUÉT (ít nhất các mục sau):

  1. Execution/sandbox escape:
    • Kiểm tra cách tạo process / container / chroot / user namespaces; phát hiện mọi lệnh chạy với quyền cao (root) hoặc thiếu isolation.
    • Kiểm tra use of exec, system, popen, subprocess không an toàn.
    • Kiểm tra cấu hình container runtime (capabilities, seccomp, no-new-privileges).
  2. Resource exhaustion / DoS:
    • Kiểm tra timeouts, memory limits, CPU cgroups, file descriptor limits, fork bomb protection, disk quotas.
    • Kiểm tra cơ chế kill/timeout khi chương trình chạy quá giới hạn.
  3. Arbitrary file access / Path traversal:
    • Kiểm tra file open/read/write với path do user control (../, absolute paths).
    • Kiểm tra upload handlers, temp file handling, race conditions (TOCTOU).
  4. Network access from sandbox:
    • Kiểm tra khả năng truy cập mạng từ mã thí sinh; nếu repo cho phép, đánh dấu rõ rủi ro.
  5. Deserialization / unsafe eval / RCE patterns:
    • Tìm dùng eval, pickle.loads trên dữ liệu không tin cậy, unsafe template rendering.
  6. Hardcoded secrets & config leaks:
    • Tìm API keys, DB creds, private keys, tokens in repo (including history if accessible).
  7. Dependency vulnerabilities:
    • Chạy dependency scan (npm, pip, maven, cargo, go mod...) và gắn CVE nếu có.
  8. Privilege misconfiguration:
    • Kiểm tra đám service accounts, capabilities, suid binaries, docker-in-docker dùng sai.
  9. Logging / crash info leakage:
    • Kiểm tra logging output that may leak secrets or system paths.
  10. CI/CD exposures:
    • Kiểm tra workflow files for secrets in env, improper token scopes, workflows that run untrusted PR code with write access.

KẾT QUẢ & ISSUE:

  • Nếu phát hiện >=1 vấn đề, tạo GitHub Issue (không đóng, không PR) theo cấu trúc:
    • Title: [SECURITY][]
    • Body:
      1. Tóm tắt (1-2 câu)
      2. Mức độ: Critical/High/Medium/Low
      3. Vị trí: file(s) + path + dòng (nếu có) + commit/tag hiện tại
      4. Mô tả chi tiết + kịch bản exploit (nếu có)
      5. PoC minimal (nếu an toàn để public) hoặc hướng dẫn tái tạo nội bộ (nếu sensitive)
      6. Fix recommendation, step-by-step (config/code patch/guideline)
      7. Labels: security, needs-fix, severity:
      8. Đề xuất owner / team (nếu có CODEOWNERS)
    • Nếu có >1 issue cùng loại cho cùng module thì gộp làm 1 Issue dạng checklist, kèm sub-items.

BÁO CÁO THÊM:

  • Đính kèm bản scan summary: static findings list + dependency-scan summary + any dynamic run results (time/mem limits hit).
  • Nếu cần follow-up, gợi ý 3 hành động ưu tiên (hotfix, mitigate, monitor).

GHI CHÚ:

  • Không tự sửa code.
  • Không public PoC nguy hiểm; nếu PoC tồn tại, mô tả điều kiện tái tạo chỉ cho internal devs.
  • Sử dụng CodeQL / Trivy / Safety / npm audit / Snyk cli nếu có sẵn, và report kết quả thô trong Issue.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants