GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Validate root CA certificates on startup by vlasebian · Pull Request #7867 · TheThingsNetwork/lorawan-stack

Conversation

@vlasebian

@vlasebian vlasebian commented Mar 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Validate that certificates configured as root CAs are actually CA certificates at startup, preventing misconfiguration where a server leaf certificate is accidentally set as a root CA.

Changes

  • Add parseAndValidateCACerts function that validates PEM-encoded root CA certificates have the IsCA flag set.
  • Reject non-CA (leaf) certificates, invalid PEM data, and non-CERTIFICATE PEM blocks with clear error messages.
  • Use project error definitions (errors.DefineInvalidArgument) for consistent error handling.
  • Handle trailing whitespace in PEM files gracefully.

Testing

Steps

Run the unit tests:

go test ./pkg/config/tlsconfig/... -v -run TestApplyTLSClientConfig
Results

Unit tests pass.

Regressions
  • Client.ApplyTo now validates certificates before adding them to the root CA pool. Previously, any PEM certificate (including leaf certs) was silently accepted. Existing valid configurations are unaffected.

Notes for Reviewers

...

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md for the chosen target branch.
  • Documentation: Relevant documentation is added or updated.
  • Testing: The steps/process to test this feature are clearly explained including testing for regressions.
  • Infrastructure: If infrastructural changes (e.g., new RPC, configuration) are needed, a separate issue is created in the infrastructural repositories.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vlasebian vlasebian self-assigned this Mar 26, 2026
@github-actions github-actions Bot added compat/config This could affect Configuration compatibility ui/web This is related to a web interface labels Mar 26, 2026
vlasebian and others added 3 commits April 2, 2026 13:12
@vlasebian @claude
all: Validate root CA certificates are CA certs
96cab90
Reject non-CA (leaf) certificates configured as root CAs to prevent
misconfiguration where a server leaf certificate is set as a root CA.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@vlasebian
dev: Update changelog for root CA validation
d8a97de
@vlasebian
dev: Update error messages
3b900e6
@vlasebian
vlasebian force-pushed the feat/check-root-ca-config-on-start branch from afdc948 to 3b900e6 Compare April 2, 2026 10:13

This branch has not been deployed

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@vlasebian vlasebian

Labels

compat/config This could affect Configuration compatibility ui/web This is related to a web interface

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@vlasebian
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.