A GitHub Action to download and use our enterprise tool vcn in CI

Recently, we at Codenotary released a new version of a GitHub Action that can be used to download our enterprise CLI tool vcn and execute commands with it. Available on GitHub’s marketplace, it can be implemented by our customers in GitHub Action continuous integration pipelines to notarize and authenticate digital assets as part of an attestation process.

The Action has two different usages: standard and custom. The standard uses all available inputs, while the custom usage takes only the version input, leaving all the other configurations for the user.

Standard usage

This is the default usage, meaning you don’t need to configure the standard_usage input when you want to use it.

Now, as an example, let’s say you wanted to download the latest version of vcn and notarize a binary file compiled for your application. This task can be easily accomplished with an yaml file like below:

name: notarize-binary

on:
  push:
    branches: [main]

jobs:
  notarize-on-linux:
    runs-on: ubuntu-latest
    steps:
      - name: Build binary
      # Steps in which you build, test, scan, etc...

      - name: Download vcn and notarize binary
        uses: codenotary/vcn-github-action@v2
        with:
            mode: notarize
            asset: my_binary
            cnc_host: codenotary-trustcenter-url
            cnc_grpc_port: 443
            cnc_api_key: ${{secrets.my_trustcenter_api_key}}

This GitHub Action yaml configuration file will run on every push to the main branch of the repository where it is. It will then use the major version 2 of our vcn-github-action to download the latest version of vcn. Following that, it will execute the notarize command, as specified with the mode input, on the my_binary asset. The command will run with the --lc-host, --lc-port and --lc-api-key flags passing the values from the cnc_host, cnc_grpc_port and the cnc_api_key inputs, respectively.

Notice how we used a secret for the API key instead of hardcoding it on the file. As a secret, it will also be redacted in the GitHub Action logs.

This is what will be logged on the Download vcn and notarize binary step:

Run codenotary/vcn-github-action@v2
Run chmod +x /home/runner/work/_actions/codenotary/vcn-github-action/v2/get-vcn.sh && bash /home/runner/work/_actions/codenotary/vcn-github-action/v2/get-vcn.sh 

This action will download VCN version latest.
Downloading vcn from https://vcn-releases.codenotary.com/vcn-latest-linux-amd64-static
Successfully downloaded file.
vcn: application/x-executable; charset=binary
File https://vcn-releases.codenotary.com/vcn-latest-linux-amd64-static is executable.

Run test "true" = "true" && { ./vcn notarize my_binary --lc-host codenotary-trustcenter-url --lc-port 443 --lc-api-key my_trustcenter_api_key || exit 2; }  || exit 0
VCN saved locally the trusted public key
VCN automatically trusted the signature found on current connection
Your assets will not be uploaded. They will be processed locally.
Notarization in progress...
UID:		1656698789407294142
Kind:		file
Name:		my_binary
Hash:		e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Timestamp:	2022-07-01 18:06:29.407294142 +0000 UTC
SignerID:	signer-id-number
Apikey revoked:	no
Status:		TRUSTED

Custom usage

The custom usage is for more experienced users who have a broader knowledge of vcn and want to make use of more options. The standard_usage input must then be configured with false and, as mentioned above, the only input the Action will consider is the version.

For this example I’ll show how you can notarize an asset built in a pipeline.

name: notarize-artifact

on:
  push:
    branches: [main]

jobs:
  notarize-on-linux:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      # This downloads the vcn binary. No other inputs needed
      - name: Download vcn
        uses: codenotary/vcn-github-action@v2
        with:
          standard_usage: false
      # Intermediate steps in which you build, test, scan, etc...
      ...
      # Simple notarization, including an attachment
      - name: Notarize artifact
        run: ./vcn notarize my_artifact.jar --lc-host codenotary-trustcenter-url --lc-port 443 --lc-api-key ${{secrets.my_trustcenter_api_key}} --attach reports/my_scan_report
        shell: bash

Again, the Action will download the vcn tool and execute the command defined in the configuration file. As you can see, the process is very similar, however, you need to specify the vcn command with all the options as you would on a console.

This is what the Notarize artifact step will log:

