Skip to content

crypto: update fingerprint at same time as certificate#10036

Merged
BeryJu merged 1 commit intogoauthentik:mainfrom
TNorthover:update-cert-fingerprint
Jun 10, 2024
Merged

crypto: update fingerprint at same time as certificate#10036
BeryJu merged 1 commit intogoauthentik:mainfrom
TNorthover:update-cert-fingerprint

Conversation

@TNorthover
Copy link
Copy Markdown
Contributor

Details

Previously the fingerprint was only set when initially adding a key, if it changed for any reason (like a renewed certificate) then every execution of Get would lead to a full update. The certificate itself got cached, but the fingerprint remained stale for next time.

This increased the chance of a fatal race during the cache update.

Should fix #9907. I've been running it locally for a while with no more races of any kind, let alone ones that actually clash and crash.

Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made (n/a)
If changes to the frontend have been made (n/a)
If applicable (documentation n/a)

Previously the fingerprint was only set when initially adding a key, if it
changed for any reason (like a renewed certificate) then every execution of
`Get` would lead to a full update. The certificate itself got cached, but the
fingerprint remained stale for next time.

This increased the chance of a fatal race during the cache update.

closes goauthentik#9907
@TNorthover TNorthover requested a review from a team as a code owner June 8, 2024 18:35
@netlify
Copy link
Copy Markdown

netlify bot commented Jun 8, 2024

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit a4a68f2
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/6664a46ec98f8b0008dac201
😎 Deploy Preview https://deploy-preview-10036--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Jun 8, 2024

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit a4a68f2
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/6664a46e1e0e9200091af20e
😎 Deploy Preview https://deploy-preview-10036--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@TNorthover
Copy link
Copy Markdown
Contributor Author

This is my first PR here so sorry if I did anything wrong.

I know this doesn't eliminate all possibility of races but I think that change would need deeper architectural knowledge than I have. Since running this one I've not seen any events logged that could even potentially conflict (a single timed task seems to pick up the change and update the cache before anything actually concurrent happens, at least on my config).

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.64%. Comparing base (644090d) to head (a4a68f2).
Report is 173 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10036      +/-   ##
==========================================
- Coverage   92.66%   92.64%   -0.03%     
==========================================
  Files         708      713       +5     
  Lines       34619    34878     +259     
==========================================
+ Hits        32079    32311     +232     
- Misses       2540     2567      +27     
Flag Coverage Δ
e2e 49.63% <ø> (+0.04%) ⬆️
integration 25.47% <ø> (+0.13%) ⬆️
unit 90.11% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BeryJu BeryJu merged commit 4f40b1e into goauthentik:main Jun 10, 2024
kensternberg-authentik added a commit that referenced this pull request Jun 11, 2024
* main: (66 commits)
  rbac: filters: fix missing attribute for unauthenticated requests (#10061)
  tests/e2e: docker-compose.yml: remove version element forgotten last time (#10067)
  providers/microsoft_entra: fix error when updating connection attributes (#10039)
  website/integrations: aws: fix about service link (#10062)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in it (#10060)
  core: bump github.com/redis/go-redis/v9 from 9.5.2 to 9.5.3 (#10046)
  core: bump github.com/gorilla/websocket from 1.5.1 to 1.5.2 (#10047)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in ru (#10058)
  core: bump sentry-sdk from 2.5.0 to 2.5.1 (#10048)
  core: bump django-cte from 1.3.2 to 1.3.3 (#10049)
  core: bump packaging from 24.0 to 24.1 (#10050)
  web: bump yaml from 2.4.3 to 2.4.5 in /web (#10054)
  web: bump @sentry/browser from 8.7.0 to 8.8.0 in /web in the sentry group (#10051)
  web: bump esbuild from 0.21.4 to 0.21.5 in /web (#10053)
  crypto: update fingerprint at same time as certificate (#10036)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in ru (#10056)
  website/integrations: gitea: fix helm values (#10043)
  core, web: update translations (#10038)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in ru (#10040)
  docs/troubleshooting: upgrade docker: erroneous command (#10044)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renewing detected SSL certificates leads to fatal server crash

2 participants