Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c604332985 | |||
| f18f83ae6b | |||
| 07e74fc4e7 | |||
| b74e95116c |
@@ -11,18 +11,3 @@ updates:
|
||||
- patch
|
||||
ignore:
|
||||
- dependency-name: 'actions/attest-sbom'
|
||||
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
groups:
|
||||
npm-development:
|
||||
dependency-type: development
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
npm-production:
|
||||
dependency-type: production
|
||||
update-types:
|
||||
- patch
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
# In TypeScript actions, `dist/` is a special directory. When you reference
|
||||
# an action with the `uses:` property, `dist/index.js` is the code that will be
|
||||
# run. For this project, the `dist/index.js` file is transpiled from other
|
||||
# source files. This workflow ensures the `dist/` directory contains the
|
||||
# expected transpiled code.
|
||||
#
|
||||
# If this workflow is run from a feature branch, it will act as an additional CI
|
||||
# check and fail if the checked-in `dist/` directory does not match what is
|
||||
# expected from the build.
|
||||
name: Check Transpiled JavaScript
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-dist:
|
||||
name: Check dist/
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
id: install
|
||||
run: npm ci
|
||||
|
||||
- name: Build dist/ Directory
|
||||
id: build
|
||||
run: npm run bundle
|
||||
|
||||
# This will fail the workflow if the PR wasn't created by Dependabot.
|
||||
- name: Compare Directories
|
||||
id: diff
|
||||
run: |
|
||||
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
|
||||
echo "Detected uncommitted changes after build. See status below:"
|
||||
git diff --ignore-space-at-eol --text dist/
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If `dist/` was different than expected, and this was not a Dependabot
|
||||
# PR, upload the expected version as a workflow artifact.
|
||||
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
||||
name: Upload Artifact
|
||||
id: upload
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
@@ -12,40 +12,6 @@ on:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
test-typescript:
|
||||
name: TypeScript Tests
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
id: npm-ci
|
||||
run: npm ci
|
||||
|
||||
- name: Check Format
|
||||
id: npm-format-check
|
||||
run: npm run format:check
|
||||
|
||||
- name: Lint
|
||||
id: npm-lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Test
|
||||
id: npm-ci-test
|
||||
run: npm run ci-test
|
||||
|
||||
test-attest-sbom:
|
||||
name: Test attest-sbom action with local sbom file
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
name: CodeQL
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '31 7 * * 3'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
checks: write
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language:
|
||||
- TypeScript
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Initialize CodeQL
|
||||
id: initialize
|
||||
uses: github/codeql-action/init@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
source-root: src
|
||||
|
||||
- name: Autobuild
|
||||
id: autobuild
|
||||
uses: github/codeql-action/autobuild@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
id: analyze
|
||||
uses: github/codeql-action/analyze@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
|
||||
@@ -1 +0,0 @@
|
||||
24.5.0
|
||||
@@ -1,3 +0,0 @@
|
||||
dist/
|
||||
node_modules/
|
||||
coverage/
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"quoteProps": "as-needed",
|
||||
"jsxSingleQuote": false,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": true,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"proseWrap": "always",
|
||||
"htmlWhitespaceSensitivity": "css",
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
@@ -1,16 +1,19 @@
|
||||
# `actions/attest-sbom`
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
> [!WARNING]
|
||||
> This action is being deprecated in favor of [`actions/attest`][9]. `actions/attest-sbom` will continue to function as a wrapper on top of `actions/attest` for some period of time, but applications should make plans to migrate.
|
||||
>
|
||||
> All of the existing action inputs are compatible with the `actions/attest` interface.
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
Generate signed SBOM attestations for workflow artifacts. Internally powered by
|
||||
the [@actions/attest][1] package.
|
||||
|
||||
Attestations bind some subject (a named artifact along with its digest) to a
|
||||
Software Bill of Materials (SBOM) using the [in-toto][2] format. This action
|
||||
generates a [reference predicate][3] that points to the SBOM rather than
|
||||
embedding the full SBOM content. The SBOM file is uploaded as a GitHub release
|
||||
asset, and the attestation references its download location and digest.
|
||||
|
||||
The action accepts SBOMs which have been generated by external tools. Provided
|
||||
SBOMs must be in either the [SPDX][4] or [CycloneDX][5] JSON-serialized format.
|
||||
Attestations bind some subject (a named artifact along with its digest) to a a
|
||||
Software Bill of Materials (SBOM) using the [in-toto][2] format. The action
|
||||
accepts SBOMs which have been generated by external tools. Provided SBOMs must
|
||||
be in either the [SPDX][4] or [CycloneDX][5] JSON-serialized format.
|
||||
|
||||
A verifiable signature is generated for the attestation using a short-lived
|
||||
[Sigstore][6]-issued signing certificate. If the repository initiating the
|
||||
@@ -25,8 +28,8 @@ initiated.
|
||||
Attestations can be verified using the [`attestation` command in the GitHub
|
||||
CLI][7].
|
||||
|
||||
See [Using artifact attestations to establish provenance for builds][11] for
|
||||
more information on artifact attestations.
|
||||
See [Using artifact attestations to establish provenance for builds][8] for more
|
||||
information on artifact attestations.
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
> [!NOTE]
|
||||
@@ -40,305 +43,21 @@ more information on artifact attestations.
|
||||
|
||||
## Usage
|
||||
|
||||
Within the GitHub Actions workflow which builds some artifact you would like to
|
||||
attest:
|
||||
**As of version 4, `actions/attest-sbom` is simply a wrapper on top of
|
||||
[`actions/attest`][9].**
|
||||
|
||||
1. Ensure that the following permissions are set:
|
||||
Please see the [`actions/attest`][9] repository for usage information.
|
||||
|
||||
```yaml
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
attestations: write
|
||||
```
|
||||
|
||||
The `id-token` permission gives the action the ability to mint the OIDC token
|
||||
necessary to request a Sigstore signing certificate. The `attestations`
|
||||
permission is necessary to persist the attestation. The `contents` permission
|
||||
is required to create releases and upload the SBOM as a release asset.
|
||||
|
||||
1. Add the following to your workflow after your artifact has been built and
|
||||
your SBOM has been generated:
|
||||
|
||||
```yaml
|
||||
- uses: actions/attest-sbom@v3
|
||||
with:
|
||||
subject-path: '<PATH TO ARTIFACT>'
|
||||
sbom-path: '<PATH TO SBOM>'
|
||||
```
|
||||
|
||||
The `subject-path` parameter should identify the artifact for which you want
|
||||
to generate an SBOM attestation. The `sbom-path` parameter should identify
|
||||
the SBOM document to be associated with the subject.
|
||||
|
||||
### Inputs
|
||||
|
||||
See [action.yml](action.yml)
|
||||
|
||||
```yaml
|
||||
- uses: actions/attest-sbom@v3
|
||||
with:
|
||||
# Path to the artifact serving as the subject of the attestation. Must
|
||||
# specify exactly one of "subject-path", "subject-digest", or
|
||||
# "subject-checksums". May contain a glob pattern or list of paths
|
||||
# (total subject count cannot exceed 1024).
|
||||
subject-path:
|
||||
|
||||
# SHA256 digest of the subject for the attestation. Must be in the form
|
||||
# "sha256:hex_digest" (e.g. "sha256:abc123..."). Must specify exactly one
|
||||
# of "subject-path", "subject-digest", or "subject-checksums".
|
||||
subject-digest:
|
||||
|
||||
# Subject name as it should appear in the attestation. Required when
|
||||
# identifying the subject with the "subject-digest" input.
|
||||
subject-name:
|
||||
|
||||
# Path to checksums file containing digest and name of subjects for
|
||||
# attestation. Must specify exactly one of "subject-path", "subject-digest",
|
||||
# or "subject-checksums".
|
||||
subject-checksums:
|
||||
|
||||
# Path to the JSON-formatted SBOM file to attest. The SBOM will be
|
||||
# uploaded as a release asset and referenced in the attestation.
|
||||
sbom-path:
|
||||
|
||||
# Whether to push the attestation to the image registry. Requires that the
|
||||
# "subject-name" parameter specify the fully-qualified image name and that
|
||||
# the "subject-digest" parameter be specified. Defaults to false.
|
||||
push-to-registry:
|
||||
|
||||
# Whether to attach a list of generated attestations to the workflow run
|
||||
# summary page. Defaults to true.
|
||||
show-summary:
|
||||
|
||||
# The GitHub token used to make authenticated API requests and upload
|
||||
# the SBOM to a release. Default is ${{ github.token }}
|
||||
github-token:
|
||||
```
|
||||
|
||||
### How It Works
|
||||
|
||||
When you run this action:
|
||||
|
||||
1. The SBOM file is read and its SHA-256 digest is calculated
|
||||
1. A GitHub release tagged "sbom" is created (if it doesn't already exist)
|
||||
1. The SBOM is uploaded as a release asset with a unique filename incorporating
|
||||
the workflow run ID (e.g., `12345-sbom.spdx.json`)
|
||||
1. A [reference predicate][3] is generated containing:
|
||||
- The download URL for the release asset
|
||||
- The SHA-256 digest of the SBOM
|
||||
- The media type (`application/spdx+json` or `application/vnd.cyclonedx+json`)
|
||||
- An attester ID identifying the workflow that created the attestation
|
||||
1. The reference predicate is signed and uploaded as an attestation
|
||||
|
||||
### Outputs
|
||||
|
||||
<!-- markdownlint-disable MD013 -->
|
||||
|
||||
| Name | Description | Example |
|
||||
| ----------------- | -------------------------------------------------------------- | ------------------------------------------------ |
|
||||
| `attestation-id` | GitHub ID for the attestation | `123456` |
|
||||
| `attestation-url` | URL for the attestation summary | `https://github.com/foo/bar/attestations/123456` |
|
||||
| `bundle-path` | Absolute path to the file containing the generated attestation | `/tmp/attestation.json` |
|
||||
|
||||
<!-- markdownlint-enable MD013 -->
|
||||
|
||||
Attestations are saved in the JSON-serialized [Sigstore bundle][8] format.
|
||||
|
||||
If multiple subjects are being attested at the same time, a single attestation
|
||||
will be created with references to each of the supplied subjects.
|
||||
|
||||
The absolute path to the generated attestation is appended to the file
|
||||
`${RUNNER_TEMP}/created_attestation_paths.txt`. This file will accumulate the
|
||||
paths to all attestations created over the course of a single workflow.
|
||||
|
||||
## Attestation Limits
|
||||
|
||||
### Subject Limits
|
||||
|
||||
No more than 1024 subjects can be attested at the same time.
|
||||
|
||||
## Examples
|
||||
|
||||
### Identify Subject and SBOM by Path
|
||||
|
||||
For the basic use case, simply add the `attest-sbom` action to your workflow and
|
||||
supply the path to the artifact and SBOM for which you want to generate
|
||||
attestation.
|
||||
|
||||
```yaml
|
||||
name: build-attest
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
attestations: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build artifact
|
||||
run: make my-app
|
||||
- name: Generate SBOM
|
||||
uses: anchore/sbom-action@v0
|
||||
with:
|
||||
format: 'spdx-json'
|
||||
output-file: 'sbom.spdx.json'
|
||||
- name: Attest
|
||||
uses: actions/attest-sbom@v3
|
||||
with:
|
||||
subject-path: '${{ github.workspace }}/my-app'
|
||||
sbom-path: 'sbom.spdx.json'
|
||||
```
|
||||
|
||||
### Identify Multiple Subjects
|
||||
|
||||
If you are generating multiple artifacts, you can attest all of them at the same
|
||||
time by using a wildcard in the `subject-path` input.
|
||||
|
||||
```yaml
|
||||
- uses: actions/attest-sbom@v3
|
||||
with:
|
||||
subject-path: 'dist/**/my-bin-*'
|
||||
sbom-path: '${{ github.workspace }}/my-bin.sbom.spdx.json'
|
||||
```
|
||||
|
||||
For supported wildcards along with behavior and documentation, see
|
||||
[@actions/glob][10] which is used internally to search for files.
|
||||
|
||||
Alternatively, you can explicitly list multiple subjects with either a comma or
|
||||
newline delimited list:
|
||||
|
||||
```yaml
|
||||
- uses: actions/attest-sbom@v3
|
||||
with:
|
||||
subject-path: 'dist/foo, dist/bar'
|
||||
```
|
||||
|
||||
```yaml
|
||||
- uses: actions/attest-sbom@v3
|
||||
with:
|
||||
subject-path: |
|
||||
dist/foo
|
||||
dist/bar
|
||||
```
|
||||
|
||||
### Identify Subjects with Checksums File
|
||||
|
||||
If you are using tools like
|
||||
[goreleaser](https://goreleaser.com/customization/checksum/) or
|
||||
[jreleaser](https://jreleaser.org/guide/latest/reference/checksum.html) which
|
||||
generate a checksums file you can identify the attestation subjects by passing
|
||||
the path of the checksums file to the `subject-checksums` input. Each of the
|
||||
artifacts identified in the checksums file will be listed as a subject for the
|
||||
attestation.
|
||||
|
||||
```yaml
|
||||
- name: Calculate artifact digests
|
||||
run: |
|
||||
shasum -a 256 foo_0.0.1_* > subject.checksums.txt
|
||||
- uses: actions/attest-sbom@v3
|
||||
with:
|
||||
subject-checksums: subject.checksums.txt
|
||||
sbom-path: sbom.spdx.json
|
||||
```
|
||||
|
||||
<!-- markdownlint-disable MD038 -->
|
||||
|
||||
The file referenced by the `subject-checksums` input must conform to the same
|
||||
format used by the shasum tools. Each subject should be listed on a separate
|
||||
line including the hex-encoded digest (either SHA256 or SHA512), a space, a
|
||||
single character flag indicating either binary (`*`) or text (` `) input mode,
|
||||
and the filename.
|
||||
|
||||
<!-- markdownlint-enable MD038 -->
|
||||
|
||||
```text
|
||||
b569bf992b287f55d78bf8ee476497e9b7e9d2bf1c338860bfb905016218c740 foo_0.0.1_darwin_amd64
|
||||
a54fc515e616cac7fcf11a49d5c5ec9ec315948a5935c1e11dd610b834b14dde foo_0.0.1_darwin_arm64
|
||||
```
|
||||
|
||||
### Container Image
|
||||
|
||||
When working with container images you can invoke the action with the
|
||||
`subject-name` and `subject-digest` inputs.
|
||||
|
||||
If you want to publish the attestation to the container registry with the
|
||||
`push-to-registry` option, it is important that the `subject-name` specify the
|
||||
fully-qualified image name (e.g. "ghcr.io/user/app" or
|
||||
"acme.azurecr.io/user/app"). Do NOT include a tag as part of the image name --
|
||||
the specific image being attested is identified by the supplied digest.
|
||||
|
||||
> **NOTE**: When pushing to Docker Hub, please use "index.docker.io" as the
|
||||
> registry portion of the image name.
|
||||
|
||||
```yaml
|
||||
name: build-attested-image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write
|
||||
packages: write
|
||||
contents: write
|
||||
attestations: write
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push image
|
||||
id: push
|
||||
uses: docker/build-push-action@v5.0.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
- name: Generate SBOM
|
||||
uses: anchore/sbom-action@v0
|
||||
with:
|
||||
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
format: 'cyclonedx-json'
|
||||
output-file: 'sbom.cyclonedx.json'
|
||||
- name: Attest
|
||||
uses: actions/attest-sbom@v3
|
||||
id: attest
|
||||
with:
|
||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
subject-digest: ${{ steps.push.outputs.digest }}
|
||||
sbom-path: 'sbom.cyclonedx.json'
|
||||
push-to-registry: true
|
||||
```
|
||||
Documentation for previous versions of this action can be found [here][10].
|
||||
|
||||
[1]: https://github.com/actions/toolkit/tree/main/packages/attest
|
||||
[2]: https://github.com/in-toto/attestation/tree/main/spec/v1
|
||||
[3]:
|
||||
https://github.com/in-toto/attestation/blob/main/spec/predicates/reference.md
|
||||
[4]: https://spdx.dev/
|
||||
[5]: https://cyclonedx.org/
|
||||
[6]: https://www.sigstore.dev/
|
||||
[7]: https://cli.github.com/manual/gh_attestation_verify
|
||||
[8]:
|
||||
https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto
|
||||
[10]: https://github.com/actions/toolkit/tree/main/packages/glob#patterns
|
||||
[11]:
|
||||
https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
|
||||
[9]: https://github.com/actions/attest
|
||||
[10]:
|
||||
https://github.com/actions/attest-sbom/tree/v3.0.0?tab=readme-ov-file#actionsattest-sbom
|
||||
|
||||
-18
@@ -3,24 +3,6 @@
|
||||
Follow the steps below to tag a new release for the `actions/attest-sbom`
|
||||
action.
|
||||
|
||||
If changes were made to the internal `actions/attest-sbom/predicate` action (any
|
||||
updates to [`./predicate/action.yaml`](./predicate/action.yml) or any of the
|
||||
code in the [`./src`](./src) directory), start with step #1; otherwise, skip
|
||||
directly to step #5.
|
||||
|
||||
1. Merge the latest changes to the `main` branch.
|
||||
1. Create and push a new predicate tag of the form `predicate@X.X.X` following
|
||||
SemVer conventions:
|
||||
|
||||
```shell
|
||||
git tag -a "predicate@X.X.X" -m "predicate@X.X.X Release"
|
||||
git push --tags
|
||||
```
|
||||
|
||||
1. Update the reference to the `actions/attest-sbom/predicate` action in
|
||||
[`action.yml`](./action.yml) to point to the SHA of the newly created tag.
|
||||
1. Push the `action.yml` change and open a PR. Once it has been reviewed, merge
|
||||
the PR and proceed with the release instructions.
|
||||
1. Create a new release for the top-level action using a tag of the form
|
||||
`vX.X.X` following SemVer conventions:
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
context: {
|
||||
repo: { owner: 'test-owner', repo: 'test-repo' },
|
||||
runId: 12345,
|
||||
serverUrl: 'https://github.com'
|
||||
},
|
||||
getOctokit: jest.fn()
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Unit tests for the action's entrypoint, src/index.ts
|
||||
*/
|
||||
|
||||
import * as main from '../src/main'
|
||||
|
||||
jest.mock('@actions/github')
|
||||
|
||||
// Mock the action's entrypoint
|
||||
const runMock = jest.spyOn(main, 'run').mockImplementation()
|
||||
|
||||
describe('index', () => {
|
||||
it('calls run when imported', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
require('../src/index')
|
||||
|
||||
expect(runMock).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
@@ -1,214 +0,0 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import * as main from '../src/main'
|
||||
import * as fs from 'fs'
|
||||
import os from 'os'
|
||||
import * as path from 'path'
|
||||
import { REFERENCE_PREDICATE_TYPE } from '../src/reference'
|
||||
|
||||
// Mock the GitHub Actions core library
|
||||
jest.mock('@actions/core')
|
||||
jest.mock('@actions/github')
|
||||
|
||||
const getInputMock = jest.spyOn(core, 'getInput')
|
||||
const setOutputMock = jest.spyOn(core, 'setOutput')
|
||||
const setFailedMock = jest.spyOn(core, 'setFailed')
|
||||
|
||||
// Ensure that setFailed doesn't set an exit code during tests
|
||||
setFailedMock.mockImplementation(() => {})
|
||||
|
||||
// Mock Octokit
|
||||
const mockUploadReleaseAsset = jest.fn()
|
||||
const mockGetReleaseByTag = jest.fn()
|
||||
const mockCreateRelease = jest.fn()
|
||||
|
||||
const mockOctokit = {
|
||||
rest: {
|
||||
repos: {
|
||||
uploadReleaseAsset: mockUploadReleaseAsset,
|
||||
getReleaseByTag: mockGetReleaseByTag,
|
||||
createRelease: mockCreateRelease
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe('SBOM Action', () => {
|
||||
let tempDir = '/'
|
||||
let outputs = {} as Record<string, string>
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sbom'))
|
||||
|
||||
jest.resetAllMocks()
|
||||
setOutputMock.mockImplementation((key, value) => {
|
||||
outputs[key] = value
|
||||
})
|
||||
|
||||
// Setup GitHub mock
|
||||
;(github.getOctokit as jest.Mock).mockReturnValue(mockOctokit)
|
||||
|
||||
// Default mock responses
|
||||
mockGetReleaseByTag.mockResolvedValue({ data: { id: 999 } })
|
||||
mockUploadReleaseAsset.mockResolvedValue({
|
||||
data: {
|
||||
browser_download_url:
|
||||
'https://github.com/test-owner/test-repo/releases/download/sbom/12345-spdxSBOM.json'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
fs.rmSync(tempDir, { recursive: true })
|
||||
outputs = {}
|
||||
})
|
||||
|
||||
it('successfully processes an SBOM and generates reference predicate', async () => {
|
||||
const spdxSBOM = JSON.stringify({
|
||||
spdxVersion: 'SPDX-2.2',
|
||||
SPDXID: 'SPDXRef-DOCUMENT',
|
||||
packages: []
|
||||
})
|
||||
const filePath = path.join(tempDir, 'spdxSBOM.json')
|
||||
fs.writeFileSync(filePath, spdxSBOM)
|
||||
|
||||
const inputs: Record<string, string> = {
|
||||
'sbom-path': filePath,
|
||||
'github-token': 'fake-token'
|
||||
}
|
||||
getInputMock.mockImplementation(mockInput(inputs))
|
||||
const originalEnv = process.env
|
||||
process.env = {
|
||||
...originalEnv,
|
||||
RUNNER_TEMP: '/tmp',
|
||||
GITHUB_WORKFLOW_REF:
|
||||
'test-owner/test-repo/.github/workflows/ci.yml@refs/heads/main'
|
||||
}
|
||||
|
||||
// Run the main function
|
||||
await main.run()
|
||||
|
||||
// Verify that outputs were set correctly
|
||||
expect(setOutputMock).toHaveBeenCalledTimes(2)
|
||||
expect(setOutputMock).toHaveBeenCalledWith(
|
||||
'predicate-type',
|
||||
REFERENCE_PREDICATE_TYPE
|
||||
)
|
||||
expect(outputs['predicate-path']).toBeTruthy()
|
||||
const predicatePath = outputs['predicate-path']
|
||||
|
||||
// Verify that the temporary file exists
|
||||
expect(fs.existsSync(predicatePath)).toBe(true)
|
||||
|
||||
// Read the content of the temporary file
|
||||
const fileContent = fs.readFileSync(predicatePath, 'utf-8')
|
||||
const predicate = JSON.parse(fileContent) as {
|
||||
attester: { id: string }
|
||||
references: {
|
||||
downloadLocation: string
|
||||
mediaType: string
|
||||
digest: { sha256: string }
|
||||
}[]
|
||||
}
|
||||
|
||||
// Verify reference predicate structure
|
||||
expect(predicate.attester.id).toBe(
|
||||
'https://github.com/test-owner/test-repo/.github/workflows/ci.yml'
|
||||
)
|
||||
expect(predicate.references).toHaveLength(1)
|
||||
expect(predicate.references[0].downloadLocation).toBe(
|
||||
'https://github.com/test-owner/test-repo/releases/download/sbom/12345-spdxSBOM.json'
|
||||
)
|
||||
expect(predicate.references[0].mediaType).toBe('application/spdx+json')
|
||||
expect(predicate.references[0].digest.sha256).toBeTruthy()
|
||||
|
||||
// Verify GitHub API calls
|
||||
expect(github.getOctokit).toHaveBeenCalledWith('fake-token')
|
||||
expect(mockGetReleaseByTag).toHaveBeenCalledWith({
|
||||
owner: 'test-owner',
|
||||
repo: 'test-repo',
|
||||
tag: 'sbom'
|
||||
})
|
||||
expect(mockUploadReleaseAsset).toHaveBeenCalled()
|
||||
|
||||
// Clean up the temporary file
|
||||
fs.unlinkSync(predicatePath)
|
||||
|
||||
process.env = originalEnv
|
||||
})
|
||||
|
||||
it('creates release if it does not exist', async () => {
|
||||
const spdxSBOM = JSON.stringify({
|
||||
spdxVersion: 'SPDX-2.2',
|
||||
SPDXID: 'SPDXRef-DOCUMENT'
|
||||
})
|
||||
const filePath = path.join(tempDir, 'spdxSBOM.json')
|
||||
fs.writeFileSync(filePath, spdxSBOM)
|
||||
|
||||
const inputs: Record<string, string> = {
|
||||
'sbom-path': filePath,
|
||||
'github-token': 'fake-token'
|
||||
}
|
||||
getInputMock.mockImplementation(mockInput(inputs))
|
||||
const originalEnv = process.env
|
||||
process.env = {
|
||||
...originalEnv,
|
||||
RUNNER_TEMP: '/tmp',
|
||||
GITHUB_WORKFLOW_REF:
|
||||
'test-owner/test-repo/.github/workflows/ci.yml@refs/heads/main'
|
||||
}
|
||||
|
||||
// Mock release not found
|
||||
mockGetReleaseByTag.mockRejectedValue({ status: 404 })
|
||||
mockCreateRelease.mockResolvedValue({ data: { id: 1000 } })
|
||||
|
||||
await main.run()
|
||||
|
||||
expect(mockCreateRelease).toHaveBeenCalledWith({
|
||||
owner: 'test-owner',
|
||||
repo: 'test-repo',
|
||||
tag_name: 'sbom',
|
||||
name: 'SBOM Attestations',
|
||||
body: 'This release contains SBOM files referenced by attestations.',
|
||||
draft: false,
|
||||
prerelease: false
|
||||
})
|
||||
|
||||
process.env = originalEnv
|
||||
})
|
||||
|
||||
it('fails when an error occurs without input', async () => {
|
||||
await main.run()
|
||||
expect(setFailedMock).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('fails when an error occurs with wrong sbom format', async () => {
|
||||
const invalidSBOM = JSON.stringify({
|
||||
SPDXID: 'SPDXRef-DOCUMENT'
|
||||
})
|
||||
const filePath = path.join(tempDir, 'invalid.json')
|
||||
fs.writeFileSync(filePath, invalidSBOM)
|
||||
|
||||
const inputs: Record<string, string> = {
|
||||
'sbom-path': filePath,
|
||||
'github-token': 'fake-token'
|
||||
}
|
||||
getInputMock.mockImplementation(mockInput(inputs))
|
||||
const originalEnv = process.env
|
||||
process.env = { ...originalEnv, RUNNER_TEMP: '/tmp' }
|
||||
|
||||
// Run the main function
|
||||
await main.run()
|
||||
expect(setFailedMock).toHaveBeenCalledWith('Unsupported SBOM format')
|
||||
|
||||
process.env = originalEnv
|
||||
})
|
||||
})
|
||||
|
||||
function mockInput(inputs: Record<string, string>): typeof core.getInput {
|
||||
return (name: string): string => {
|
||||
if (name in inputs) {
|
||||
return inputs[name]
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
import {
|
||||
calculateSHA256,
|
||||
generateReferencePredicate,
|
||||
getMediaType,
|
||||
REFERENCE_PREDICATE_TYPE
|
||||
} from '../src/reference'
|
||||
import * as fs from 'fs'
|
||||
import os from 'os'
|
||||
import * as path from 'path'
|
||||
|
||||
describe('calculateSHA256', () => {
|
||||
let tempDir = '/'
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'reference'))
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
fs.rmSync(tempDir, { recursive: true })
|
||||
})
|
||||
|
||||
it('calculates correct SHA-256 digest', async () => {
|
||||
const content = 'test content for hashing'
|
||||
const filePath = path.join(tempDir, 'test.json')
|
||||
fs.writeFileSync(filePath, content)
|
||||
|
||||
const digest = await calculateSHA256(filePath)
|
||||
|
||||
// Expected SHA-256 of 'test content for hashing'
|
||||
expect(digest).toBe(
|
||||
'e25dd806d495b413931f4eea50b677a7a5c02d00460924661283f211a37f7e7f'
|
||||
)
|
||||
})
|
||||
|
||||
it('produces different digests for different content', async () => {
|
||||
const file1 = path.join(tempDir, 'file1.json')
|
||||
const file2 = path.join(tempDir, 'file2.json')
|
||||
fs.writeFileSync(file1, 'content one')
|
||||
fs.writeFileSync(file2, 'content two')
|
||||
|
||||
const digest1 = await calculateSHA256(file1)
|
||||
const digest2 = await calculateSHA256(file2)
|
||||
|
||||
expect(digest1).not.toBe(digest2)
|
||||
})
|
||||
})
|
||||
|
||||
describe('generateReferencePredicate', () => {
|
||||
it('generates correct reference predicate structure', () => {
|
||||
const params = {
|
||||
attesterId: 'https://github.com/owner/repo/.github/workflows/ci.yml',
|
||||
downloadLocation:
|
||||
'https://github.com/owner/repo/releases/download/sbom/sbom.json',
|
||||
digest: 'abc123def456',
|
||||
mediaType: 'application/spdx+json'
|
||||
}
|
||||
|
||||
const predicate = generateReferencePredicate(params)
|
||||
|
||||
expect(predicate.type).toBe(REFERENCE_PREDICATE_TYPE)
|
||||
expect(predicate.params).toEqual({
|
||||
attester: {
|
||||
id: 'https://github.com/owner/repo/.github/workflows/ci.yml'
|
||||
},
|
||||
references: [
|
||||
{
|
||||
downloadLocation:
|
||||
'https://github.com/owner/repo/releases/download/sbom/sbom.json',
|
||||
digest: {
|
||||
sha256: 'abc123def456'
|
||||
},
|
||||
mediaType: 'application/spdx+json'
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('getMediaType', () => {
|
||||
it('returns correct media type for SPDX', () => {
|
||||
expect(getMediaType('spdx')).toBe('application/spdx+json')
|
||||
})
|
||||
|
||||
it('returns correct media type for CycloneDX', () => {
|
||||
expect(getMediaType('cyclonedx')).toBe('application/vnd.cyclonedx+json')
|
||||
})
|
||||
})
|
||||
@@ -1,45 +0,0 @@
|
||||
import { generateAssetName, buildAttesterId } from '../src/release'
|
||||
|
||||
describe('generateAssetName', () => {
|
||||
it('generates asset name with run ID prefix', () => {
|
||||
const result = generateAssetName(12345, '/path/to/sbom.json')
|
||||
expect(result).toBe('12345-sbom.json')
|
||||
})
|
||||
|
||||
it('handles paths with multiple directories', () => {
|
||||
const result = generateAssetName(99999, '/a/b/c/d/my-sbom.spdx.json')
|
||||
expect(result).toBe('99999-my-sbom.spdx.json')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildAttesterId', () => {
|
||||
it('builds correct attester ID URL from workflow ref', () => {
|
||||
const result = buildAttesterId(
|
||||
'https://github.com',
|
||||
'octocat/hello-world/.github/workflows/ci.yml@refs/heads/main'
|
||||
)
|
||||
expect(result).toBe(
|
||||
'https://github.com/octocat/hello-world/.github/workflows/ci.yml'
|
||||
)
|
||||
})
|
||||
|
||||
it('handles workflow refs with tags', () => {
|
||||
const result = buildAttesterId(
|
||||
'https://github.com',
|
||||
'owner/repo/.github/workflows/release.yml@refs/tags/v1.0.0'
|
||||
)
|
||||
expect(result).toBe(
|
||||
'https://github.com/owner/repo/.github/workflows/release.yml'
|
||||
)
|
||||
})
|
||||
|
||||
it('handles enterprise server URLs', () => {
|
||||
const result = buildAttesterId(
|
||||
'https://github.example.com',
|
||||
'owner/repo/.github/workflows/build.yml@refs/heads/main'
|
||||
)
|
||||
expect(result).toBe(
|
||||
'https://github.example.com/owner/repo/.github/workflows/build.yml'
|
||||
)
|
||||
})
|
||||
})
|
||||
@@ -1,94 +0,0 @@
|
||||
import { storePredicate, parseSBOMFromPath } from '../src/sbom'
|
||||
import type { Predicate } from '@actions/attest'
|
||||
import * as fs from 'fs'
|
||||
import os from 'os'
|
||||
import * as path from 'path'
|
||||
|
||||
describe('parseSBOMFromPath', () => {
|
||||
let tempDir = '/'
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sbom'))
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
fs.rmSync(tempDir, { recursive: true })
|
||||
})
|
||||
|
||||
it('correctly parses an SPDX file', async () => {
|
||||
const spdxSBOM = JSON.stringify({
|
||||
spdxVersion: 'SPDX-2.2',
|
||||
SPDXID: 'SPDXRef-DOCUMENT'
|
||||
})
|
||||
const filePath = path.join(tempDir, 'spdxSBOM.json')
|
||||
fs.writeFileSync(filePath, spdxSBOM)
|
||||
await expect(parseSBOMFromPath(filePath)).resolves.toEqual({
|
||||
type: 'spdx'
|
||||
})
|
||||
})
|
||||
|
||||
it('correctly parses a CycloneDX file', async () => {
|
||||
const cycloneDXSBOM = JSON.stringify({
|
||||
bomFormat: 'CycloneDX',
|
||||
serialNumber: '123',
|
||||
specVersion: '1.2'
|
||||
})
|
||||
const filePath = path.join(tempDir, 'cyclonedxSBOM.json')
|
||||
fs.writeFileSync(filePath, cycloneDXSBOM)
|
||||
|
||||
await expect(parseSBOMFromPath(filePath)).resolves.toEqual({
|
||||
type: 'cyclonedx'
|
||||
})
|
||||
})
|
||||
|
||||
it('throws an error for unsupported SBOM formats', async () => {
|
||||
const filePath = path.join(tempDir, 'random.json')
|
||||
fs.writeFileSync(filePath, JSON.stringify({ random: 'value' }))
|
||||
await expect(parseSBOMFromPath(filePath)).rejects.toThrow(
|
||||
'Unsupported SBOM format'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('storePredicate', () => {
|
||||
it('should store the predicate to a temporary file', () => {
|
||||
const predicate = { params: { key: 'value' } } as Predicate
|
||||
|
||||
// Mocking the process.env['RUNNER_TEMP'] value
|
||||
const originalEnv = process.env
|
||||
process.env = { ...originalEnv, RUNNER_TEMP: '/tmp' }
|
||||
|
||||
const tempFile = storePredicate(predicate)
|
||||
|
||||
// Verify that the temporary file exists
|
||||
expect(fs.existsSync(tempFile)).toBe(true)
|
||||
|
||||
// Read the content of the temporary file
|
||||
const fileContent = fs.readFileSync(tempFile, 'utf-8')
|
||||
|
||||
// Verify that the content matches the predicate params
|
||||
expect(JSON.parse(fileContent)).toEqual(predicate.params)
|
||||
|
||||
// Clean up the temporary file
|
||||
fs.unlinkSync(tempFile)
|
||||
|
||||
// Restore the original process.env
|
||||
process.env = originalEnv
|
||||
})
|
||||
|
||||
it('should throw an error if RUNNER_TEMP environment variable is missing', () => {
|
||||
const predicate = { params: { key: 'value' } } as Predicate
|
||||
|
||||
// Mocking the process.env['RUNNER_TEMP'] value
|
||||
const originalEnv = process.env
|
||||
process.env = {}
|
||||
|
||||
// Verify that an error is thrown
|
||||
expect(() => storePredicate(predicate)).toThrow(
|
||||
'Missing RUNNER_TEMP environment variable'
|
||||
)
|
||||
|
||||
// Restore the original process.env
|
||||
process.env = originalEnv
|
||||
})
|
||||
})
|
||||
+6
-10
@@ -67,12 +67,11 @@ outputs:
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- uses: actions/attest-sbom/predicate@bdehamer/detached-sbom
|
||||
id: generate-sbom-predicate
|
||||
with:
|
||||
sbom-path: ${{ inputs.sbom-path }}
|
||||
github-token: ${{ inputs.github-token }}
|
||||
- uses: actions/attest@7667f588f2f73a90cea6c7ac70e78266c4f76616 # v3.1.0
|
||||
- shell: bash
|
||||
run: |
|
||||
echo "::warning::actions/attest-sbom has been deprecated, please use actions/attest instead"
|
||||
|
||||
- uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
|
||||
id: attest
|
||||
env:
|
||||
NODE_OPTIONS: '--max-http-header-size=32768'
|
||||
@@ -81,10 +80,7 @@ runs:
|
||||
subject-digest: ${{ inputs.subject-digest }}
|
||||
subject-name: ${{ inputs.subject-name }}
|
||||
subject-checksums: ${{ inputs.subject-checksums }}
|
||||
predicate-type:
|
||||
${{ steps.generate-sbom-predicate.outputs.predicate-type }}
|
||||
predicate-path:
|
||||
${{ steps.generate-sbom-predicate.outputs.predicate-path }}
|
||||
sbom-path: ${{ inputs.sbom-path }}
|
||||
push-to-registry: ${{ inputs.push-to-registry }}
|
||||
show-summary: ${{ inputs.show-summary }}
|
||||
github-token: ${{ inputs.github-token }}
|
||||
|
||||
-60703
File diff suppressed because one or more lines are too long
-588
@@ -1,588 +0,0 @@
|
||||
@actions/core
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/exec
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/github
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/http-client
|
||||
MIT
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@actions/io
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@fastify/busboy
|
||||
MIT
|
||||
Copyright Brian White. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
@octokit/auth-token
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/core
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/endpoint
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/graphql
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/plugin-paginate-rest
|
||||
MIT
|
||||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/plugin-rest-endpoint-methods
|
||||
MIT
|
||||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/request
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@octokit/request-error
|
||||
MIT
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
before-after-hook
|
||||
Apache-2.0
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018 Gregor Martynus and other contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
deprecation
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Gregor Martynus and contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
once
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 Koichi Kobayashi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
undici
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) Matteo Collina and Undici contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
universal-user-agent
|
||||
ISC
|
||||
# [ISC License](https://spdx.org/licenses/ISC)
|
||||
|
||||
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
wrappy
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -1,92 +0,0 @@
|
||||
import eslint from '@eslint/js'
|
||||
import importplugin from 'eslint-plugin-import'
|
||||
import jestplugin from 'eslint-plugin-jest'
|
||||
import tseslint from 'typescript-eslint'
|
||||
|
||||
export default tseslint.config(
|
||||
// Ignore non-project files
|
||||
{
|
||||
name: 'ignore',
|
||||
ignores: ['.github', 'dist', 'coverage', '**/*.json', 'jest.setup.js', 'eslint.config.mjs', '__mocks__']
|
||||
},
|
||||
// Use recommended rules from ESLint, TypeScript, and other plugins
|
||||
eslint.configs.recommended,
|
||||
tseslint.configs.recommendedTypeChecked,
|
||||
jestplugin.configs['flat/recommended'],
|
||||
importplugin.flatConfigs.recommended,
|
||||
importplugin.flatConfigs.typescript,
|
||||
// Override some rules
|
||||
{
|
||||
name: 'project-settings',
|
||||
languageOptions: {
|
||||
ecmaVersion: 2023,
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.lint.json']
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
// eslint rules
|
||||
eqeqeq: ['error', 'smart'],
|
||||
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
||||
'no-console': 'off',
|
||||
'no-implicit-globals': 'error',
|
||||
'no-inner-declarations': 'error',
|
||||
'no-invalid-this': 'error',
|
||||
'no-return-assign': 'error',
|
||||
'no-sequences': 'error',
|
||||
'no-shadow': 'error',
|
||||
'no-useless-concat': 'error',
|
||||
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
|
||||
'one-var': ['error', 'never'],
|
||||
'prefer-template': 'error',
|
||||
|
||||
// typescript-eslint rules
|
||||
'@typescript-eslint/array-type': 'error',
|
||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||
'@typescript-eslint/explicit-function-return-type': [
|
||||
'error',
|
||||
{ allowExpressions: true }
|
||||
],
|
||||
'@typescript-eslint/explicit-member-accessibility': [
|
||||
'error',
|
||||
{ accessibility: 'no-public' }
|
||||
],
|
||||
'@typescript-eslint/no-extraneous-class': 'error',
|
||||
'@typescript-eslint/no-inferrable-types': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-useless-constructor': 'error',
|
||||
'@typescript-eslint/prefer-for-of': 'warn',
|
||||
'@typescript-eslint/prefer-function-type': 'warn',
|
||||
'@typescript-eslint/prefer-includes': 'error',
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
||||
'@typescript-eslint/promise-function-async': 'error',
|
||||
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||
|
||||
// eslint-plugin-import rules
|
||||
'import/extensions': 'error',
|
||||
'import/first': 'error',
|
||||
'import/no-absolute-path': 'error',
|
||||
'import/no-commonjs': 'error',
|
||||
'import/no-deprecated': 'warn',
|
||||
'import/no-dynamic-require': 'error',
|
||||
'import/no-extraneous-dependencies': 'error',
|
||||
'import/no-mutable-exports': 'error',
|
||||
'import/no-namespace': 'off',
|
||||
'import/no-unresolved': ['error', { ignore: ['csv-parse/sync'] }],
|
||||
'import/no-anonymous-default-export': [
|
||||
'error',
|
||||
{
|
||||
allowAnonymousClass: false,
|
||||
allowAnonymousFunction: false,
|
||||
allowArray: true,
|
||||
allowArrowFunction: false,
|
||||
allowLiteral: true,
|
||||
allowObject: true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
process.stdout.write = jest.fn()
|
||||
Generated
-9394
File diff suppressed because it is too large
Load Diff
@@ -1,92 +0,0 @@
|
||||
{
|
||||
"name": "actions/attest-sbom",
|
||||
"description": "Generate signed SBOM attestations",
|
||||
"version": "2.0.0",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"homepage": "https://github.com/actions/attest-sbom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/attest-sbom.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/attest-sbom/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
"attestation",
|
||||
"sbom"
|
||||
],
|
||||
"exports": {
|
||||
".": "./dist/index.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=24"
|
||||
},
|
||||
"scripts": {
|
||||
"bundle": "npm run format:write && npm run package",
|
||||
"ci-test": "jest",
|
||||
"format:write": "prettier --write **/*.ts",
|
||||
"format:check": "prettier --check **/*.ts",
|
||||
"lint:eslint": "npx eslint",
|
||||
"lint:markdown": "npx markdownlint --config .markdown-lint.yml \"*.md\"",
|
||||
"lint": "npm run lint:eslint && npm run lint:markdown",
|
||||
"package": "ncc build src/index.ts --license licenses.txt",
|
||||
"package:watch": "npm run package -- --watch",
|
||||
"test": "jest",
|
||||
"all": "npm run format:write && npm run lint && npm run test && npm run package"
|
||||
},
|
||||
"license": "MIT",
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
"verbose": true,
|
||||
"clearMocks": true,
|
||||
"testEnvironment": "node",
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"ts"
|
||||
],
|
||||
"setupFilesAfterEnv": [
|
||||
"./jest.setup.js"
|
||||
],
|
||||
"testMatch": [
|
||||
"**/*.test.ts"
|
||||
],
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"/dist/"
|
||||
],
|
||||
"transform": {
|
||||
"^.+\\.ts$": "ts-jest"
|
||||
},
|
||||
"coverageReporters": [
|
||||
"json-summary",
|
||||
"text",
|
||||
"lcov"
|
||||
],
|
||||
"collectCoverage": true,
|
||||
"collectCoverageFrom": [
|
||||
"./src/**"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^2.0.2",
|
||||
"@actions/github": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@actions/attest": "^2.2.0",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/node": "^25.0.9",
|
||||
"@vercel/ncc": "^0.38.4",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jest": "^29.12.1",
|
||||
"jest": "^30.2.0",
|
||||
"markdownlint-cli": "^0.47.0",
|
||||
"prettier": "^3.8.0",
|
||||
"ts-jest": "^29.4.6",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.53.0"
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
name: 'SBOM Predicate'
|
||||
description: 'Generate reference predicate for SBOM attestations'
|
||||
author: 'GitHub'
|
||||
|
||||
inputs:
|
||||
sbom-path:
|
||||
description: >
|
||||
Path to the SBOM file to generate reference predicate
|
||||
required: true
|
||||
github-token:
|
||||
description: >
|
||||
The GitHub token used to upload the SBOM to a release
|
||||
required: true
|
||||
outputs:
|
||||
predicate-path:
|
||||
description: >
|
||||
The path to the JSON-serialized of the attestation predicate
|
||||
predicate-type:
|
||||
description: >
|
||||
URI identifying the type of the predicate.
|
||||
runs:
|
||||
using: node24
|
||||
main: ../dist/index.js
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* The entrypoint for the action.
|
||||
*/
|
||||
import { run } from './main'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
run()
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import { parseSBOMFromPath, storePredicate } from './sbom'
|
||||
import {
|
||||
calculateSHA256,
|
||||
generateReferencePredicate,
|
||||
getMediaType
|
||||
} from './reference'
|
||||
import { uploadSBOMToRelease, buildAttesterId } from './release'
|
||||
|
||||
/**
|
||||
* The main function for the action.
|
||||
* @returns {Promise<void>} Resolves when the action is complete.
|
||||
*/
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
const sbomPath = core.getInput('sbom-path')
|
||||
const token = core.getInput('github-token')
|
||||
|
||||
core.debug(`Reading SBOM from ${sbomPath}`)
|
||||
const sbom = await parseSBOMFromPath(sbomPath)
|
||||
|
||||
// Calculate SHA-256 digest of the SBOM file
|
||||
core.debug('Calculating SBOM digest')
|
||||
const digest = await calculateSHA256(sbomPath)
|
||||
|
||||
// Get context for release upload
|
||||
const { owner, repo } = github.context.repo
|
||||
const runId = github.context.runId
|
||||
const serverUrl = github.context.serverUrl
|
||||
const workflowRef = process.env.GITHUB_WORKFLOW_REF
|
||||
|
||||
if (!workflowRef) {
|
||||
throw new Error('Missing GITHUB_WORKFLOW_REF environment variable')
|
||||
}
|
||||
|
||||
// Upload SBOM to release
|
||||
core.debug('Uploading SBOM to release')
|
||||
const octokit = github.getOctokit(token)
|
||||
const { downloadUrl } = await uploadSBOMToRelease(
|
||||
octokit,
|
||||
owner,
|
||||
repo,
|
||||
runId,
|
||||
sbomPath
|
||||
)
|
||||
|
||||
// Generate reference predicate
|
||||
const attesterId = buildAttesterId(serverUrl, workflowRef)
|
||||
const mediaType = getMediaType(sbom.type)
|
||||
const predicate = generateReferencePredicate({
|
||||
attesterId,
|
||||
downloadLocation: downloadUrl,
|
||||
digest,
|
||||
mediaType
|
||||
})
|
||||
|
||||
const predicatePath = storePredicate(predicate)
|
||||
|
||||
core.setOutput('predicate-path', predicatePath)
|
||||
core.setOutput('predicate-type', predicate.type)
|
||||
} catch (err) {
|
||||
const error = err instanceof Error ? err : new Error(`${err}`)
|
||||
// Fail the workflow run if an error occurs
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import crypto from 'crypto'
|
||||
import type { Predicate } from '@actions/attest'
|
||||
|
||||
export const REFERENCE_PREDICATE_TYPE =
|
||||
'https://in-toto.io/attestation/reference/v0.1'
|
||||
|
||||
export type ReferencePredicate = {
|
||||
attester: {
|
||||
id: string
|
||||
}
|
||||
references: ResourceDescriptor[]
|
||||
}
|
||||
|
||||
export type ResourceDescriptor = {
|
||||
downloadLocation: string
|
||||
digest: {
|
||||
sha256: string
|
||||
}
|
||||
mediaType: string
|
||||
}
|
||||
|
||||
export async function calculateSHA256(filePath: string): Promise<string> {
|
||||
const fileBuffer = await fs.promises.readFile(filePath)
|
||||
const hash = crypto.createHash('sha256')
|
||||
hash.update(fileBuffer)
|
||||
return hash.digest('hex')
|
||||
}
|
||||
|
||||
export type ReferencePredicateParams = {
|
||||
attesterId: string
|
||||
downloadLocation: string
|
||||
digest: string
|
||||
mediaType: string
|
||||
}
|
||||
|
||||
export function generateReferencePredicate(
|
||||
params: ReferencePredicateParams
|
||||
): Predicate {
|
||||
const predicate: ReferencePredicate = {
|
||||
attester: {
|
||||
id: params.attesterId
|
||||
},
|
||||
references: [
|
||||
{
|
||||
downloadLocation: params.downloadLocation,
|
||||
digest: {
|
||||
sha256: params.digest
|
||||
},
|
||||
mediaType: params.mediaType
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
return {
|
||||
type: REFERENCE_PREDICATE_TYPE,
|
||||
params: predicate
|
||||
}
|
||||
}
|
||||
|
||||
export function getMediaType(sbomType: 'spdx' | 'cyclonedx'): string {
|
||||
switch (sbomType) {
|
||||
case 'spdx':
|
||||
return 'application/spdx+json'
|
||||
case 'cyclonedx':
|
||||
return 'application/vnd.cyclonedx+json'
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import * as github from '@actions/github'
|
||||
|
||||
const RELEASE_TAG = 'sbom'
|
||||
|
||||
type Octokit = ReturnType<typeof github.getOctokit>
|
||||
|
||||
export type UploadResult = {
|
||||
downloadUrl: string
|
||||
}
|
||||
|
||||
export async function uploadSBOMToRelease(
|
||||
octokit: Octokit,
|
||||
owner: string,
|
||||
repo: string,
|
||||
runId: number,
|
||||
sbomPath: string
|
||||
): Promise<UploadResult> {
|
||||
const release = await findOrCreateRelease(octokit, owner, repo)
|
||||
const assetName = generateAssetName(runId, sbomPath)
|
||||
|
||||
const fileContent = await fs.promises.readFile(sbomPath)
|
||||
|
||||
const asset = await octokit.rest.repos.uploadReleaseAsset({
|
||||
owner,
|
||||
repo,
|
||||
release_id: release.id,
|
||||
name: assetName,
|
||||
// @ts-expect-error - octokit types expect string but Buffer works
|
||||
data: fileContent
|
||||
})
|
||||
|
||||
return {
|
||||
downloadUrl: asset.data.browser_download_url
|
||||
}
|
||||
}
|
||||
|
||||
async function findOrCreateRelease(
|
||||
octokit: Octokit,
|
||||
owner: string,
|
||||
repo: string
|
||||
): Promise<{ id: number }> {
|
||||
try {
|
||||
const { data: release } = await octokit.rest.repos.getReleaseByTag({
|
||||
owner,
|
||||
repo,
|
||||
tag: RELEASE_TAG
|
||||
})
|
||||
return { id: release.id }
|
||||
} catch (error) {
|
||||
// Release doesn't exist, create it
|
||||
if (isNotFoundError(error)) {
|
||||
const { data: release } = await octokit.rest.repos.createRelease({
|
||||
owner,
|
||||
repo,
|
||||
tag_name: RELEASE_TAG,
|
||||
name: 'SBOM Attestations',
|
||||
body: 'This release contains SBOM files referenced by attestations.',
|
||||
draft: false,
|
||||
prerelease: false
|
||||
})
|
||||
return { id: release.id }
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
function isNotFoundError(error: unknown): boolean {
|
||||
return (
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
'status' in error &&
|
||||
error.status === 404
|
||||
)
|
||||
}
|
||||
|
||||
export function generateAssetName(runId: number, sbomPath: string): string {
|
||||
const originalName = path.basename(sbomPath)
|
||||
return `${runId}-${originalName}`
|
||||
}
|
||||
|
||||
export function buildAttesterId(
|
||||
serverUrl: string,
|
||||
workflowRef: string
|
||||
): string {
|
||||
// workflowRef is in the format: owner/repo/.github/workflows/file.yml@refs/heads/branch
|
||||
// Extract just the owner/repo/.github/workflows/file.yml part
|
||||
const workflowPath = workflowRef.split('@')[0]
|
||||
return `${serverUrl}/${workflowPath}`
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
import type { Predicate } from '@actions/attest'
|
||||
|
||||
export type SBOM = {
|
||||
type: 'spdx' | 'cyclonedx'
|
||||
}
|
||||
|
||||
export async function parseSBOMFromPath(filePath: string): Promise<SBOM> {
|
||||
// Read the file content
|
||||
const fileContent = await fs.promises.readFile(filePath, 'utf8')
|
||||
|
||||
const sbom = JSON.parse(fileContent) as object
|
||||
|
||||
if (checkIsSPDX(sbom)) {
|
||||
return { type: 'spdx' }
|
||||
} else if (checkIsCycloneDX(sbom)) {
|
||||
return { type: 'cyclonedx' }
|
||||
}
|
||||
throw new Error('Unsupported SBOM format')
|
||||
}
|
||||
|
||||
function checkIsSPDX(sbomObject: {
|
||||
spdxVersion?: string
|
||||
SPDXID?: string
|
||||
}): boolean {
|
||||
if (sbomObject?.spdxVersion && sbomObject?.SPDXID) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function checkIsCycloneDX(sbomObject: {
|
||||
bomFormat?: string
|
||||
serialNumber?: string
|
||||
specVersion?: string
|
||||
}): boolean {
|
||||
if (
|
||||
sbomObject?.bomFormat &&
|
||||
sbomObject?.serialNumber &&
|
||||
sbomObject?.specVersion
|
||||
) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export const storePredicate = (predicate: Predicate): string => {
|
||||
// random tempfile
|
||||
const basePath = process.env['RUNNER_TEMP']
|
||||
|
||||
if (!basePath) {
|
||||
throw new Error('Missing RUNNER_TEMP environment variable')
|
||||
}
|
||||
|
||||
const tmpDir = fs.mkdtempSync(path.join(basePath, path.sep))
|
||||
const tempFile = path.join(tmpDir, 'predicate.json')
|
||||
|
||||
// write predicate to file
|
||||
fs.writeFileSync(tempFile, JSON.stringify(predicate.params))
|
||||
return tempFile
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"rootDir": "./src",
|
||||
"moduleResolution": "NodeNext",
|
||||
"isolatedModules": true,
|
||||
"baseUrl": "./",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"noImplicitAny": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"newLine": "lf"
|
||||
},
|
||||
"exclude": ["./dist", "./node_modules", "./__tests__", "./coverage"]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["./__tests__/**/*", "./src/**/*"],
|
||||
"exclude": ["./dist", "./node_modules", "./coverage", "*.json"]
|
||||
}
|
||||
Reference in New Issue
Block a user