Skip to content

Commit 50c3383

Browse files
committed
cve or GHSA
1 parent 004d201 commit 50c3383

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

.github/copilot-instructions.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,68 @@ PR organization:
594594

595595
---
596596

597+
## Security Vulnerability (CVE) Handling
598+
599+
### Reviewing CVE Issues
600+
When asked to review a CVE issue:
601+
1. **Fetch the issue** using `github-pull-request_issue_fetch`
602+
2. **Check if the vulnerable file still exists** - use `file_search` or `read_file`
603+
3. **Verify the specific vulnerability** - check if input sanitization is in place
604+
4. **Focus on security fixes only** - ignore code style issues unless explicitly requested
605+
606+
### Common Security Fixes
607+
608+
**SQL Injection Prevention:**
609+
```php
610+
// CORRECT - Use InputUtils::filterInt() for integer parameters
611+
$iCurrentFundraiser = InputUtils::filterInt($_GET['CurrentFundraiser']);
612+
$tyid = InputUtils::filterInt($_POST['EN_tyid']);
613+
614+
// CORRECT - Use Propel ORM (parameterized queries)
615+
$event = EventQuery::create()->findOneById((int)$eventId);
616+
617+
// WRONG - Raw SQL with unsanitized input
618+
$sSQL = "SELECT * FROM table WHERE id = " . $_GET['id'];
619+
RunQuery($sSQL);
620+
```
621+
622+
**XSS Prevention:**
623+
```php
624+
// CORRECT - Escape output
625+
<?= htmlspecialchars($value, ENT_QUOTES, 'UTF-8') ?>
626+
<?= htmlentities($value, ENT_QUOTES, 'UTF-8') ?>
627+
628+
// WRONG - Unescaped output
629+
<?= $value ?>
630+
```
631+
632+
### CVE Issue Response Format
633+
When a CVE issue is confirmed fixed, provide this response in a markdown code block:
634+
635+
```markdown
636+
**Issue #XXXX (CVE-YYYY-ZZZZZ) - [Brief Description]:**
637+
638+
[Explanation of how the vulnerability was fixed - 1-2 sentences]
639+
640+
We are deleting this issue to ensure the software's safety. Please refer to the new https://github.com/ChurchCRM/CRM/security/policy for reporting CVE issues. Thank you again for reporting it and helping keep our software secure. Happy to accept the CVE via the new process.
641+
```
642+
643+
### Automated CVE Detection Workflow
644+
The repository has an automated GitHub Actions workflow (`.github/workflows/issue-comment.yml`) that:
645+
1. Detects CVE mentions in issue titles or bodies (patterns: `CVE-`, `CVE-YYYY-NNNNN`, or `GHSA-xxxx-xxxx-xxxx`)
646+
2. Posts a security comment from `.github/issue-comments/security.md`
647+
3. Adds `security` and `security-delete-required` labels
648+
4. Closes the issue automatically
649+
650+
This ensures security vulnerabilities are not publicly disclosed and directs reporters to use GitHub Security Advisories instead.
651+
652+
### Security Policy Reference
653+
- Security policy: `SECURITY.md` in repository root
654+
- Private disclosure: https://github.com/ChurchCRM/CRM/security/advisories
655+
- Issue comment templates: `.github/issue-comments/security.md`
656+
657+
---
658+
597659
## V2 Upgrade Wizard Architecture
598660

599661
ChurchCRM implements a modern upgrade system at `/v2/admin/upgrade` with bs-stepper wizard.

.github/workflows/issue-comment.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ jobs:
6161
const bodyLower = body.toLowerCase();
6262
6363
// Check for CVE mentions in title or body (security vulnerability disclosure)
64-
// Match full CVE format (CVE-2025-1234) or partial (CVE-)
64+
// Match full CVE format (CVE-2025-1234), partial (CVE-), or GitHub Security Advisory (GHSA-xxxx-xxxx-xxxx)
6565
const cvePattern = /cve-(\d{4}-\d+)?/i;
66-
const hasCVE = cvePattern.test(title) || cvePattern.test(body);
66+
const ghsaPattern = /ghsa-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}/i;
67+
const hasCVE = cvePattern.test(title) || cvePattern.test(body) || ghsaPattern.test(title) || ghsaPattern.test(body);
6768
6869
// Check if system info was collected (in-app reporter includes "Collected Value Title")
6970
const hasSystemInfo = bodyLower.includes('collected value title');

0 commit comments

Comments
 (0)