WebKit / explainers

Explainers from WebKit contributors
371 stars 28 forks source link

[Remote CryptoKeys] Various questions and feedback #110

Open twiss opened 5 months ago

twiss commented 5 months ago

Hi! Here are some thoughts and suggestions on the “remote” CryptoKeys explainer.

First of all, as an aside, I wanted to mention that there is an old proposal for key discovery in Web Crypto. To my knowledge it was never implemented, and I assume it doesn't meet your needs, but it may serve as an inspiration for the spec, and I think there are some differences that would be good to copy here, more on which below.

First, some high-level questions:

Then, some more low-level nitpicks:

estark37 commented 5 months ago

Is there any intention to allow generating a key via this API? The proposal doesn't explicitly mention it, but the UI could offer to generate a key, if the user doesn't have one?

Somewhat related to this, the Security & Privacy Considerations section says that keys should be domain-scoped (though I imagine that should rather be origin-scoped), but it's not clear how this would be accomplished for pre-existing keys, and there's no specified way to generate keys. In other words, how do we determine the origin that a key belongs to, if it wasn't generated by the browser on behalf of a particular origin?

jonchoukroun commented 4 months ago

Thanks for the feedback @twiss and @estark37.

twiss commented 3 months ago

The intention is for all keys used by this API to be origin-scoped, however it’s still open for debate how we should enforce that in the spec. Is it enough for the spec to recommend implementers require that keys are origin-scoped and perform a validation?

Do you mean that, if the user has an S/MIME certificate for alice@example.com, they can only access the key from https://example.com?

I worry that it wouldn't be super useful because you might have a mail app on mail.example.com serving email for @example.com, or even for entirely different domains (if the user uses their own custom domain, for example).

So I think it would be more useful if the app could request the key for any S/MIME certificate; if the user gives permission for that, of course. Perhaps the permission could be dependent on the app being selected as the user's email client / mailto: handler, or something like that? (Of course that would make it very email-specific, but some parts of the proposed API already seem somewhat email-specific to me, TBH, so maybe that's OK?)