Skip to content

Commit b4f51c1

Browse files
authored
Merge pull request #11335 from zainasir/feat/security-badge
add security status badge
2 parents 50f78d9 + 0b410a3 commit b4f51c1

File tree

3 files changed

+67
-5
lines changed

3 files changed

+67
-5
lines changed

.circleci/config.yml

+62-1
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,65 @@ jobs:
458458
echo "Individual reports for master and pr have been saved under the Artifacts tab."
459459
exit 0
460460
fi
461+
- persist_to_workspace:
462+
root: /tmp/repos
463+
paths:
464+
- master_report.sbom
461465
- store_artifacts:
462466
path: /tmp/repos/master_report.sbom
463467
- store_artifacts:
464468
path: /tmp/repos/pr_report.sbom
465469

470+
update_security_status_badge:
471+
machine:
472+
image: ubuntu-2204:2024.08.1
473+
resource_class: medium
474+
working_directory: /tmp/repos
475+
environment:
476+
SUCCESS_MESSAGE: 'passing'
477+
SUCCESS_COLOR: 'brightgreen'
478+
FAILURE_MESSAGE: 'failing'
479+
FAILURE_COLOR: 'FF0A0A'
480+
SEVERITY_THRESHOLD: 'CRITICAL'
481+
TEST_REPO_URL: '[email protected]:cBioPortal/cbioportal-test.git'
482+
steps:
483+
- attach_workspace:
484+
at: /tmp/repos
485+
- add_ssh_keys:
486+
fingerprints:
487+
- "SHA256:vtzpWrYBLQAMgZIsEv3Nuc1HeINJXFFtUB+IpSY/AK4"
488+
- run:
489+
name: Set up git user
490+
command: |
491+
git config --global user.name "CircleCI Bot"
492+
git config --global user.email "[email protected]"
493+
- run:
494+
name: Clone test repo using ssh url
495+
command: |
496+
rm -rf cbioportal-test
497+
git clone $TEST_REPO_URL
498+
- run:
499+
name: Count vulnerabilities and update status badge
500+
command: |
501+
COUNT=$(jq '[.[] | select(.severity == "$SEVERITY_THRESHOLD")] | length' master_report.sbom)
502+
cd cbioportal-test
503+
if [ $COUNT -eq 0 ]; then
504+
jq --arg msg "$SUCCESS_MESSAGE" --arg col "$SUCCESS_COLOR" '.message = $msg | .color = $col' security-status.json > temp.json
505+
else
506+
jq --arg msg "$FAILURE_MESSAGE" --arg col "$FAILURE_COLOR" '.message = $msg | .color = $col' security-status.json > temp.json
507+
fi
508+
mv temp.json security-status.json
509+
echo "security-status.json has been updated:"
510+
cat security-status.json | jq
511+
- run:
512+
name: Push new security status to cbioportal/cbioportal-test
513+
command: |
514+
cd cbioportal-test
515+
git diff
516+
git add security-status.json
517+
git commit -m "Update security status"
518+
git push
519+
466520
workflows:
467521
end_to_end_tests:
468522
jobs:
@@ -501,4 +555,11 @@ workflows:
501555
context:
502556
- docker-scout
503557
requires:
504-
- build_image
558+
- build_image
559+
- update_security_status_badge:
560+
requires:
561+
- run_security_tests
562+
filters:
563+
branches:
564+
only:
565+
- master

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# cBioPortal
22

3+
[![Endpoint Badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FcBioPortal%2Fcbioportal-test%2Frefs%2Fheads%2Fmain%2Fsecurity-status.json)](https://docs.cbioportal.org/development/security/)
4+
35
The cBioPortal for Cancer Genomics provides visualization, analysis, and download of large-scale cancer genomics data sets. For a short intro on cBioPortal, see [these introductory slides](https://docs.google.com/presentation/d/1hm0G77UklZnpQfFvywBfW2ZIsy8deKi5r1RfJarOPLg/edit?usp=sharing).
46

57
If you would like to know how to setup a private instance of the portal and/or get set up for developing, see the [documentation](https://docs.cbioportal.org). For details on contributing code changes via pull requests, see our [Contributing document](CONTRIBUTING.md).

docs/development/Security.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
# Security
22
We are committed to maintaining a secure and reliable platform by integrating proactive vulnerability detection and mitigation strategies into our development and release workflows. Here's how we address security concerns at each stage of our development process.
33

4-
---
4+
## Current Vulnerability Status
5+
We provide a [status badge](https://github.com/cBioPortal/cbioportal?tab=readme-ov-file#cbioportal) that displays the current vulnerability status of the cBioPortal application. Additionally, we maintain a Software Bill of Materials (SBOM) integrated with our Github Dependabot Security system.
6+
57
## Vulnerability Detection in Pull Requests
68
We utilize **SonarCloud** to ensure the integrity and security of our codebase. SonarCloud is configured to automatically analyze all pull requests and merged code. This enables us to:
79
- Detect security vulnerabilities, bugs, and code smells during the review process.
810
- Generate detailed reports that identify specific issues, such as potential injections, insecure code patterns, or other security risks.
911
- Enforce quality gates that prevent merging unsafe code into the main branch.
1012
The results of the analysis are presented as part of the Github pull request checks, allowing contributors and maintainers to address issues early in the development lifecycle.
11-
---
1213

1314
## Container Image Security with Docker Scout
1415
As part of our release process, we integrate **Docker Scout** to ensure the security of container images published to our public DockerHub repository. Key steps include:
1516
- **Automated Scanning:** Every time a Docker image is built and pushed, Docker scout performs an in-depth analysis of all base layers and dependencies.
1617
- **Detailed Reports:** Vulnerabilities are categorized by severity, and actionable remediation steps are provided. This ensures maintainers can quickly patch or replace vulnerable components.
1718
- **Image Maintenance:** We montior and rebuild images when new vulnerabilities are detected in upstream dependencies, ensuring our images remain secure.
1819
Docker Scout is a critical step in the release pipeline, ensuring that the container images used by our users are secure and free from known vulnerabilities.
19-
---
2020

2121
## Continuous Monitoring and Updates
2222
SonarCloud and Docker Scout work seamlessly within our development and release workflows:
2323
- **SonarCloud** safeguards the integrity of the codebase during pull requests and merges.
2424
- **Docker Scout** validates the security of container images as part of our weekly release cycle.
2525
This dual-layered approach ensures that vulnerabilities are addressed both at the source code and container levels, offering comprehensive security coverage for the cBioPortal platform.
26-
---
2726

2827
## Feedback and Contributions
2928
We encourage the community to provide feedback and suggestions to enhance our security processes. If you have any questions or ideas, please contact us or submit an issue on our [Github repository](https://github.com/cBioPortal/cbioportal/security/policy).

0 commit comments

Comments
 (0)