-
Notifications
You must be signed in to change notification settings - Fork 3
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
Switch to JWT token encapsulation #10
Comments
Please refer to cyberark/slosilo#10 for details.
See cyberark/slosilo#10 for details.
Note I created pull requests above for convenience when reviewing. They should stay on feature branches until outstanding issues ( #12 and cyberark/conjur-rack#11 ) are resolved. |
Issues resolved. Pull requests above can be merged now. |
Can we call this v3 because there is already a slosilo 2 |
Is it possible to change the username from e.g. host/foo.bar to host:foo.bar to match the rest of conjur fully qualified ids |
The signature algorithm is the same as in Slosilo v2. I suppose it could even be called v1 since there was only one version of the algorithm; or, maybe even better (shorter), to remove the version part altogether and just have |
Regarding changing the usernames, Slosilo itself doesn't care about it, but it's definitely something that would be nice to change. If we keep the authorization protocol (ie. clients still submit |
* Add support for JWT-formatted tokens See issue #10 for details * Accept pre-parsed JWT tokens in Slosilo::token_signer * Add some docstrings re JWT methods In particular it indicates some useful claims and explains that it's the caller's responsibility to verify claims this library doesn't understand. Closes #12 * Remove typ: 'JWT' header field It's optional and not really useful. Can always be provided by the client if required.
* Remove Conjur::Rack::User#new_association It's not clear what was the intent behind this method, but there is no documentation and no usage as far as I can tell. * Some spec refactoring Split Authenticator and .user spec, make -fdoc more readable. * Use real Slosilo in specs While this might move the tests a bit on the unit-integration spectrum, it does make them more realistic and easier to implement. Specific things can still be mocked and stubbed as needed for test granularity. * Correctly handle JWT tokens Please refer to cyberark/slosilo#10 for details. * Add changelog entry * Apply CIDR restrictions Closes #11. * Reject tokens with unrecognized claims JWT lacks a mechanism for specifying critical claims as JWS has with header 'crit' field; JWT spec suggests to ignore unrecognized claims and that is what a generic JWT library should do. However, conjur-rack is a specific application; for security reasons it's best to reject tokens which we don't totally understand, lest the requester is allowed to do what she is not in fact authorized to. If need be, this can be extended in the future with 'crit'-like mechanism for specifying optional claims. Related: cyberark/slosilo#12
See cyberark/slosilo#10 for details.
Currently tokens are Slosilo-specific, content-agnostic JSON blobs. Since they were first designed JOSE family of standards came into being which specifies formally a design for bearer tokens, as used with Conjur. Since we're considering expanding tokens to support eg. issuer-set expiration time, it's a good time to switch to standards-based format, which already has features like that built-in. It will also make the structure of the tokens themselves reflect the primary (only?) usage, which is to bear authentication certification by a service identified with a keypair.
Note this issue is not about making Slosilo a generic standards-conforming JWT implementation or allowing different crypto algorithms to be used. Instead this is about, in the interest of interoperability and transparency, leveraging immense design work done on JOSE and drift in that direction in lieu of a NIH, not formally specified token format while making it transparent to users (especially Conjur server and clients) where possible.
Note that for Conjur usage this will need further work in conjur-rack and conjur to take advantage of the changes.
Proposed token format
New access tokens mirror old-style Slosilo tokens and use the same algorithm, extending them with extra fields and formatting them in accordance with RFC 7519.
RFC 7519 tokens are composed of three individually base64-encoded parts, which for Slosilo will be, in the first iteration, defined as follows:
typ
: document type, value:JWT
alg
: signature algorithm, value:conjur.org/slosilo/v2
kid
: key ID (corresponds tokey
field in old-style Slosilo tokens).sub
: subject name (aka “username”, “login”). Required. Corresponds to the contents ofdata
field in old-style tokens.iat
: date and time of issue (aka “timestamp”) as numeric (“UNIX”) UTC timestamp. Required. Corresponds to the contents oftimestamp
field in old-style Slosilo tokens.exp
expiration date and time as numeric (“UNIX”) UTC timestamp. Optional. By default tokens expire in 8 minutes sinceiat
.cidr
list of CIDR restrictions. The token is considered valid if and only if it is presented by an originating IP matching at least one of them. (This restriction should be implemented by Slosilo token consumers, such as conjur-rack. Optional.conjur.org/slosilo/v2
in thealg
header field. The string to sign is generated as per RFC 7515. This corresponds to thesignature
field in old-style tokens.Security considerations
The new tokens are expected to provide the same or stronger security than the old-style ones:
REQUIRED
. This ensures that security properties are unchanged.Interoperability considerations
Conjur
For compatibility with existing clients, token issuers may by default issue tokens in JWS JSON serialization (cf. RFC 7515). Tokens so serialized must be base64 encoded before using in a HTTP request header, as with old-style Slosilo tokens; this ensures that from the point of view of the client the format change is transparent, as long as the client treats tokens as opaque (as clients libraries are expected to). Alternatively, issuer can emit JWS compact serialization (perhaps on an endpoint that legacy clients cannot be expected to be able to use anyway, or as indicated by the client with
Accept
HTTP header), which can be used in requests without any further processing.Third-party JOSE implementations
Slosilo is not claiming or intended to provide a general-purpose JWT implementation. However standards-conformant clients should be able to parse the tokens and understand common fields. Since non-standard algorithm is used, a generic implementation won't be able to verify the signature out-of-the-box; it can be accomplished by using
Slosilo::Keystore#get_by_fingerprint
to lookup the key bykid
andSlosilo::Key#verify_signature
to perform the verification on standard string-to-sign, bypassing Slosilo JWT parsing logic.Motivation
Beyond moving to a standard token format, two improvements for Conjur should already be apparent from the proposed format:
Future work
The text was updated successfully, but these errors were encountered: