-
Notifications
You must be signed in to change notification settings - Fork 431
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
JWT addon #356
JWT addon #356
Conversation
depends on travis-ci/travis-core#418 |
ping @joshk @sso @sourishkrout |
Could you add documentation on how to use it, and security implications thereof, in the form of a PR to https://github.com/travis-ci/docs-travis-ci-com? |
This has been deployed to staging. Please go to https://staging.travis-ci.org/profile, sync data with GitHub and enable a repository to test this. The staging environment might be refreshed with a different code without prior notice, so if you don't see |
Thank you @BanzaiMan for moving this along. The JWT addon is not expect to work without the changes submitted as part of the PR in travis-ci/travis-core#418. - I now realize we should have included that in the initial description. Is it possible to get the travis-core changes deployed to staging as well? |
@sourishkrout The PR to travis-core has been deployed to staging. Could you try it? (Make sure that you use no critically sensitive data.) |
Unfortunately it doesn't look like it worked. Added jwt addon config to my .travis.yml (https://github.com/sourishkrout/osbdemo/blob/master/.travis.yml) according to this:
Which didn't produce the JWT ENV var I expected (
@BanzaiMan I wonder how we can debug this. I'm curious to find out if the decrypted JWT addon config from travis-core made it into travis-build at all? Travis CI Job: https://staging.travis-ci.org/sourishkrout/osbdemo/builds/400203 |
@sourishkrout The data format shown in https://github.com/sourishkrout/osbdemo/blob/7c4039ed7b22cd5e89411400f28e227459b8d5fa/.travis.yml#L12-L13 doesn't match the one shown in the original description of this PR. I tested this earlier https://github.com/BanzaiMan/travis_staging_test/blob/c60885ce90cd6420ba557ac120b30650476a0cd1/.travis.yml#L10-L12 and the latter format seems to work; i.e., invokes JWT installation (https://staging.travis-ci.org/BanzaiMan/travis_staging_test#L103). |
Hi, @sourishkrout and @sebv, We are itching to test this further. Could you advise us when we can coordinate our efforts to do so? You can respond here, or email support@travis-ci.com. Thank you! |
@BanzaiMan also rebased this one. |
btw this yml format is correct. |
Hi @BanzaiMan, we are really interested in getting this project completed, Any chance you can reach out to me admc@saucelabs.com so I can work to arrange a live session where we can get everyone to work together to finish this? Thanks! |
Sorry for the delay. I'll look at this shortly! |
subject.should include_sexp [:echo, 'Initializing JWT', ansi: :yellow] | ||
expected1 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzbHVnIjoidHJhdmlzLWNpL3RyYXZpcy1jaSIsInB1bGwtcmVxdWVzdCI6IiIsImlhdCI6MH0.iO-I8CNXhQlgw_dL8R9CDaDPplSC3yf9J399Uumn6CE" | ||
subject.should include_sexp [:export, ['MY_ACCESS_KEY_1', expected1]] | ||
expected2 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzbHVnIjoidHJhdmlzLWNpL3RyYXZpcy1jaSIsInB1bGwtcmVxdWVzdCI6IiIsImlhdCI6MH0.p1B9HnYCh-z5Igek5tr_QVPb1zV1ucwcPZNvY039WKg" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
By the way, here's the build from the rebased try on Travis: https://travis-ci.org/travis-ci/travis-build/builds/63575373, which passes. (Note that I made slight changes to the spec syntax, to silence the warnings about the old "should" syntax.) I apologize for not understanding the mechanism behind this encryption scheme enough to offer a better approach. How can we make these specs platform-independent? I see that a good portion of the encrypted data do match up in the beginning. Is that good enough for specs? |
@BanzaiMan could you put some debug here: https://github.com/saucelabs/travis-build/blob/jwt/lib/travis/build/addons/jwt.rb#L25 and run the test for mac and linux, so we can see the difference before encoding. We never ran the test on mac, not sure how to set those up. |
I didn't to the digging to figure out why but the
vs
|
Looks like timezone issue, should probably initialize with GMT here https://github.com/saucelabs/travis-build/blob/jwt/spec/build/addons/jwt_spec.rb#L9 . |
@BanzaiMan could you also please make sure you fully understand and grasp how JWT works and how it can be used with Sauce Labs. |
Confirmed that the specs are time (zone) dependent. |
I fixed the specs with e1e54d0 |
This (along with travis-ci/travis-core#418) has been deployed to staging. My limited test seems reasonable (works as far as I can tell), and I would like to have a larger set of users test it. To use this in staging, follow the following steps:
The staging environment may be used for other tests, so if you suspect it's not working, please check with me if the correct code is deployed. Thank you! |
With the suggested changes (e46ff5a), it would look like this: https://staging.travis-ci.org/travis-ci/travis_staging_test/builds/507077#L138 |
* Throw a warning when there is no secret available (just key=) * Throw a warning when secret is null (related) test for cases
Awesome I figured out how to reproduce the testcase, and moved things slightly, but that should be everything. I'll do another pass over of the docs tomorrow |
I guess travis-ci/travis-core#418 needs reviewing too |
@halkeye |
Heh. That's what happens when a pr is over a year old :D That's great. Let me know if you need anything else. On Jul 28, 2016 7:22 AM, "Hiro Asari" notifications@github.com wrote:
|
For reference, travis-ci/travis-scheduler#29 is the PR. I ran a test here: https://staging.travis-ci.org/travis-ci/travis_staging_test/builds/507127 It ran the JWT addon: https://github.com/travis-ci/travis_staging_test/blob/ae7a834f9e7b7122f9bdd31df1fe024cc9305a2c/.travis.yml#L5-L7 As you can see on https://staging.travis-ci.org/travis-ci/travis_staging_test/builds/507127#L135, the token is:
Using https://jwt.io/, with the secret |
I see that travis-ci/travis-scheduler#29 needs more work, to always let |
Or, maybe no further work is necessary. In this PR build, you can see that the PR receives a valid JWT. |
Yea, if foobar was your original secured token, that looks good to me. |
All right, then. I'll merge this (and the scheduler PR) and deploy to production shortly. I recommend using test data and credentials while we work out the rough edges. Thanks for the efforts and patience, everyone! |
Once we have good results in production, we'll merge the docs PR and announce it. |
@BanzaiMan how will we know when it's in production to start testing? |
It's there now. |
@BanzaiMan I just put in a support request, but could the abuse detected/gatekeeper stuff have any relation to this PR? https://travis-ci.org/saucelabs-sample-test-frameworks/Java-TestNG-Selenium/requests |
@halkeye That should be lifted now. It was a bug in unrelated code. |
@BanzaiMan Okay, looking at this test case. Should the function be changed to before_before_install (is that a thing)? https://travis-ci.org/saucelabs-sample-test-frameworks/Java-TestNG-Selenium/jobs/148427092 |
Yes, you can use |
@halkeye Could you open a new issue in https://github.com/travis-ci/travis-ci to track further improvements (except code changes, of course)? |
I updated this branch, but I can totally create a new issue if you want |
@BanzaiMan new PR or new issue? |
should I create a new PR for the change? |
It wasn't picking up the new code and retesting, so just opened a new PR |
See: travis-ci/travis-build#356 travis-ci/travis-core#418 sebv/jwt-doc#5 For some historic context
See: travis-ci/travis-build#356 travis-ci/travis-core#418 sebv/jwt-doc#5 For some historic context
JWT token authentication for PR.
Users need to add this to
.travis.yml
.The JWT addon will then create a time-limited JWT token and export it to the SAUCE_ACCESS_KEY environment variable.
This is not specific to sauce labs several services may be configured, for instance:
In this case 2 tokens will be generated, one in the SAUCE_ACCESS_KEY env variable, the other in MOONWALK_SECRET.