Skip to content

Commit d260e03

Browse files
authored
Merge pull request #57 from project-codeguard/fix/safe-c-func
fix: apply safe-c-functions to c and cpp only
2 parents 0de20e1 + 0dc6850 commit d260e03

File tree

10 files changed

+29
-24
lines changed

10 files changed

+29
-24
lines changed

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"name": "codeguard-security",
1414
"source": "./",
1515
"description": "Comprehensive security rules for AI coding agents",
16-
"version": "1.0.0",
16+
"version": "1.0.1",
1717
"repository": "https://github.com/project-codeguard/rules.git",
1818
"tags": [
1919
"security",

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codeguard-security",
33
"description": "Security code review skill based on Project CodeGuard's comprehensive security rules. Helps AI coding agents write secure code and prevent common vulnerabilities.",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"author": {
66
"name": "Project CodeGuard",
77
"url": "https://project-codeguard.org"

.github/workflows/validate-rules.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ jobs:
5151
"sources/core/codeguard-1-hardcoded-credentials.md"
5252
"sources/core/codeguard-1-crypto-algorithms.md"
5353
"sources/core/codeguard-1-digital-certificates.md"
54-
"sources/core/codeguard-1-safe-c-functions.md"
5554
"sources/core/codeguard-SKILLS.md.template"
5655
)
5756

docs/claude-code-skill-plugin.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,13 @@ When generating or reviewing code, Claude follows this 3-step workflow:
7070

7171
### Rule Categories
7272

73-
**Always-Apply Rules** (4 critical rules checked on every code operation):
73+
**Always-Apply Rules** (3 critical rules checked on every code operation):
7474
- `codeguard-1-hardcoded-credentials` - Never hardcode secrets or credentials
7575
- `codeguard-1-crypto-algorithms` - Use modern cryptographic algorithms
7676
- `codeguard-1-digital-certificates` - Validate certificate security
77-
- `codeguard-1-safe-c-functions` - Replace unsafe C/C++ functions
7877

79-
**Context-Specific Rules** (18 rules applied based on technology and features):
80-
- Input validation, authentication, authorization, APIs, data storage, privacy, logging, cryptography, file handling, serialization, supply chain, DevOps, cloud, Kubernetes, IaC, frameworks, and mobile security
78+
**Context-Specific Rules** (19 rules applied based on technology and features):
79+
- Input validation, authentication, authorization, APIs, data storage, privacy, logging, cryptography, file handling, serialization, supply chain, DevOps, cloud, Kubernetes, IaC, frameworks, mobile security, and memory safety (C/C++)
8180

8281
## Usage Examples
8382

@@ -155,7 +154,7 @@ For organizations, deploy CodeGuard to all developers automatically:
155154

156155
The plugin includes 22 comprehensive security rules organized into two categories:
157156

158-
### Always-Apply Rules (4 rules)
157+
### Always-Apply Rules (3 rules)
159158

160159
These critical rules are checked on **every** code operation:
161160

@@ -164,9 +163,8 @@ These critical rules are checked on **every** code operation:
164163
| `codeguard-1-hardcoded-credentials` | Prevent secrets, passwords, API keys, tokens in source code |
165164
| `codeguard-1-crypto-algorithms` | Ban weak algorithms (MD5, SHA-1, DES); use modern alternatives |
166165
| `codeguard-1-digital-certificates` | Validate certificate expiration, key strength, signature algorithms |
167-
| `codeguard-1-safe-c-functions` | Replace unsafe C/C++ functions (gets, strcpy, strcat, sprintf) |
168166

169-
### Context-Specific Rules (18 rules)
167+
### Context-Specific Rules (19 rules)
170168

171169
These rules apply based on the programming language, framework, or feature being implemented. Claude automatically selects relevant rules based on context:
172170

@@ -182,6 +180,7 @@ These rules apply based on the programming language, framework, or feature being
182180
| **Files & Serialization** | `codeguard-0-file-handling-and-uploads`, `codeguard-0-xml-and-serialization` |
183181
| **Infrastructure** | `codeguard-0-supply-chain-security`, `codeguard-0-devops-ci-cd-containers`, `codeguard-0-cloud-orchestration-kubernetes`, `codeguard-0-iac-security` |
184182
| **Platforms** | `codeguard-0-framework-and-languages`, `codeguard-0-mobile-apps` |
183+
| **Memory Safety (C/C++)** | `codeguard-0-safe-c-functions` |
185184

186185
> **Note:** Each rule file contains detailed guidance, checklists, and examples. Claude references these automatically based on the code context.
187186
@@ -385,6 +384,11 @@ Found an issue with the plugin or want to improve it?
385384

386385
## Version History
387386

387+
### Version 1.0.1
388+
- Changed `codeguard-1-safe-c-functions` from always-apply to `codeguard-0-safe-c-functions` context-specific rule (C/C++ only)
389+
- Updated rule counts: 3 always-apply rules, 19 context-specific rules
390+
- Fixed GitHub Copilot instructions to use `description` field instead of `title`
391+
388392
### Version 1.0.0
389393
- Initial release
390394
- 22 comprehensive security rules

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "project-codeguard"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
description = "AI Coding Rules for Security and Best Practices"
55
requires-python = ">=3.11"
66
dependencies = [

skills/software-security/SKILL.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
name: software-security
33
description: A software security skill that integrates with Project CodeGuard to help AI coding agents write secure code and prevent common vulnerabilities. Use this skill when writing, reviewing, or modifying code to ensure secure-by-default practices are followed.
4-
metadata:
5-
codeguard-version: "1.0.0"
4+
codeguard-version: "1.0.1"
65
framework: "Project CodeGuard"
76
purpose: "Embed secure-by-default practices into AI coding workflows"
87
---
@@ -25,13 +24,13 @@ When writing or reviewing code:
2524
- `codeguard-1-hardcoded-credentials.md` - Never hardcode secrets, passwords, API keys, or tokens
2625
- `codeguard-1-crypto-algorithms.md` - Use only modern, secure cryptographic algorithms
2726
- `codeguard-1-digital-certificates.md` - Validate and manage digital certificates securely
28-
- `codeguard-1-safe-c-functions.md` - Avoid unsafe C/C++ functions and use safe alternatives
2927
2. Context-Specific Rules: Apply rules from /rules directory based on the language of the feature being implemented using the table given below:
3028

3129

3230
| Language | Rule Files to Apply |
3331
|----------|---------------------|
34-
| c | codeguard-0-additional-cryptography.md, codeguard-0-api-web-services.md, codeguard-0-authentication-mfa.md, codeguard-0-authorization-access-control.md, codeguard-0-client-side-web-security.md, codeguard-0-data-storage.md, codeguard-0-file-handling-and-uploads.md, codeguard-0-framework-and-languages.md, codeguard-0-iac-security.md, codeguard-0-input-validation-injection.md, codeguard-0-logging.md, codeguard-0-session-management-and-cookies.md, codeguard-0-xml-and-serialization.md |
32+
| c | codeguard-0-additional-cryptography.md, codeguard-0-api-web-services.md, codeguard-0-authentication-mfa.md, codeguard-0-authorization-access-control.md, codeguard-0-client-side-web-security.md, codeguard-0-data-storage.md, codeguard-0-file-handling-and-uploads.md, codeguard-0-framework-and-languages.md, codeguard-0-iac-security.md, codeguard-0-input-validation-injection.md, codeguard-0-logging.md, codeguard-0-safe-c-functions.md, codeguard-0-session-management-and-cookies.md, codeguard-0-xml-and-serialization.md |
33+
| cpp | codeguard-0-safe-c-functions.md |
3534
| d | codeguard-0-iac-security.md |
3635
| docker | codeguard-0-devops-ci-cd-containers.md, codeguard-0-supply-chain-security.md |
3736
| go | codeguard-0-additional-cryptography.md, codeguard-0-api-web-services.md, codeguard-0-authentication-mfa.md, codeguard-0-authorization-access-control.md, codeguard-0-file-handling-and-uploads.md, codeguard-0-input-validation-injection.md, codeguard-0-session-management-and-cookies.md, codeguard-0-xml-and-serialization.md |

skills/software-security/rules/codeguard-1-safe-c-functions.md renamed to skills/software-security/rules/codeguard-0-safe-c-functions.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
22
description: Safe C Functions and Memory and String Safety Guidelines
3-
alwaysApply: true
3+
languages:
4+
- c
5+
- cpp
6+
alwaysApply: false
47
---
58

6-
rule_id: codeguard-1-safe-c-functions
9+
rule_id: codeguard-0-safe-c-functions
710

811
# Prioritize Safe Memory and String Functions in C/C++
912

sources/core/codeguard-1-safe-c-functions.md renamed to sources/core/codeguard-0-safe-c-functions.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
description: Safe C Functions and Memory and String Safety Guidelines
3-
languages: []
4-
alwaysApply: true
3+
languages:
4+
- c
5+
- cpp
6+
alwaysApply: false
57
---
68

79
# Prioritize Safe Memory and String Functions in C/C++

sources/core/codeguard-SKILLS.md.template

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
name: software-security
33
description: A software security skill that integrates with Project CodeGuard to help AI coding agents write secure code and prevent common vulnerabilities. Use this skill when writing, reviewing, or modifying code to ensure secure-by-default practices are followed.
4-
metadata:
5-
codeguard-version: "1.0.0"
4+
codeguard-version: "x.x.x"
65
framework: "Project CodeGuard"
76
purpose: "Embed secure-by-default practices into AI coding workflows"
87
---
@@ -25,7 +24,6 @@ When writing or reviewing code:
2524
- `codeguard-1-hardcoded-credentials.md` - Never hardcode secrets, passwords, API keys, or tokens
2625
- `codeguard-1-crypto-algorithms.md` - Use only modern, secure cryptographic algorithms
2726
- `codeguard-1-digital-certificates.md` - Validate and manage digital certificates securely
28-
- `codeguard-1-safe-c-functions.md` - Avoid unsafe C/C++ functions and use safe alternatives
2927
2. Context-Specific Rules: Apply rules from /rules directory based on the language of the feature being implemented using the table given below:
3028
<!-- LANGUAGE_MAPPINGS_START -->
3129
<!-- LANGUAGE_MAPPINGS_END -->

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)