w3c / webappsec-credential-management

WebAppSec Credential Management
https://w3c.github.io/webappsec-credential-management/
Other
50 stars 38 forks source link

DiscoverFromExternalSource setup needs some fixes #211

Open npm1 opened 1 year ago

npm1 commented 1 year ago

The current setup of DiscoverFromExternalSource seems incorrect. It is invoked from in parallel yet catches exceptions. That's not really a thing. An exception that is used to reject a promise would need to be created from main (not in parallel). So either Discover needs to be invoked from main, or the exception needs to be created outside of Discover.

Besides this, the return value itself of DiscoverFromExternalSource is a Credential. Such an object could only be created from main. Yet the algorithm is invoked from in parallel but with no mention to the globalObject that should be used to create the object.

Based on the above, it is probably best to invoke Discover from main if possible. Since the algorithm is being called from in parallel, that would involve a task. Alternatively, the algorithm needs to receive the execution context, and needs to receive as return value an object which can be either a Credential or an exception object (not sure if exception being propagated upwards is a thing while in parallel).

npm1 commented 1 year ago

Hm given that Discover can be complex, I think keeping it being invoked from in parallel but providing the relevant fixes is the best solution.