Repository navigation
feat: Implement SARIF output format for native GitHub Code Scanning integration #7
Description
Overview
GitHub Code Scanning natively ingests SARIF files and displays findings as inline annotations in pull request diffs and the Security tab. Adding SARIF output lets ChainProof integrate with this first-class security workflow instead of relying on custom PR comments.
Current Limitations
- PR comments are noisy and do not persist in the Security tab
- core.error() annotations disappear after the workflow run
- No integration with GitHub's security dashboard
SARIF Structure
{
"version": "2.1.0",
"runs": [{
"tool": {
"driver": {
"name": "ChainProof",
"rules": [{ "id": "CP-107", "name": "Reentrancy", "helpUri": "https://swcregistry.io/docs/SWC-107" }]
}
},
"results": [{
"ruleId": "CP-107",
"level": "error",
"message": { "text": "Reentrancy vulnerability detected" },
"locations": [{
"physicalLocation": {
"artifactLocation": { "uri": "contracts/Vault.sol" },
"region": { "startLine": 42, "endLine": 48 }
}
}]
}]
}]
}Severity Mapping
| ChainProof | SARIF Level |
|---|---|
| critical | error |
| high | error |
| medium | warning |
| low | note |
| info / gas | none |
Proposed Changes
- Add generateSARIFReport(result: ScanResult): string to the report generator
- CLI: --format sarif flag, defaults output to chainproof-results.sarif
- GitHub Action: generate and upload SARIF via github/codeql-action/upload-sarif@v3, replacing core.error() annotations
Acceptance Criteria
- generateSARIFReport() implemented and exported from core
- SARIF output validates against SARIF 2.1.0 JSON schema
- CLI --format sarif flag implemented
- GitHub Action uploads SARIF, findings appear in Security tab
- Rule metadata (id, name, helpUri) included in tool.driver.rules
- Tested against GitHub SARIF validator
References
Maintainer Scope Upgrade
This issue is being expanded into a substantial, production-quality ChainProof enhancement. The implementation should be designed as maintainable platform work, not as a narrow proof of concept. A successful pull request must provide a cohesive user-facing capability, typed internal APIs, robust tests, documentation, and CI-safe behavior.
Expanded Objective
Deliver native GitHub Code Scanning integration through standards-compliant SARIF generation, validation, CLI support, and GitHub Action upload behavior. The feature should fit the existing monorepo architecture, reuse current scanner/report/CLI patterns where appropriate, and avoid introducing ad hoc subsystems that are difficult to test or maintain.
Required Implementation Depth
This issue is intentionally scoped to require more than 700 lines of meaningful implementation work. The line count expectation applies to purposeful source, tests, fixtures, and documentation that are necessary to deliver the feature. It must not be satisfied through generated output, lockfile churn, formatting-only changes, duplicated boilerplate, or artificial padding.
Expected work includes:
- A SARIF 2.1.0 report generator with complete rule metadata, locations, severity mapping, and deterministic output.
- CLI and GitHub Action wiring for
--format sarif, default output paths, artifact retention, and upload throughgithub/codeql-action/upload-sarif. - Schema validation fixtures and regression tests covering empty scans, multiple files, duplicate findings, gas/info filtering, and severity mapping.
- Public or internal types/interfaces where they clarify behavior and reduce future integration risk.
- Failure-mode handling for invalid input, missing configuration, unavailable optional dependencies, and degraded execution paths.
- Documentation updates that explain how maintainers and users should operate the new capability in local and CI environments.
Professional Quality Bar
The implementation must be production-ready and reviewable in isolation. Contributors should include clear separation between parsing, analysis, reporting, CLI/action integration, and persistence or provider code where those concerns apply. The code should follow existing ChainProof conventions, keep behavior deterministic in tests, and avoid coupling core analysis to network-only services unless explicitly optional and mocked.
Acceptance Criteria
- The delivered PR contains more than 700 meaningful lines of implementation across source, tests, fixtures, and docs, excluding generated files and lockfile-only changes.
- The feature is integrated into the relevant package entrypoints, CLI commands, report formats, GitHub Action behavior, or documentation as appropriate for this issue.
- Unit tests cover normal operation, edge cases, invalid inputs, and at least one realistic fixture or end-to-end workflow.
- Any optional external service, model provider, database, or platform integration has deterministic mocks or fallbacks so CI does not depend on secrets or network availability.
- User-facing output is documented and stable enough for downstream automation.
- Backward compatibility is preserved unless the PR explicitly documents a migration path and the maintainer approves it.
Mandatory CI and Merge Requirements
A PR resolving this issue must not be merged until all repository CI checks pass. At minimum, reviewers should verify the following from a clean checkout:
npm cinpm run lintnpm run build --workspaces --if-presentnpm run test:ci --workspace=packages/corenpm test --workspaces --if-presentnpm run build --workspace=packages/core && npm run docs --workspace=packages/core- Any package-specific tests, examples, validators, or integration checks introduced by the PR
If the PR adds a GitHub Action, report format, dashboard, persistence layer, or external integration, it must also include CI coverage or a documented local verification command for that path. Known warnings are acceptable only when they are documented and do not hide failures.
Review Expectations
Reviewers should reject PRs that only stub APIs, add superficial wrappers, omit tests for critical behavior, rely on live secrets in CI, or meet the line-count target through non-functional bulk changes. The preferred solution is a focused but complete vertical slice that leaves ChainProof more reliable, easier to operate, and easier to extend.
Activity
Babigdk commentedon Jun 19, 2026
Proposal: SARIF Export Integration for ChainProof (GitHub Code Scanning Support)
I’d like to implement SARIF 2.1.0 output support so ChainProof findings can integrate directly into GitHub Code Scanning and the Security tab.
Scope of Work:
Implement
generateSARIFReport(result: ScanResult): stringin the report generatorAdd CLI flag
--format sarif(default output:chainproof-results.sarif)Map ChainProof severities to SARIF levels:
Include full rule metadata (
id,name,helpUri) indriver.rulesConvert findings into SARIF
resultswith accurate file + line mappingsEnsure compliance with SARIF 2.1.0 schema
Replace GitHub PR
core.error()annotations with SARIF upload flowUpdate GitHub Action to use
github/codeql-action/upload-sarif@v3Deliverables:
--format sarifsupportGoal:
Enable native GitHub Security tab integration and improve long-term visibility and traceability of ChainProof findings.
Senorespecial commentedon Jun 19, 2026
I would like to work on this issue, please assign
guptakumarranjeet150 commentedon Sep 15, 2026
Hello team,
I can tackle
feat: Implement SARIF output format for native GitHub Code Scanning integration. Proposed implementation roadmap:StellarChainproof/StellarChainproofsfeat: Implement SARIF output format for native GitHub Code Scanning integrationfollowingStellarChainproof/StellarChainproofsconventions.Happy to pick this up today—please assign to me!
guptakumarranjeet150 commentedon Sep 30, 2026
Hello @maintainers,
I am interested in working on this issue.
Plan:
feat: Implement SARIF output format for native GitHub Code Scanning integrationfollowingStellarChainproof/StellarChainproofsconventions.Looking forward to collaborating on this—please assign!
grantfox-oss commentedon Oct 9, 2026
🎉 This issue has been marked as completed on GrantFox!
@guptakumarranjeet150's PR #119 was approved and merged by @Nanle-code.
🏆 @guptakumarranjeet150: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (455 total points). Track your full progress on GrantFox.
👏 Great work, @guptakumarranjeet150! Keep contributing to StellarChainproof.