hyperledger-archives / aries-framework-dotnet

Aries Framework .NET for building multiplatform SSI services
https://wiki.hyperledger.org/display/aries
Apache License 2.0
85 stars 74 forks source link

Presentation not supporting a proof with a non-revocable credential when the request/presentation has a non-revocation interval #184

Open nodlesh opened 3 years ago

nodlesh commented 3 years ago

Describe the bug A clear and concise description of what the bug is. This bug was identified in interoperability testing in Aries Agent Test Harness. A revocation test (T013-HIPE0011) that has Aries Framework Dotnet as the holder, and has a non-revocable credential used with a presentation that has a non-revocation interval.

To Reproduce To construct this scenario,

The results of this test can be seen at the AATH Interop Results page, https://allure.vonx.io/allure-docker-service-ui/projects/acapy-b-dotnet/reports/latest The tests can be executed locally by following the AATH execution instructions, https://github.com/hyperledger/aries-agent-test-harness

Negative Behavior When the SendProofPresentation happens the dotnet agent throws an indy error. Revocation Registry Id not found Full stack trace is

20:06:03 Trace src/api/anoncreds.rs:2050 | prepare_result_1: >>> Err(IndyError { inner: 

Revocation Registry Id not found

Invalid structure }) 
20:06:03 Trace src/api/anoncreds.rs:2050 | indy_prover_create_proof: result: "" 
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HM7PUADCVE07", Request id "0HM7PUADCVE07:00000001": An unhandled exception was thrown by the application.
Hyperledger.Indy.InvalidStructureException: A value being processed is not valid.
   at Hyperledger.Aries.Features.PresentProof.DefaultProofService.CreateProofAsync(IAgentContext agentContext, ProofRequest proofRequest, RequestedCredentials requestedCredentials) in /aries-framework-dotnet/src/Hyperledger.Aries/Features/PresentProof/DefaultProofService.cs:line 133
   at Hyperledger.Aries.Features.PresentProof.DefaultProofService.CreatePresentationAsync(IAgentContext agentContext, String proofRecordId, RequestedCredentials requestedCredentials) in /aries-framework-dotnet/src/Hyperledger.Aries/Features/PresentProof/DefaultProofService.cs:line 687
   at DotNet.Backchannel.Controllers.PresentProofController.SendProofPresentationAsync(OperationBody body) in /src/Controllers/PresentProofController.cs:line 149
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
   at Hyperledger.Aries.AspNetCore.AgentMiddleware.Invoke(HttpContext aHttpContext, IAgentProvider aAgentProvider) in /aries-framework-dotnet/src/Hyperledger.Aries.AspNetCore/AgentMiddleware.cs:line 67
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
20:06:08 Trace src/services/pool/pool.rs:556 | received pool event: Some(Timeout("", "")) 
20:06:08 Trace src/services/pool/networker.rs:250 | is_active >> time worked: Duration { secs: 5, nanos: 2048400 } 
20:06:08 Trace src/services/pool/networker.rs:252 | is_active << false 
20:06:08 Trace src/services/pool/networker.rs:146 | removing pool connection 41 
20:06:08 Debug /home/indy/.cargo/registry/src/github.com-1ecc6299db9ec823/zmq-0.9.2/src/lib.rs:489 | socket dropped 
20:06:08 Debug /home/indy/.cargo/registry/src/github.com-1ecc6299db9ec823/zmq-0.9.2/src/lib.rs:489 | socket dropped 
20:06:08 Debug /home/indy/.cargo/registry/src/github.com-1ecc6299db9ec823/zmq-0.9.2/src/lib.rs:396 | context dropped 

Expected behavior According to Revocation RFC 441, it is to be expected that this scenario should pass. RFC 441 states, A revocable or non-revocable credential may satisfy a presentation request with or without a non-revocation interval...

swcurran commented 3 years ago

The expected behaviour is that if a non-revokable credential is selected to be used for a prove and the proof request has a revocation interval, the revocation interval should be dropped prior to the call to "indy_prover_create_proof". Note that the verifier will be able to tell if the proof SHOULD have included a proof of non-revocation by looking at the ledger, so this is safe to do.