letsencrypt / letsencrypt/boulder

PA: Streamline policy file loading

Open
#8,985 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
5.8k
Forks
649
Avg merge
3d 23h
Merged PRs (30d)
24

Description

This is a follow-up to https://github.com/letsencrypt/boulder/issues/8700

Creation of a PA comes in two steps: first policy.New(), which never returns an error, followed by a call to pa.LoadIdentPolicyFile(). As a result, the AuthorityImpl has to have a mutex protecting its internal maps from concurrent writes, and many of its methods have to have guards checking that the member fields they care about aren't nil. But in practice, we only ever call LoadIdentPolicyFile once: from main.go, during service startup. There's no reason for it to be a separate function.

Instead, let's modify policy.New() to take the policy files as an argument and initialize its internal maps immediately. This will remove the need for the mutex and the top-of-method guards.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in main.go and trace policy.New(), LoadIdentPolicyFile(), and AuthorityImpl to find all construction and loading call sites. Update the initialization flow so policy.New() receives the policy files and initializes its maps immediately; done means the one-time loader, mutex, and nil guards are no longer needed without changing startup behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, security
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.