GithubHelp home page GithubHelp logo

Auth token time zone about mesh-client HOT 5 CLOSED

wvh avatar wvh commented on September 16, 2024
Auth token time zone

from mesh-client.

Comments (5)

jamespic avatar jamespic commented on September 16, 2024 1

This should now be fixed in 1.3.0

from mesh-client.

jamespic avatar jamespic commented on September 16, 2024

Cheers, this is a good spot.

I don't know for sure, but I've got a reasonable suspicion that the MESH team actually run their servers in UTC, so if there were a correct timezone for this, it would probably be UTC, although I note that this is underspecified in the API docs. All the production deployment I'm aware of that use this also run their servers in UTC.

In terms of what MESH actually does, I don't have access to the MESH server codebase myself either, so can't say for sure what this is used for internally (I've got contacts in the MESH team I can reach out to in a pinch, but I'd prefer not to have to owe them a favour), but I do have access to a MESH test environment, so I can check how it responds to various inputs.

So far as I can tell, MESH will accept any token, so long as the combination of nonce, nonce count, and timestamp, is unique (and the signature checks out). It doesn't appear to validate that any of these things are within a given range, monotonic, or even well-formed - indeed, it seems that I may have been overzealous with my validation in https://github.com/jamespic/fake-mesh, since MESH itself does not validate this at all.

The one thing I would wonder is whether it's used for something internally, which doesn't affect requests but does potentially mess with MESH's internal book-keeping. One thing I found with Fake MESH (which is a clean-room implementation of the same API) was that if you kept track of which nonces had been used in a database, that database could grow big enough to be a problem if you were using it at high enough volume in performance tests (which I keep meaning to put a mechanism into Fake MESH to handle). So I wouldn't be surprised if real MESH had some sort of cleanup job that deletes old nonces from the database based on timestamps. And I also wouldn't be surprised if it could potentially be thrown off by the use of distant-past, distant-future, or malformed timestamps. It's certainly my experience that the MESH team often choose not to implement input validation, and instead rely on putting potential integrators through a rigorous quality assurance regimen, to ensure they don't send any invalid input.

So I may change this to utcnow if I get some time, but I don't believe this will break right now, even if you are in a far off timezone.

from mesh-client.

jamespic avatar jamespic commented on September 16, 2024

I realised after writing the previous comment that I do have one authoritative source of information on this: The official MESH client. I don't have the source to it, but it decompiles cleanly, so I can see it uses local timestamps.

I'm unsure what to conclude from this though, beyond that they do not validate timestamps and have probably not considered how they would do so.

from mesh-client.

wvh avatar wvh commented on September 16, 2024

Thanks for your elaboration!

I remembered reading something about token timeouts in the API description:

the server will reject the request if the timestamp supplied is not within 2 hours of the server time

I know some of our servers are located in different time zones, possibly with all sorts of wonderfully different TZ settings. Probably would be a good idea to make sure servers accessing MESH are using UTC then, to be on the safe side...

from mesh-client.

jamespic avatar jamespic commented on September 16, 2024

I spoke to my contacts in the MESH team, and the intention was apparently for this to be UTC, even though the Java client uses local time, and the timestamp isn't checked for anything but uniqueness internally. I'll get a change in to make this UTC.

from mesh-client.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.