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

BUG - Certain variations on non revocation intervals in a proof request cause 500 internal server errors #769

Closed
nodlesh opened this issue Oct 28, 2020 · 2 comments

Comments

@nodlesh
Copy link

nodlesh commented Oct 28, 2020

Issue

The following variations on the non revocation interval in Proof requests will throw a 500 internal server error. The Acapy logs will give extra info on the error, but this info never makes it though to the admin api caller.

  1. If the to and from fields are float instead of int.
    ie. (1603917464.8775065, 1603915000.8000005)
  2. If the to field is at a time before the creation of the revocation registry.
  3. If (0, 0) is used.
  4. if the interval is open-ended on either side.
    ie:
"non_revoked": {
            "from": 1603917464.8775065,
            "to": 
        }

Outcomes

500 Internal Server Error\n\nServer got itself in trouble

Errors from the acapy agent output (Numbers below correspond to the issues numbers above)

2020-10-23 21:51:19,522 aries_cloudagent.core.dispatcher ERROR Handler error: presentation_exchange_send_presentation  
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/protocols/present_proof/v1_0/routes.py", line 930, in presentation_exchange_send_presentation
    comment=body.get("comment"),
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/protocols/present_proof/v1_0/manager.py", line 359, in create_presentation
    referent_non_revoc_interval.get("to", epoch_now),
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/ledger/indy.py", line 1105, in get_revoc_reg_delta
    public_info and public_info.did, revoc_reg_id, timestamp_from, timestamp_to
  File "/usr/local/lib/python3.7/site-packages/indy/ledger.py", line 1215, in build_get_revoc_reg_delta_request
    c_from = c_int64(from_) if from_  else -1
TypeError: int expected instead of float
2020-10-23 21:51:19,543 aries_cloudagent.admin.server ERROR Handler error with exception: int expected instead of float
2020-10-23 21:51:19,544 aiohttp.server ERROR Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/admin/server.py", line 144, in ready_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/admin/server.py", line 177, in debug_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp_apispec/middlewares.py", line 45, in validation_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/admin/server.py", line 275, in apply_limiter
    return await task
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/protocols/present_proof/v1_0/routes.py", line 930, in presentation_exchange_send_presentation
    comment=body.get("comment"),
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/protocols/present_proof/v1_0/manager.py", line 359, in create_presentation
    referent_non_revoc_interval.get("to", epoch_now),
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/ledger/indy.py", line 1105, in get_revoc_reg_delta
    public_info and public_info.did, revoc_reg_id, timestamp_from, timestamp_to
  File "/usr/local/lib/python3.7/site-packages/indy/ledger.py", line 1215, in build_get_revoc_reg_delta_request
    c_from = c_int64(from_) if from_  else -1
TypeError: int expected instead of float
500 500 Internal Server Error

Server got itself in trouble

2 & 3.

2020-10-23 21:59:48,111 aries_cloudagent.core.dispatcher ERROR Handler error: presentation_exchange_send_presentation  
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/protocols/present_proof/v1_0/routes.py", line 930, in presentation_exchange_send_presentation
    comment=body.get("comment"),
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/protocols/present_proof/v1_0/manager.py", line 359, in create_presentation
    referent_non_revoc_interval.get("to", epoch_now),
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/ledger/indy.py", line 1112, in get_revoc_reg_delta
    ) = await indy.ledger.parse_get_revoc_reg_delta_response(response_json)
  File "/usr/local/lib/python3.7/site-packages/indy/ledger.py", line 1260, in parse_get_revoc_reg_delta_response
    parse_get_revoc_reg_delta_response.cb)
indy.error.LedgerNotFound
2020-10-23 21:59:48,112 aries_cloudagent.admin.server ERROR Handler error with exception: 
2020-10-23 21:59:48,113 aiohttp.server ERROR Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/admin/server.py", line 144, in ready_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/admin/server.py", line 177, in debug_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp_apispec/middlewares.py", line 45, in validation_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/admin/server.py", line 275, in apply_limiter
    return await task
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/protocols/present_proof/v1_0/routes.py", line 930, in presentation_exchange_send_presentation
    comment=body.get("comment"),
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/protocols/present_proof/v1_0/manager.py", line 359, in create_presentation
    referent_non_revoc_interval.get("to", epoch_now),
  File "/usr/local/lib/python3.7/site-packages/aries_cloudagent/ledger/indy.py", line 1112, in get_revoc_reg_delta
    ) = await indy.ledger.parse_get_revoc_reg_delta_response(response_json)
  File "/usr/local/lib/python3.7/site-packages/indy/ledger.py", line 1260, in parse_get_revoc_reg_delta_response
    parse_get_revoc_reg_delta_response.cb)
indy.error.LedgerNotFound
500 500 Internal Server Error
aries_cloudagent.admin.server ERROR Handler error with exception: keys must be str, int, float, bool or None, not tuple
2020-10-26 21:59:33,123 aiohttp.server ERROR Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/webargs/asyncparser.py", line 90, in parse
    result = schema.load(parsed)
  File "/usr/local/lib/python3.7/site-packages/marshmallow/schema.py", line 723, in load
    data, many=many, partial=partial, unknown=unknown, postprocess=True
  File "/usr/local/lib/python3.7/site-packages/marshmallow/schema.py", line 904, in _do_load
    raise exc
marshmallow.exceptions.ValidationError: {'proof_request': {'non_revoked': {('fro', 'to'): ['Non-revocation interval must have at least one end']}}}

Expected Outcome

If there is a problem with the non revocation interval values being passed, then there should be an error passed to the caller about what the problem actually is.

Workaround

Look at the Acapy agent output for error explanations.

Test Cases Affected

T005-RFC0011
T006-RFC0011
T007-RFC0011
T008-RFC0011

Severity

Medium

Business Priority

Medium

@sklump
Copy link
Contributor

sklump commented Oct 29, 2020

#4 is badly formulated in the problem specification - "to" cannot be present without a value - I believe the intent is that "to" is missing altogether. #3 is a case of #2 as 0 means 1970-01-01 00:00:00Z. I will see what can be done about what all of these today.

@swcurran
Copy link
Contributor

Closing.

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

No branches or pull requests

3 participants