-
Notifications
You must be signed in to change notification settings - Fork 1
add clear certificate option #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis PR updates the Changes
Sequence Diagram(s)sequenceDiagram
participant User as Caller
participant CF as CloudFlare
User->>CF: uploadTlsClientAuth({clientKey, clientCert, caCert, clear})
alt clear parameter is true
CF->>CF: clearCustomCerts()
CF->>CF: getClientCerts() & getCaCerts()
alt Client certificates exist
CF->>CF: deleteClientCert(certId)
end
alt CA certificates exist
CF->>CF: deleteCaCert(certId)
end
end
alt Certificate files provided
CF->>CF: Read file contents and proceed with upload
else
CF->>User: Skip upload
end
Possibly related PRs
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
cloudflare.js (3)
812-829
: Consider handling partial certificate arguments more explicitly.
Currently, the code only proceeds when all three ofclientKey
,clientCert
, andcaCert
are provided. If partial updates or error feedback on missing parameters are needed, a refactor may be beneficial.
831-850
: Fix mismatch in console error message for CA cert deletion.
The second loop logs "Failed to delete Client cert" even though it is deleting CA certs. Consider applying this change:- console.error(`Failed to delete Client cert: ${e?.message}`) + console.error(`Failed to delete CA cert: ${e?.message}`)
807-918
: Add tests for new cert handling methods.
The new methods (clearCustomCerts
,getClientCerts
,getCaCerts
,deleteClientCert
,deleteCaCert
) and the updateduploadTlsClientAuth
could benefit from dedicated tests to ensure coverage and prevent regressions.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
cloudflare.js
(1 hunks)
🔇 Additional comments (5)
cloudflare.js (5)
807-811
: Implementation of 'clear' parameter is correct.
This block correctly checks theclear
flag before callingclearCustomCerts()
. No issues identified.
852-868
: Looks good!
The retrieval of client certificate IDs is implemented cleanly.
870-886
: Straightforward retrieval of CA certificates.
This logic closely mirrors the client cert retrieval and appears correct.
888-902
: Deletion logic for client certs is correct.
No concerns spotted.
904-918
: Deletion logic for CA certs is correct.
No concerns spotted.
Summary by CodeRabbit