Running tests with API authentication in Travis CI without exposing API passwords

meore

I have a Rails app on Github that uses some external API that requires password authentication. Right now I have my credentials for that API in a file that is not in git and some integration tests that use VCR gem, so these tests always fail in Travis because they don't have the credentials for the API. I can't check my VCR cassettes into git because there is still my username in plain text and maybe some other data that would be better not to expose. I guess I could use plain webmock to emulate API responses but I think that would be too cumbersome and error prone.

Is there a way to write tests that use an external API with authentication that would still run on Travis, without exposing my API password on Github?

joshua-anderson

Your can encrypt your Travis variables using the travis tool.

You encrypt your variable with travis encrypt FOO=<your passowrd/sensitive data here> This will print out something like: secure: "djfhfjriwjdncml2948328$+@jdjw"

Then you can use that variable in your envoirmental variables or anywhere else.

For example, if you copy that variable into the environment section, you can securely store your environmental variable.

env:
  - secure: "djfhfjriwjdncml2948328$+@jdjw"

Now,the environmental variable FOO Holds your password in a secure manner. To learn more you can read up on this here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Travis CI - Enabling repository build via API

From Dev

API request fails on Travis-CI

From Dev

Running Redis on Travis CI

From Dev

Django/Travis CI - configuring a .travis YAML file to first start a localhost server, then run my tests without hanging?

From Dev

PHPunit no tests execute on Travis CI

From Dev

Send firebase cloud message from client without exposing API secret

From Dev

Integrating AWS API Gateway with Cloud Front without exposing origin

From Dev

Integrating AWS API Gateway with Cloud Front without exposing origin

From Dev

Exposing attributes on a Rails API

From Dev

Why Travis CI can't connect to GitHub API?

From Dev

Need to View Travis CI Test Stats on Repo Pull Requests via the Travis API Calls

From Dev

Exposing the JSON Schema for API endpoints?

From Dev

Exposing Collection or Set for public API

From Dev

Exposing only void pointers in an API

From Dev

Exposing application API and data to DLL

From Dev

Docker Exposing ports for Flask API

From Dev

Exposing Web API in Service Fabric

From Dev

Exposing only void pointers in an API

From Dev

Exposing application API and data to DLL

From Dev

Travis CI Android Tests: no connected devices

From Dev

Travis CI skip tests (Gradle Android project)

From Dev

using travis-ci with wxpython tests

From Dev

Travis CI - Angular unit tests fail, but not locally

From Dev

.NET gmail API Authentication (without user interaction)

From Dev

Google Drive API authentication without user interaction

From Dev

Access dropbox api without clientside authentication?

From Dev

WP REST API - User registration without authentication

From Dev

Travis-CI running two android emulators

From Dev

Travis-CI running two android emulators

Related Related

  1. 1

    Travis CI - Enabling repository build via API

  2. 2

    API request fails on Travis-CI

  3. 3

    Running Redis on Travis CI

  4. 4

    Django/Travis CI - configuring a .travis YAML file to first start a localhost server, then run my tests without hanging?

  5. 5

    PHPunit no tests execute on Travis CI

  6. 6

    Send firebase cloud message from client without exposing API secret

  7. 7

    Integrating AWS API Gateway with Cloud Front without exposing origin

  8. 8

    Integrating AWS API Gateway with Cloud Front without exposing origin

  9. 9

    Exposing attributes on a Rails API

  10. 10

    Why Travis CI can't connect to GitHub API?

  11. 11

    Need to View Travis CI Test Stats on Repo Pull Requests via the Travis API Calls

  12. 12

    Exposing the JSON Schema for API endpoints?

  13. 13

    Exposing Collection or Set for public API

  14. 14

    Exposing only void pointers in an API

  15. 15

    Exposing application API and data to DLL

  16. 16

    Docker Exposing ports for Flask API

  17. 17

    Exposing Web API in Service Fabric

  18. 18

    Exposing only void pointers in an API

  19. 19

    Exposing application API and data to DLL

  20. 20

    Travis CI Android Tests: no connected devices

  21. 21

    Travis CI skip tests (Gradle Android project)

  22. 22

    using travis-ci with wxpython tests

  23. 23

    Travis CI - Angular unit tests fail, but not locally

  24. 24

    .NET gmail API Authentication (without user interaction)

  25. 25

    Google Drive API authentication without user interaction

  26. 26

    Access dropbox api without clientside authentication?

  27. 27

    WP REST API - User registration without authentication

  28. 28

    Travis-CI running two android emulators

  29. 29

    Travis-CI running two android emulators

HotTag

Archive