Run ./vcn notarize my_artifact.jar --lc-host codenotary-trustcenter-url --lc-port 443 --lc-api-key my_trustcenter_api_key
VCN saved locally the trusted public key
VCN automatically trusted the signature found on current connection
Your assets will not be uploaded. They will be processed locally.
Notarization in progress...
UID:		1656699498966060617
Kind:		file
Name:		my_artifact.jar
Hash:		e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Timestamp:	2022-07-01 18:18:18.966060617 +0000 UTC
SignerID:	signer-id-number-901
Apikey revoked:	no
Status:		TRUSTED

Conclusion

These examples are just a starting point showing some ways this Action can be used in continuous integration pipelines on GitHub. The main benefit is to skip the download part and be able to choose which vcn version should be used.

You can try it yourself by starting a Codenotary Trustcenter trial:

CNIL Metrics & Logs

Self-Hosted performance monitoring and compliant log analysis for VMware vSphere, container and much more.

immudb

Built on the fastest immutable ledger technology. Open Source and easy to use and integrate into existing application.

Codenotary Cloud

Trusted CI/CD, SBOM and artifact
protection with cryptographic proof.
One CLI to manage all.

Subscribe to Our Newsletter

Get the latest product updates, company news, and special offers delivered right to your inbox.

Subscribe to our newsletter

Use Case - Tamper-resistant Clinical Trials

Goal:

Blockchain PoCs were unsuccessful due to complexity and lack of developers.

Still the goal of data immutability as well as client verification is a crucial. Furthermore, the system needs to be easy to use and operate (allowing backup, maintenance windows aso.).

Implementation:

immudb is running in different datacenters across the globe. All clinical trial information is stored in immudb either as transactions or the pdf documents as a whole.

Having that single source of truth with versioned, timestamped, and cryptographically verifiable records, enables a whole new way of transparency and trust.

Use Case - Finance

Goal:

Store the source data, the decision and the rule base for financial support from governments timestamped, verifiable.

A very important functionality is the ability to compare the historic decision (based on the past rulebase) with the rulebase at a different date. Fully cryptographic verifiable Time Travel queries are required to be able to achieve that comparison.

Implementation:

While the source data, rulebase and the documented decision are stored in verifiable Blobs in immudb, the transaction is stored using the relational layer of immudb.

That allows the use of immudb’s time travel capabilities to retrieve verified historic data and recalculate with the most recent rulebase.

Use Case - eCommerce and NFT marketplace

Goal:

No matter if it’s an eCommerce platform or NFT marketplace, the goals are similar:

  • High amount of transactions (potentially millions a second)
  • Ability to read and write multiple records within one transaction
  • prevent overwrite or updates on transactions
  • comply with regulations (PCI, GDPR, …)


Implementation:

immudb is typically scaled out using Hyperscaler (i. e. AWS, Google Cloud, Microsoft Azure) distributed across the Globe. Auditors are also distributed to track the verification proof over time. Additionally, the shop or marketplace applications store immudb cryptographic state information. That high level of integrity and tamper-evidence while maintaining a very high transaction speed is key for companies to chose immudb.

Use Case - IoT Sensor Data

Goal:

IoT sensor data received by devices collecting environment data needs to be stored locally in a cryptographically verifiable manner until the data is transferred to a central datacenter. The data integrity needs to be verifiable at any given point in time and while in transit.

Implementation:

immudb runs embedded on the IoT device itself and is consistently audited by external probes. The data transfer to audit is minimal and works even with minimum bandwidth and unreliable connections.

Whenever the IoT devices are connected to a high bandwidth, the data transfer happens to a data center (large immudb deployment) and the source and destination date integrity is fully verified.

Use Case - DevOps Evidence

Goal:

CI/CD and application build logs need to be stored auditable and tamper-evident.
A very high Performance is required as the system should not slow down any build process.
Scalability is key as billions of artifacts are expected within the next years.
Next to a possibility of integrity validation, data needs to be retrievable by pipeline job id or digital asset checksum.

Implementation:

As part of the CI/CD audit functionality, data is stored within immudb using the Key/Value functionality. Key is either the CI/CD job id (i. e. Jenkins or GitLab) or the checksum of the resulting build or container image.

White Paper — Registration

We will also send you the research paper
via email.

CodeNotary — Webinar

White Paper — Registration

Please let us know where we can send the whitepaper on CodeNotary Trusted Software Supply Chain. 

Become a partner

Start Your Trial

Please enter contact information to receive an email with the virtual appliance download instructions.

Start Free Trial

Please enter contact information to receive an email with the free trial details.