Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Whitelisting jwt and enabling decryption of whitelisted addons #418

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sebv
Copy link

@sebv sebv commented Dec 11, 2014

Core changes required for the JWT token PR.

@sourishkrout
Copy link

@joshk looks like this will do the job for us from a travis-core perspective. Let us know if you have questions. Thanks!

end
end
delete_addons(config) if config[:addons] && !addons_enabled?
config[:addons] = decrypt_addons(config[:addons]) if config[:addons]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we stay away from postfix conditionals? Makes the logic harder to follow.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following the pattern of lines 123 and 124. I don't mind to change but probably should be a global thing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I thought about this a bit more, and I think the difficulty (for me) comes from using the same conditional twice in postfix: X if A && B; Y if A. The previous structure seems better to me.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config has changed between the 2, it's not actually the same condition.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BanzaiMan if you want to clean it up, you need to move if config[:addons] to the delete_addons method.
I tried to do that, but it triggers an issue in the specs when :source is null. Wasn't sure about the best way to fix that (not a ruby programmer).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BanzaiMan thoughts? Do you think this is good enough to merge? We can go ahead to modify delete-addons if you think that's the only way to go, but would prefer to avoid that if you think there are other options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Hiro that the previous structure was better.
I find this bit of code a little hard to follow sorry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santiycr @sebv Could you rework this part of logical flow before I merge this? A more straightforward

if config[:addons]
  if addons_enabled?
    config[:addons] = decrypt_addons(config[:addons])
  else
    delete_addons(config)
    config[:addons] = decrypt_addons(config[:addons])
  end
end

seems more readable to me, even though config[:addons] = … appears twice in the if statement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further thought… Do we really want all other whitelisted addons to decrypt the configurations when addons_enabled? is falsey?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BanzaiMan
If i'm reading it correctly, addons_enabled? is falsey if its a pull request.

If we want to update this check to only decrypt the jwt token on PRs, then we need a new list of decryptable whitelisted plugins?

That seems like the safest solution.

@sebv
Copy link
Author

sebv commented Dec 28, 2014

@joshk I've just rebased everything, would it be possible to work on merging beginning of Jan.

BanzaiMan added a commit that referenced this pull request Jan 6, 2015
Whitelisting jwt and enabling decryption of whitelisted addons
BanzaiMan added a commit to travis-ci/travis-hub that referenced this pull request Jan 6, 2015
@santiycr
Copy link

@sebv, @joshk seems like this one got dropped. If we rebased this again, could we get it over the goal line before master moves again? :)

@sebv
Copy link
Author

sebv commented Apr 30, 2015

@BanzaiMan
Copy link
Contributor

@sebv @santiycr Yes, let's get started with rebasing! Thank you!! <3

@sebv
Copy link
Author

sebv commented Apr 30, 2015

@BanzaiMan just rebased.

@samccone
Copy link

hey @BanzaiMan this would be amazing to get in, over on https://github.com/tastejs/todomvc we would loveeeee to have this :)

@jayphelps
Copy link

its happening!!!

@samccone
Copy link

@BanzaiMan
Copy link
Contributor

Thank you! I will take a look soon. :-D

@joshk
Copy link
Contributor

joshk commented May 1, 2015

The team is in town next week. I'll make sure we have a chance to chat about the PR :)

samccone added a commit to tastejs/todomvc that referenced this pull request May 6, 2015
samccone added a commit to tastejs/todomvc that referenced this pull request May 6, 2015
samccone added a commit to tastejs/todomvc that referenced this pull request May 6, 2015
@samccone
Copy link

samccone commented May 8, 2015

👋 @joshk wondering if you had any feedback from your team meetings?

samccone added a commit to tastejs/todomvc that referenced this pull request May 8, 2015
@ErisDS
Copy link

ErisDS commented May 15, 2015

Am also interested to know if this is likely to land soon.

@geekdave
Copy link

Wondering if I should wait for this to land in Travis production? Or roll out a solution like https://github.com/cvrebert/savage ?

Any timeline estimates @joshk ?

@BanzaiMan
Copy link
Contributor

This (along with travis-ci/travis-build#356) 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:

  1. Enable a repository at https://staging.travis-ci.org/profile (You can build against only one of Travis environment, so if you are currently using Travis CI production, i.e., https://travis-ci.org, you need to switch back to it when you are done with the experiment.)

  2. Encrypt the variable against the staging API endpoint:

    travis encrypt -r REPO/OWNER -e https://api-staging.travis-ci.org SUPER_SECRET_STUFF

  3. Create a PR against it. When you try dumping SUPER_SECRET_STUFF, you should see JWT-encoded string instead of the plain text value (https://staging.travis-ci.org/BanzaiMan/travis_staging_test/builds/430639#L101-L102):

    eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzbHVnIjoiQmFuemFpTWFuL3RyYXZpc19zdGFnaW5nX3Rlc3QiLCJwdWxsLXJlcXVlc3QiOjksImlhdCI6MTQzMjgzNzA4OH0.7GBV_50n04rTwBHzxTpBMFBqWAkojdlsW5yMTnrzQ_Y

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.

@samccone
Copy link

Hi @BanzaiMan my orgs are currently not showing up on the staging server

screen shot 2015-05-29 at 1 37 45 pm

the just.a.test url is not helping much 👅

Looking forward to testing this out on TodoMVC, thanks again for the merge on this

@BanzaiMan
Copy link
Contributor

@samccone Which organization is not showing up? On staging, I see that you have access to "twosigma" and "tastejs" organizations.

@samccone
Copy link

Tastejs. Want me to try again?

@BanzaiMan
Copy link
Contributor

@samccone Do you see anything in https://staging.travis-ci.org/profile/tastejs? (Staging is currently used for testing another PR, so JWT addon does not work.)

@samccone
Copy link

Shows up now! 👪 ping me when I can try again 💏. Excited to land this

@geekdave
Copy link

geekdave commented Sep 4, 2015

Hi @BanzaiMan - I'm late to the party here, but just wondering if the use case of running a SauceLabs Pull Request build with secure env variables is a working use case now? The docs here say otherwise: http://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests

mhoyer pushed a commit to mhoyer/todomvc that referenced this pull request Dec 5, 2015
@halkeye
Copy link

halkeye commented Jul 19, 2016

@BanzaiMan I've rebased both patches so they should now work against master again

Also added a new list of addons that are safe to decrypt since thats what one of the comments mentioned.

Let me know if there's anything else.

halkeye pushed a commit to sauce-archives/docs-travis-ci-com that referenced this pull request Jul 26, 2016
halkeye pushed a commit to sauce-archives/docs-travis-ci-com that referenced this pull request Jul 30, 2016
halkeye pushed a commit to sauce-archives/docs-travis-ci-com that referenced this pull request Aug 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants