-
-
Notifications
You must be signed in to change notification settings - Fork 16
Add GetDevicePublicKey #265
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
base: main
Are you sure you want to change the base?
Conversation
@aromaa I was picturing this living in in the X502Cert class.... 🤔 |
Isn't that a bit funny? The certificate itself shouldn't know about how/where to retrieve certificates. The |
WalkthroughThe pull request involves a simple version update in the Changes
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
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 (
|
I was looking at this again. |
Reviewing the native implementation that one is actually returning the device certificate from storage. I understand the convenience to retrieve properties from the device cert to automate interaction with Azure services, for example. |
I'm not sure I follow, the native implementation extracts the device certificate yes, but it does indeed only extract the PUBLIC key. Is the implementation not sufficient in all use cases? For my use case, I have indeed verified that ONLY the public key is returned. There is no private key exposed to the managed layer. Are there cases where you observed the private key leaking out? |
I haven't said that the private key is being leaked. Rather that the full device certificate is being exposed. I understand that accessing a device certificate in the Azure IoT Hub context is not inherently a security flaw. Still, I'm concerned that exposing it maybe against good practices. That's why I'm suggesting exposing only the relevant bits. |
I see, I would be interested to know in which conditions would exposing the public key be a security flaw.
I have no issues with it if its actually a security flaw. Yes, I'm currently using only the subject part. |
Exposing the public key is not a security concern at all. The private key is! Now, when the cert is uploaded in the device, the magic when using Azure IoT Hub or anything else that require the cert should just work out of the box (as far as I remember with my various tests). And I'd like to understand the scenario for having only the pubic key. |
@aromaa looking at this into more details, I agree with José, we should not expose it like this. Because, you'll get everything from the certificate and in that case, it's not just the public key. If you need to play with certs (CA or device certs), you can use:
In both cases, you can use nanoff (for the second case, it's under PR, so very very soon) to flash those data into the storage or the device configuration. |
Could you please elaborate in which cases does that apply to? For my limited testing, I have not observed my private key to being leaked out. |
@aromaa no one has ever ever mentioned that the private key was leaking or has been observed. So, let's put that aside, OK? (if you prefer, OK to discuss this on Discord as the conversation flow is more smooth) |
All I am asking is what are we trying to protect here. Nobody has elaborated any further. We both have mutual understanding that the private key should not leak out, that is a must. But what else is there that is a secret other than the private key then? |
Description
Motivation and Context
How Has This Been Tested?
CertificateManager.GetDevicePublicKey()
.Screenshots
Types of changes
Checklist:
Summary by CodeRabbit