trust-manager icon indicating copy to clipboard operation
trust-manager copied to clipboard

Add a verification the certificate is a CA certificate

Open AlexanderKocheshkov opened this issue 4 weeks ago • 6 comments

Now user able to add non-CA certificate to bundle, and trust manager doesn't verify, that added cert isn't CA cert, and adds it to bundle. Please, include a verification to certs to be added.

AlexanderKocheshkov avatar Dec 02 '25 10:12 AlexanderKocheshkov

@erikgb hello, can I work on this issue?

arsenalzp avatar Dec 02 '25 22:12 arsenalzp

@erikgb hello, can I work on this issue?

Please do, @arsenalzp! 💯 Are we heading for a controller flag/option, as we do for similar options already?

erikgb avatar Dec 03 '25 07:12 erikgb

@erikgb hello, can I work on this issue?

Please do, @arsenalzp! 💯 Are we heading for a controller flag/option, as we do for similar options already?

Yes, sure. As always we can manage this behavior with controller option. @erikgb @AlexanderKocheshkov how to recognize a CA certificate? Can we use basicConstraints=CA:true?

arsenalzp avatar Dec 03 '25 08:12 arsenalzp

We should also make room for an even stricter validation, where only root/self-signed CAs are allowed in bundles.

I am pretty sure @SgtCoDFish has something to add to this!

erikgb avatar Dec 03 '25 08:12 erikgb

Might be useful to think about extensibility of the API that we create. Other options that we might want to add in the future:

  • only allow root certificates
  • only allow certificates that are not valid for longer than X years
  • only allow certificates with a max max-pathlen

inteon avatar Dec 05 '25 10:12 inteon

Can we use basicConstraints=CA:true?

This is the primary way to check, yeah. The best resource is https://cabforum.org/working-groups/server/baseline-requirements/requirements/ for certs in the public internet.

Specifically:

  • This lists the extensions in the cert which are required for root certs
  • This lists them for cross signed intermediates
  • This lists for intermediate certs.

We shouldn't check for all of the required extensions - checking for basicConstraits CA=true will probably be the best starting point!

SgtCoDFish avatar Dec 05 '25 11:12 SgtCoDFish