{"id":36823661,"url":"https://github.com/scanoss/gha-code-scan","last_synced_at":"2026-02-09T19:20:13.495Z","repository":{"id":218064479,"uuid":"745497381","full_name":"scanoss/gha-code-scan","owner":"scanoss","description":"SCANOSS GitHub Action to scan your source code using the SCANOSS Platform","archived":false,"fork":false,"pushed_at":"2025-12-12T10:28:28.000Z","size":2990,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-12-13T23:09:50.198Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://scanoss.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scanoss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-19T13:16:50.000Z","updated_at":"2025-12-12T10:24:49.000Z","dependencies_parsed_at":"2024-01-29T13:39:53.750Z","dependency_job_id":"4c80cb76-4412-4cc0-8ac1-c409a8178cc5","html_url":"https://github.com/scanoss/gha-code-scan","commit_stats":null,"previous_names":["scanoss/actions-scan","scanoss/code-scan-action","scanoss/gha-code-scan"],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/scanoss/gha-code-scan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fgha-code-scan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fgha-code-scan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fgha-code-scan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fgha-code-scan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scanoss","download_url":"https://codeload.github.com/scanoss/gha-code-scan/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fgha-code-scan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-12T14:02:41.131Z","updated_at":"2026-01-12T14:02:42.255Z","avatar_url":"https://github.com/scanoss.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SCANOSS Code Scan Action\n\n[![GitHub Super-Linter](https://github.com/scanoss/code-scan-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)\n![CI](https://github.com/scanoss/code-scan-action/actions/workflows/ci.yml/badge.svg)\n[![Check dist/](https://github.com/scanoss/code-scan-action/actions/workflows/check-dist.yml/badge.svg)](https://github.com/scanoss/scanoss-code-scan-step/actions/workflows/check-dist.yml)\n[![CodeQL](https://github.com/scanoss/code-scan-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/scanoss/scanoss-code-scan-step/actions/workflows/codeql-analysis.yml)\n![Coverage](./badges/coverage.svg)\n\nThe SCANOSS Code Scan Action enhances your software development process by automatically scanning your code for security\nvulnerabilities and license compliance with configurable policies.\n\n\u003cdiv style=\"text-align: center\"\u003e\n  \n  ![JOB Summary](./.github/assets/img_job_summary.png)\n\n\u003c/div\u003e\n\n## Breaking change v1.0.1\n\n- Default runtime container updated to `ghcr.io/scanoss/scanoss-py:v1.19.0`\n- Removed parameters:\n   - `sbom.enabled`\n   - `sbom.filepath`\n   - `sbom.type`\n\n### Converting from sbom.json to scanoss.json\nThe SBOM configuration format has changed and the file name must be updated from **sbom.json** to **scanoss.json**. Here's how to convert your existing configuration:\n\nOld format (sbom.json):\n```json\n{\n  \"components\": [\n    {\n      \"purl\": \"pkg:github/scanoss/scanner.c\"\n    }\n  ]\n}\n```\n\nNew format (scanoss.json):\n```json\n{\n  \"bom\": {\n    \"include\": [\n      {\n        \"purl\": \"pkg:github/scanoss/scanner.c\"\n      }\n    ]\n  }\n}\n```\n\n\n## Usage\n\nTo begin using this action, you'll need to set up a basic GitHub workflow and define a job within it:\n\n```yaml\nname: Example Workflow with SCANOSS\n\non:\n  pull_request:\n  push:\n    branches:\n      - '*'\n\npermissions:\n  contents: read\n  pull-requests: write\n  checks: write\n  actions: read\n\njobs:\n  scanoss-code-scan:\n    name: SCANOSS Code Scan \n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Run SCANOSS Code Scan\n        id: scanoss-code-scan-step\n        uses: scanoss/code-scan-action@v1\n```\n\nFor example workflow runs, check out our\n[GitHub Action Usage Example](https://github.com/scanoss/integration-github-actions) :rocket:\n\n### Action Input Parameters\n\n| **Parameter**              | **Description**                                                                                                                                          | **Required** | **Default**                          | \n|----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|--------------------------------------|\n| output.filepath            | Scan output file name.                                                                                                                                   | Optional     | `scanoss-raw.json`                   |\n| dependencies.enabled       | Option to enable or disable scanning of dependencies.                                                                                                    | Optional     | `false`                              |\n| dependencies.scope         | Gets development or production dependencies (scopes: prod - dev)                                                                                         | Optional     | -                                    |\n| dependencies.scope.include | Custom list of dependency scopes to be included. Provide scopes as a comma-separated list.                                                               | Optional     | -                                    |\n| dependencies.scope.exclude | Custom list of dependency scopes to be excluded. Provide scopes as a comma-separated list.                                                               | Optional     | -                                    |\n| policies                   | List of policies separated by commas, options available are: copyleft (cpl), undeclared (und), depTrack (dt).                                            | Optional     | -                                    |\n| policies.halt_on_failure   | Halt check on policy failure. If set to false checks will not fail.                                                                                      | Optional     | `true`                               |\n| api.url                    | SCANOSS API URL                                                                                                                                          | Optional     | `https://api.osskb.org/scan/direct`  |\n| api.key                    | SCANOSS API Key                                                                                                                                          | Optional     | -                                    |\n| licenses.copyleft.include  | List of Copyleft licenses to append to the default list. Provide licenses as a comma-separated list.                                                     | Optional     | -                                    |\n| licenses.copyleft.exclude  | List of Copyleft licenses to remove from default list. Provide licenses as a comma-separated list.                                                       | Optional     | -                                    |\n| licenses.copyleft.explicit | Explicit list of Copyleft licenses to consider. Provide licenses as a comma-separated list.                                                              | Optional     | -                                    |\n| runtimeContainer           | Runtime URL                                                                                                                                              | Optional     | `ghcr.io/scanoss/scanoss-py:v1.41.0` |\n| skipSnippets               | Skip the generation of snippets. (scanFiles option must be enabled)                                                                                      | Optional     | `false`                              |\n| scanFiles                  | Enable or disable file and snippet scanning                                                                                                              | Optional     | `true`                               |\n| scanossSettings            | Settings file to use for scanning. See the SCANOSS settings [documentation](https://scanoss.readthedocs.io/projects/scanoss-py/en/latest/#settings-file) | Optional     | `true`                               |\n| settingsFilepath           | Filepath of the SCANOSS settings to be used for scanning                                                                                                 | Optional     | `scanoss.json`                       |\n| scanMode                   | Choose between delta scan and full scan                                                                                                                  | Optional     | `full`                               |\n| scanPath                   | Relative path within the repository to scan (e.g., `src` or `packages/api`)                                                                              | Optional     | `.`                                  |\n| debug                      | Enable debugging                                                                                                                                         | Optional     | `false`                              |\n| deptrack.upload            | Enable automatic upload of scan results to Dependency Track                                                                                              | Optional     | `false`                              |\n| deptrack.url               | URL of the Dependency Track instance. Required when Dependency Track is enabled                                                                          | Required*    | -                                    |\n| deptrack.apikey            | Dependency Track API key. Required when Dependency Track is enabled                                                                                      | Required*    | -                                    |\n| deptrack.projectid         | UUID of an existing project in Dependency Track.\u003cbr/\u003eRequired when project name and version are not provided                                             | Required*    | -                                    |\n| deptrack.projectname       | Dependency track project name identifier. (will be created if it doesn't exist). Required when project ID is not provided                                | Optional     | -                                    |\n| deptrack.projectversion    | Dependency Track project Version identifier. Required when project ID is not provided                                                                    | Optional     | -                                    |\n\n### Action Output Parameters\n\nIn addition to the automatically generated reports, the action also outputs the raw scan data, enabling you to integrate\nthe output into your custom workflow\n\n| **Parameter**       | **Description**          |\n|---------------------|--------------------------|\n| result-filepath     | Scanner results filepath |  \n| stdout-scan-command | Scanner command output   |\n\n## Policy Checks\nThe SCANOSS Code Scan Action includes three configurable policies:\n\n1. **Copyleft** (`copyleft or cpl`): This policy checks if any component or code snippet is associated with a copyleft license. If such a\n   license is detected, the pull request (PR) is rejected. The default list of Copyleft licenses is defined in the following [file](https://github.com/scanoss/gha-code-scan/blob/main/src/utils/license.utils.ts).\n\n2. **Undeclared** (`undeclared or und`): This policy compares the components detected in the repository against those declared in scanoss.json\n   file (customizable through the settingsFilepath parameter). If there are undeclared components, the PR is rejected.\n\n3. **Dependency Track** (`depTrack or dt`): This policy integrates with [Dependency Track](https://dependencytrack.org/) to check for security vulnerabilities, license violations, and policy compliance. It requires Dependency Track configuration parameters to be set.\n\nIn this scenario, a classic policy is executed that will fail if copyleft licenses are found within the results:\n\n![GH Checks](./.github/assets/img_checks.png)\n\nAdditionally, if it is a Pull Request, a comment with a summary of the report will be automatically generated.\n\n![Comments on PR](./.github/assets/img_pr_comment.png)\n\n## Dependency Track Integration\n\nThe SCANOSS Code Scan Action provides comprehensive integration with [Dependency Track](https://dependencytrack.org/) for advanced vulnerability management and policy compliance:\n\n### Features\n\n- **Automatic SBOM Upload**: Converts scan results to CycloneDX format and uploads to your Dependency Track instance\n- **Upload Status Monitoring**: Creates a dedicated GitHub check to monitor upload success/failure with detailed diagnostics\n- **Policy Violation Scanning**: Checks your Dependency Track instance for security vulnerabilities, license violations, and policy compliance\n- **Project Management**: Automatically creates projects in Dependency Track or works with existing projects\n\n### GitHub Checks Created\n\nWhen Dependency Track integration is enabled, you'll see these checks in your GitHub Actions:\n\n1. **Status Check: Dependency Track Upload** - Shows upload status and diagnostics\n2. **Policy Check: Dependency Track** - Shows policy violations and security findings (if `dt` policy is enabled)\n3. **Policy Check: Copyleft** - License compliance (if `copyleft` policy is enabled)  \n4. **Policy Check: Undeclared** - Component declaration compliance (if `undeclared` policy is enabled)\n\n### Configuration\n\n#### Basic Configuration\n```yaml\n- name: Run SCANOSS Code Scan with Dependency Track\n  uses: scanoss/code-scan-action@v1\n  with:\n    deptrack.upload: true\n    deptrack.url: 'https://your-dt-instance.com'\n    deptrack.apikey: ${{ secrets.DT_API_KEY }}\n    deptrack.projectname: 'my-project'\n    deptrack.projectversion: '1.0.0'\n```\n\n#### Advanced Configuration with Policies\n```yaml\n- name: Run SCANOSS Code Scan with Full Dependency Track Integration\n  uses: scanoss/code-scan-action@v1\n  with:\n    policies: copyleft, undeclared, dt  # Enable all policies including Dependency Track\n    deptrack.upload: true\n    deptrack.url: 'https://your-dt-instance.com'\n    deptrack.apikey: ${{ secrets.DT_API_KEY }}\n    deptrack.projectid: 'existing-project-uuid'  # Use existing project\n    policies.halt_on_failure: false  # Don't fail build on policy violations\n```\n\n### Troubleshooting\n\n**Upload Status Check**: Click on the \"Status Check: Dependency Track Upload\" to see detailed diagnostics including:\n- Upload success/failure status\n- Project information and links\n- File size and component count\n- Detailed error messages with troubleshooting steps\n\n**Common Issues**:\n- **Authentication**: Verify your API key has proper permissions\n- **Network**: Ensure GitHub Actions can reach your Dependency Track instance\n- **Project Configuration**: Check that project name/version or project ID is correct\n\n## Full example\n\n```yaml\nname: Full Example Workflow with SCANOSS\n\non:\n  pull_request:\n  push:\n    branches:\n      - '*'\n\npermissions:\n  contents: read\n  pull-requests: write\n  checks: write\n  actions: read\n\njobs:\n   scanoss-code-scan:\n    name: SCANOSS Code Scan\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Run SCANOSS Code Scan\n        id: scanoss-code-scan-step\n        uses: scanoss/code-scan-action@v1\n        with:\n          policies: copyleft, undeclared, dt\n          scanMode: 'delta'\n          dependencies.enabled: true\n          deptrack.upload: true\n          deptrack.url: 'https://your-dt-instance.com'\n          deptrack.apikey: ${{ secrets.DT_API_KEY }}\n          deptrack.projectname: 'my-project'\n          deptrack.projectversion: '1.0.0'\n          # api.url: \u003cYOUR_API_URL\u003e\n          # api.key: \u003cYOUR_API_KEY\u003e\n          \n      - name: Print stdout scan command\n        run: echo \"${{ steps.scanoss-code-scan-step.outputs.stdout-scan-command }}\"\n\n      - name: Print Results\n        run: cat \"${{ steps.scanoss-code-scan-step.outputs.result-filepath }}\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscanoss%2Fgha-code-scan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscanoss%2Fgha-code-scan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscanoss%2Fgha-code-scan/lists"}