Skip to content

Commit d6f8b85

Browse files
Use generic dates and reorder verification guidance; regenerate skills
1 parent 42eaccf commit d6f8b85

2 files changed

Lines changed: 42 additions & 29 deletions

File tree

skills/software-security/rules/codeguard-1-digital-certificates.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,24 @@ Actively scan for certificate data using the following heuristics:
2222

2323
Once certificate data is identified, flag it for verification. The following properties must be validated to ensure the certificate meets security requirements:
2424

25+
#### Verification Guidance
26+
27+
To inspect certificate properties, recommend running:
28+
```
29+
openssl x509 -text -noout -in <certificate_file>
30+
```
31+
32+
This command displays expiration dates, key algorithm and size, signature algorithm, and issuer/subject information needed for the checks below.
33+
2534
#### Check 1: Expiration Status
2635

27-
- Condition: The certificate's `notAfter` (expiration) date is before June 23, 2025.
36+
- Condition: The certificate's `notAfter` (expiration) date is in the past.
2837

2938
- Severity: CRITICAL VULNERABILITY
3039

3140
- Report Message: `This certificate expired on [YYYY-MM-DD]. It is no longer valid and will be rejected by clients, causing connection failures. It must be renewed and replaced immediately.`
3241

33-
- Condition: The certificate's `notBefore` (validity start) date is after June 23, 2025.
42+
- Condition: The certificate's `notBefore` (validity start) date is in the future.
3443

3544
- Severity: Warning
3645

@@ -68,16 +77,6 @@ Once certificate data is identified, flag it for verification. The following pro
6877
- Report Message: `This is a self-signed certificate. Ensure this is intentional and only used for development, testing, or internal services where trust is explicitly configured. Self-signed certificates should never be used for public-facing production systems as they will not be trusted by browsers or standard clients.`
6978

7079

71-
#### Verification Guidance
72-
73-
To inspect certificate properties, recommend running:
74-
```
75-
openssl x509 -text -noout -in <certificate_file>
76-
```
77-
78-
This command displays expiration dates, key algorithm and size, signature algorithm, and issuer/subject information needed for the checks above.
79-
80-
8180
### 3. Actionable Examples
8281

8382
Your feedback should be direct and easy to understand.

sources/core/codeguard-1-digital-certificates.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tags:
66
alwaysApply: true
77
---
88

9-
When you encounter data that appears to be an X.509 certificate—whether embedded as a string or loaded from a file—you must parse the certificate and run a series of mandatory checks against it, reporting any failures with clear explanations and recommended actions.
9+
When you encounter data that appears to be an X.509 certificate—whether embedded as a string or loaded from a file—you must flag the certificate for verification and ensure the following security properties are validated, reporting any concerns with clear explanations and recommended actions.
1010

1111
### 1. How to Identify Certificate Data
1212

@@ -21,17 +21,26 @@ Actively scan for certificate data using the following heuristics:
2121

2222
### 2. Mandatory Sanity Checks
2323

24-
Once certificate data is identified, you must perform the following validation steps and report the results.
24+
Once certificate data is identified, flag it for verification. The following properties must be validated to ensure the certificate meets security requirements:
25+
26+
#### Verification Guidance
27+
28+
To inspect certificate properties, recommend running:
29+
```
30+
openssl x509 -text -noout -in <certificate_file>
31+
```
32+
33+
This command displays expiration dates, key algorithm and size, signature algorithm, and issuer/subject information needed for the checks below.
2534

2635
#### Check 1: Expiration Status
2736

28-
- Condition: The certificate's `notAfter` (expiration) date is before June 23, 2025.
37+
- Condition: The certificate's `notAfter` (expiration) date is in the past.
2938

3039
- Severity: CRITICAL VULNERABILITY
3140

3241
- Report Message: `This certificate expired on [YYYY-MM-DD]. It is no longer valid and will be rejected by clients, causing connection failures. It must be renewed and replaced immediately.`
3342

34-
- Condition: The certificate's `notBefore` (validity start) date is after June 23, 2025.
43+
- Condition: The certificate's `notBefore` (validity start) date is in the future.
3544

3645
- Severity: Warning
3746

@@ -73,50 +82,55 @@ Once certificate data is identified, you must perform the following validation s
7382

7483
Your feedback should be direct and easy to understand.
7584

76-
Example 1: Flagging an Expired, In-line Certificate
85+
Example 1: Flagging a Hardcoded Certificate
7786

7887
- Code Snippet:
7988

8089
```
8190
# Certificate for connecting to legacy_service
8291
LEGACY_CERT = """
8392
-----BEGIN CERTIFICATE-----
84-
MIIC... (data for a certificate that expired on 2024-12-01) ...
93+
MIIC... (certificate data) ...
8594
-----END CERTIFICATE-----
8695
"""
8796
```
8897
8998
- Your Analysis and Report:
9099
91-
> CRITICAL VULNERABILITY: The certificate stored in the `LEGACY_CERT` variable is invalid.
100+
> Security Review Required: A certificate is hardcoded in the `LEGACY_CERT` variable. Unverified certificates may contain critical vulnerabilities.
92101
>
93-
> - Reason: It expired on 2024-12-01.
102+
> - Concern: Hardcoded certificates cannot be easily rotated and may contain security issues that are not immediately visible in the code.
94103
>
95-
> - Impact: Any TLS connection attempting to use this certificate will fail.
104+
> - Required Verification: This certificate must be verified for:
105+
> - Expiration: Certificate must not be expired or not yet valid
106+
> - Key Strength: RSA keys must be at least 2048-bit; EC keys must use P-256 or higher curve
107+
> - Signature Algorithm: Must use SHA-2 family (not MD5 or SHA-1)
108+
> - Self-Signed: If self-signed, must only be used for development, testing, or internal services
96109
>
97-
> - Action: This certificate must be renewed and the variable updated with the new PEM data immediately.
110+
> - Action: Verify this certificate meets the above requirements before deployment. Consider loading certificates from external files or a certificate store for easier rotation.
98111
>
99112
100113
101-
Example 2: Flagging a Weak Key in a Loaded Certificate
114+
Example 2: Flagging a Certificate Loaded from File
102115
103116
- Code Snippet:
104117
105118
```
106119
// Load the server certificate from disk
107120
cert, err := tls.LoadX509KeyPair("server.crt", "server.key")
108-
// Assume server.crt contains a 1024-bit RSA key.
109121
```
110122
111123
- Your Analysis and Report:
112124
113-
> High-Priority Warning: The certificate being loaded from `server.crt` is using a weak public key.
114-
>
115-
> - Reason: It uses an RSA key with a 1024-bit modulus.
125+
> Security Review Required: Certificate loaded from `server.crt`. Unverified certificates may contain critical vulnerabilities.
116126
>
117-
> - Impact: This key strength is insufficient and vulnerable to modern cryptanalytic attacks.
127+
> - Required Verification: Ensure this certificate meets security requirements:
128+
> - Expiration: Certificate must not be expired or not yet valid
129+
> - Key Strength: RSA keys must be at least 2048-bit; EC keys must use P-256 or higher curve
130+
> - Signature Algorithm: Must use SHA-2 family (not MD5 or SHA-1)
131+
> - Self-Signed: If self-signed, must only be used for development, testing, or internal services
118132
>
119-
> - Action: A new certificate and key must be generated with at least a 2048-bit RSA key or a modern elliptic curve.
133+
> - Action: Verify this certificate meets the above requirements before deployment.
120134
121135
122136
You must always explain how this rule was applied and why it was applied.

0 commit comments

Comments
 (0)