This repository is for the work of the Coalition for Secure AI (CoSAI). CoSAI is an OASIS Open Project and an open ecosystem of AI and security experts from industry-leading organizations. We are dedicated to sharing best practices for secure AI deployment and collaborating on AI security research and tool development.
For more information on CoSAI, please visit the CoSAI website and the Open Project repository, which contains our governance information and project charter.
Project CodeGuard is an open-source, model-agnostic security framework that embeds secure-by-default practices into AI coding agent workflows. It provides security guidance that AI assistants can use during code generation and review.
AI coding agents can produce code that omits important security controls or uses unsafe patterns. Common problems include:
- Missing input validation
- Hardcoded secrets and credentials
- Weak cryptographic algorithms
- Unsafe functions
- Missing authentication or authorization checks
CodeGuard gives agents guidance for these decisions throughout development. It can inform security requirements during planning, help an agent select safer implementation patterns, and support the review of existing code.
Project CodeGuard skills and rules cover essential security domains:
- Cryptography: Safe algorithms (including post-quantum cryptography), secure key management, certificate validation
- Input Validation: SQL injection prevention, XSS protection, command injection defense
- Authentication: MFA best practices, OAuth/OIDC, secure session management
- Authorization: RBAC/ABAC, access control, IDOR prevention
- Supply Chain: Dependency security, SBOM generation, vulnerability management
- Cloud Security: IaC hardening, container security, Kubernetes best practices
- Platform Security: Mobile apps, web services, API security
- Data Protection: Privacy, encryption at rest/transit, secure storage
CodeGuard is an Agent Skill: a folder of instructions and security guidance for your coding agent. For personal use, install a released version in your user skill directory so it is available across projects.
-
Download Source code (zip) from the latest release and extract it. The skill folder is
skills/codeguard/inside the extracted directory. -
Copy that complete
codeguard/folder to your client's personal skill location:Client Personal skill location Claude Code ~/.claude/skills/codeguard/Codex ~/.agents/skills/codeguard/Here,
~means your home directory. For other clients, use their supported Agent Skills location. -
Start a new client session and ask: “Use CodeGuard to review this authentication code for security issues.”
See Getting Started for updating an existing installation, project-level installation, and plugin options.
CodeGuard gives your agent security guidance to consult while planning, writing, or reviewing code. The skill's instructions describe when to use that guidance and how to apply it to the task.
Use CodeGuard alongside your existing tests, security scanners, and human review. For more focused tasks, the repository also includes security-review and memory-safe-migration workflows.