fix(revoke): fail-closed is_attached_to_endpoint for non-AWS source plugins - #361
Open
evan-datadog wants to merge 1 commit into
Open
fix(revoke): fail-closed is_attached_to_endpoint for non-AWS source plugins#361evan-datadog wants to merge 1 commit into
evan-datadog wants to merge 1 commit into
Conversation
…get_endpoint_certificate_names is_attached_to_endpoint() returns False whenever endpoint.source.plugin lacks get_endpoint_certificate_names() (only lemur_aws implements it; GCP/Azure/COA do not). The sole caller is the revoke endpoint, which uses the result to gate a 403 'cannot revoke, still deployed' response. Returning False lets revoke() proceed even though the cert may still be serving traffic on a non-AWS endpoint. - Return True (fail-closed) + error log + capture_exception() when the plugin cannot verify attachment, so a possibly still-deployed cert is never silently revoked (was fail-open False, and before that an uncaught AttributeError/500) - Return False (no crash) when the endpoint no longer exists - Add unit tests for missing-method (fail-closed), endpoint-not-found, present, absent Workspace: local
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Problem:
is_attached_to_endpoint()returnsFalse("not attached") wheneverendpoint.source.pluginlacksget_endpoint_certificate_names(). Only thelemur_awssource plugin implements this method — GCP, Azure, and COA source plugins do not, and there's no base-class contract inplugins/bases/source.py. The sole caller is the revoke endpoint (certificates/views.py), which uses the result to gate a 403 "cannot revoke, still deployed" response. ReturningFalseletsservice.revoke()proceed even though the certificate may still be serving traffic on a non-AWS endpoint.Fixes (fail-closed):
get_endpoint_certificate_names()), returnTrue(assume attached) + error log +capture_exception()— so a possibly still-deployed cert is never silently revoked. Previously: fail-openFalse(and before that, an uncaughtAttributeError/500 that accidentally blocked revocation).get_by_name→None), returnFalse(nothing to be attached to) instead of crashing.Changes
lemur/certificates/service.pyis_attached_to_endpoint: fail-closed for plugins lackingget_endpoint_certificate_names()(True + error log +capture_exception());None-endpoint guard returnsFalseinstead of raisinglemur/tests/test_certificates.pyTrue), endpoint-not-found (False), method-present-with-cert (True), method-present-without-cert (False)Test plan
get_endpoint_certificate_names→ returnsTrue(fail-closed, no AttributeError)None→ returnsFalse(no AttributeError)True; cert absent →FalseNote: split out of PR #355 (rotation-window fix) — this is an unrelated safety fix for the revoke path.
Fixes CLOUDR-2089
Workspace:
local🤖 Generated with Claude Code