Skip to content
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

Fix empty ServiceDecorator in OobRecord causing 422 Unprocessable Entity Error #2362

Merged

Conversation

ff137
Copy link
Contributor

@ff137 ff137 commented Jul 28, 2023

Resolves #2242

…_decorator_from_service`

Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
…_decorator_from_service`

Signed-off-by: ff137 <ff137@proton.me>
…orator_from_service` and returns None

Signed-off-by: ff137 <ff137@proton.me>
…rs being returned

Signed-off-by: ff137 <ff137@proton.me>
@ff137 ff137 marked this pull request as ready for review July 28, 2023 12:51
@swcurran
Copy link
Contributor

Errors have to do with current issue with BCovrin. Someone created some fun for us on the network. Sigh.

I’ll wait a little, as I expect the network back soon and rerun. I won’t hold it up too long…

Thanks for the contribution!

@ff137 ff137 marked this pull request as draft July 28, 2023 16:00
@ff137
Copy link
Contributor Author

ff137 commented Jul 28, 2023

Setting to draft again.

I notice that in the Service definition we have:

class Service(BaseModel):
    def __init__(
...
        recipient_keys: Sequence[str] = None,
        routing_keys: Sequence[str] = None,
    ):

This means that in _service_decorator_from_service:

            recipient_keys = [
                DIDKey.from_did(did_key).public_key_b58
                for did_key in service.recipient_keys
            ]
            routing_keys = [
                DIDKey.from_did(did_key).public_key_b58
                for did_key in service.routing_keys
            ]

those operations could raise an exception if either service.recipient_keys or service.routing_keys are None (not iterable).

@ff137 ff137 marked this pull request as ready for review July 31, 2023 11:27
@sonarcloud
Copy link

sonarcloud bot commented Jul 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ff137
Copy link
Contributor Author

ff137 commented Jul 31, 2023

Looking again in the Service definition, we have:

        self.recipient_keys = list(recipient_keys) if recipient_keys else []

This means my previous comment is wrong: recipient_keys won't be None. So, no additional changes necessary.

It could make sense to require at least one recipient key to be present, but that's beyond this scope of this quick bug fix.

@swcurran swcurran merged commit 2b0e27a into openwallet-foundation:main Jul 31, 2023
@ff137 ff137 deleted the fix/empty-service-decorator branch October 17, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty ServiceDecorator in OobRecord Response causes 422 Unprocessable Entity Error
3 participants