interledger / rfcs

Specifications for Interledger and related protocols
https://interledger.org
Other
454 stars 111 forks source link

Expiry on STREAM credentials #563

Closed adrianhopebailie closed 4 years ago

adrianhopebailie commented 5 years ago

There is currently no way to explicitly "expire" a set of STREAM credentials (the ILP Address and Shared Secret that the client uses to connect to the server).

This is a problem because technically they need to then be valid indefinitely which makes accounting for payments against specific connections difficult to do.

The simplest way to solve this seems to be simply adding an error code that the server can return to tell the client that the credentials have expired.

E.g. 0x0A Connection Expired

If a client attempts to connect using expired credentials then the server can immediately respond with a CloseConnection frame and the new error code (0x0A).

The server may also send a CloseConnection frame and the new error code (0x0A) at any time after a connection has been established.

The expected behaviour is for the client to notify the calling application that the connection has expired and that it should perform setup again to get new credentials.

In the Web Monetization use case this would involve the sender making a new call to the Payment Pointer URL using the same requestId as before. This should return new credentials but the server should continue to associate incoming payments on the new connection with the same requestId.

How a server tracks the expiry of credentials is left to the implementation. To do this across a distributed set of receivers it would likely be encoded into the address.

emschwartz commented 5 years ago

Why isn't this part of the application layer protocol? It seems like expiry might be important for some applications but not for others.

sharafian commented 5 years ago

Currently Web Monetization never reuses STREAM credentials. Right now we expect them to always expire after one use, and you could set a cache control header to keep them around for longer

adrianhopebailie commented 5 years ago

Why isn't this part of the application layer protocol? It seems like expiry might be important for some applications but not for others.

It is. But that means it needs to know that a connection can be closed and not re-opened at the transport layer.

Currently Web Monetization never reuses STREAM credentials. Right now we expect them to always expire after one use, and you could set a cache control header to keep them around for longer

But that assumption is not enforced at the transport protocol layer. If a client starts sending on a connection that the server considers closed what should happen?

adrianhopebailie commented 4 years ago

@emschwartz @matdehaast @sappenin @sharafian any further feedback on this?

What is the correct behaviour of a STREAM receiver if it receives an incoming connection using old credentials?

What is the expected validity of credentials?

sappenin commented 4 years ago

There is currently no way to explicitly "expire" a set of STREAM credentials

For security reasons, it seems best to treat Credentials Expired and Invalid Credentials as the same. In either case, the server shouldn't be using the credentials, so returning encrypted frames at all shouldn't be happening.

What is the correct behaviour of a STREAM receiver if it receives an incoming connection using old credentials?

Return an ILPv4 Reject packet with an F06: Unexpected Payment code and an optional error message. The credentials are no longer valid, so the server shouldn't be using them.

emschwartz commented 4 years ago

It seems like in order for this to be built into an application, you would need:

What is the correct behaviour of a STREAM receiver if it receives an incoming connection using old credentials?

STREAM has no concept of credential expiry, so I wouldn't expect it to have any special behavior to handle this.

As discussed in other conversations about what should be in/out of STREAM, my general questions are:

sappenin commented 4 years ago

The consensus from the ILP community call here is:

adrianhopebailie commented 4 years ago

Also, we need to do some experiments to see how this could/should be added to the interface from the app layer down to the STREAM implementation.

Some ideas:

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is important, please feel free to bring it up on the next Interledger Community Group Call or in the Gitter chat.