Skip to content

Registry doesnt work with license scanning tools. #1187

Open

Description

@hmmh-d-s

Hi,

There are some license scanning tools like cdxgen for terraform, to produce SBOMs.

Currently those tools don't seem to work well with coders registry so I oppened an upstrean issue:
cdxgen/cdxgen#4432 (comment)

They Informed me, that the coder terraform registry does not implement the "metadata" endpoint that terraforms and opentofus registry have.
They also suggested as an alternative fix, to have the license in each modules subdirectory cdxgen/cdxgen#4432 (comment)
So they are served with the module.

It would be nice to find a solution for this.
Of course, I could always on each small change, when an SBOM is generated in CI, manually patch in the license information, but that would kind of destroy the credibility of said sbom, and be somewhat fragile.

Activity

  1. linear-code commented on Oct 16, 2026

    @linear-code
  2. matifali commented on Oct 16, 2026

    @matifali
    Collaborator

    Thanks for reporting this @hmmh-dominik-saeume . Can you talk more about the metadata endpoint?

  3. prabhu commented on Oct 19, 2026

    @prabhu

    Hi @matifali, I maintain cdxgen and wrote the comment Dominik linked, so let me fill in the details.

    cdxgen generates SBOMs for Terraform and OpenTofu projects and tries to attach a license to every provider and module. It does this in two passes. The offline pass looks for a LICENSE, LICENSE.md or LICENSE.txt file in the module directory that terraform init unpacks under .terraform/modules. The online pass, which users opt into, asks the public registries for metadata and falls back to the GitHub license API once it knows which repository a module was published from.

    For registry.coder.com/coder/git-clone/coder 2.0.5 both passes come up empty. The tarball served from /download/coder/2.0.5-git-clone.tar.gz contains the README, main.tf, run.sh and two test files, but no license file. There is also no machine-readable way to learn that the module comes from github.com/coder/registry.

    The endpoint I mentioned is the "get a specific module" call from the public Terraform Registry API. Its source field is what lets tools go from a module address to a repository:

    GET https://registry.terraform.io/v1/modules/terraform-aws-modules/vpc/aws/5.1.2
    {"id": "terraform-aws-modules/vpc/aws/5.1.2", "source": "https://github.com/terraform-aws-modules/terraform-aws-vpc", ...}
    
    GET https://registry.coder.com/terraform_protocol/coder/git-clone/coder/2.0.5
    404 page not found
    

    To be fair to your registry, the 404 is not a bug. The module registry protocol only requires the versions and download endpoints, and registry.coder.com implements both correctly. HashiCorp documents the metadata call as an optional extension of the public registry. registry.opentofu.org does not implement it either; OpenTofu publishes the same information through a separate API at api.opentofu.org.

    The change that would help most is adding the repository's root LICENSE file to each module tarball when it is packaged. That needs no per-module copies in the repo and no new API. It also fixes cdxgen and every other SBOM or license scanner at once, including offline and air-gapped scans. If you later want to support remote lookups as well, the optional endpoint above with source set to https://github.com/coder/registry would be enough for tools that query third-party registries. cdxgen does not do that today, which is why the LICENSE in the tarball is what would actually change the result for our users.

    I'm happy to test a build against cdxgen once it is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions