Golang library for SPIFFE support
Go to file
dependabot[bot] c03307b73f
Bump google.golang.org/protobuf from 1.36.7 to 1.36.8 (#354)
Bumps google.golang.org/protobuf from 1.36.7 to 1.36.8.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-version: 1.36.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-13 17:52:15 +00:00
.github Bump actions/setup-go from 5 to 6 (#358) 2025-09-13 17:42:57 +00:00
bundle Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
examples Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
federation Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
internal Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
logger Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
proto/spiffe/workload Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
spiffegrpc/grpccredentials Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
spiffeid Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
spiffetls Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
svid Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
workloadapi Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
.gitattributes Support building on Windows (#191) 2022-04-14 11:35:32 -03:00
.gitignore Fix some spiffetls typos (#204) 2022-12-02 12:16:58 -07:00
.golangci.yml Move code out of v2 directory (#337) 2025-04-09 06:03:49 -06:00
CHANGELOG.md v2.6.0 changelog (#353) 2025-08-21 14:57:50 +00:00
CODEOWNERS Add myself to CODEOWNERS (#167) 2021-06-28 15:35:02 -06:00
LICENSE Update license file to correct Apache 2.0 license (#146) 2021-06-28 15:13:22 -06:00
Makefile Bump supported Go version and add policy (#352) 2025-08-21 14:39:14 +00:00
README.md Bump supported Go version and add policy (#352) 2025-08-21 14:39:14 +00:00
go.mod Bump google.golang.org/protobuf from 1.36.7 to 1.36.8 (#354) 2025-09-13 17:52:15 +00:00
go.sum Bump google.golang.org/protobuf from 1.36.7 to 1.36.8 (#354) 2025-09-13 17:52:15 +00:00

README.md

go-spiffe (v2)

This library is a convenient Go library for working with SPIFFE.

It leverages the SPIFFE Workload API, providing high level functionality that includes:

  • Establishing mutually authenticated TLS (mTLS) between workloads powered by SPIFFE.
  • Obtaining and validating X509-SVIDs and JWT-SVIDs.
  • Federating trust between trust domains using SPIFFE bundles.
  • Bundle management.

Documentation

See the Go Package documentation.

Quick Start

Prerequisites:

  1. Running SPIRE or another SPIFFE Workload API implementation.
  2. SPIFFE_ENDPOINT_SOCKET environment variable set to address of the Workload API (e.g. unix:///tmp/agent.sock). Alternatively the socket address can be provided programatically.

To create an mTLS server:

listener, err := spiffetls.Listen(ctx, "tcp", "127.0.0.1:8443", tlsconfig.AuthorizeAny())

To dial an mTLS server:

conn, err := spiffetls.Dial(ctx, "tcp", "127.0.0.1:8443", tlsconfig.AuthorizeAny())

The client and server obtain X509-SVIDs and X.509 bundles from the SPIFFE Workload API. The X509-SVIDs are presented by each peer and authenticated against the X.509 bundles. Both sides continue to be updated with X509-SVIDs and X.509 bundles streamed from the Workload API (e.g. secret rotation).

Examples

The examples directory contains rich examples for a variety of circumstances.

Supported Go Versions

This library tracks the minimum officially supported Go version (i.e. N-1). The only exception to this policy will be in response to a security issue affecting a dependency that forces a premature upgrade. This action is expected to be rare, will not be taken lightly, and not until reasonable efforts to mitigate the security issue while maintaining this policy are pursued.

Reporting Security Vulnerabilities

If you've found a vulnerability or a potential vulnerability in go-spiffe, please let us know at security@spiffe.io. We'll send a confirmation email to acknowledge your report, and we'll send an additional email when we've identified the issue positively or negatively.