-
Notifications
You must be signed in to change notification settings - Fork 516
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
Update BBS+ context to bypass redirections #2739
Conversation
Signed-off-by: Stephen Curran <[email protected]>
Addresses #2738. A reasonable change to make, @andrewwhitehead ? Dang...lint issues. |
Signed-off-by: Stephen Curran <[email protected]>
I don't see anywhere that we reject a BBS credential if it doesn't have the expected context, so it looks like no change is needed there. Interestingly it looks like we only use the JSON-LD document loader with cached results in tests, not in production – I find that a bit surprising. One minor issue I see is that the BBS context is auto-added to issued credentials with the BBS signature type. If the provided JSON includes the legacy context, then the new context will be added as well, unnecessarily. |
@andrewwhitehead — those issues seem independent of this change, right? All this does is bypass the current redirection that is happening from the old BBS+ context URL to the new one. So I think this one is safe enough. Correct? The rest of the things you mention existing issues that should be at least recorded and fixed. Of particular concern to me is the document loader not being used in production. That seems like a problem. The auto-adding is a also a bit of an issue. What do JSON-LD processors do when a context is referenced twice in the same document? Could you be more precise on exactly what is needed? |
I think the only immediate change is that if a provided credential contains the 'legacy' BBS context, then we should not be adding the new one as well, just to avoid breaking things for anybody using that functionality. I'm not certain if it would break the JSON-LD processing, we could test that in the playground, but it wouldn't be ideal. |
So we are good to go with this one? Assuming the tests pass? |
Hi @swcurran @andrewwhitehead thank you so much for jumping into this issue quickly, I tried replacing |
Would it be an issue with the response header from W3C that caused the document loader to not work? When I tried to host the BBS context locally (e.g. If this is the case, I wonder if we have any option to not load BBS context from a remote source? Or the ability to change it to another URL? |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
It looks like that URL also returns a 301 redirect, and it would need an extra trailing slash to avoid that. But the resolver needs to be able to handle redirects anyway. |
So to fully deal with the issue, I should do another PR in to add a “/“ on the end? |
I feel like it might be better to keep the original URL and make sure that redirects are supported (with a unit test), given that the w3 URL can be more easily redirected in case the hosting URL changes. We also need to make sure that the base credential context is always precached. |
Actually it does appear that the base context is precached, but the BBS context wasn't added here which might be a faster fix: https://github.com/hyperledger/aries-cloudagent-python/blob/main/aries_cloudagent/vc/ld_proofs/document_downloader.py#L39-L45 |
I’ll add a task for you to fix this. I thought this would be a trivial change. I don’t understand redirects enough to understand why continuing to use an outdated URL is the right way to go. That said, I agree, it will be moved again in the future, so whatever we can do to prevent future issues is the right thing. |
Signed-off-by: Stephen Curran [email protected]