
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
A ruby wrapper for the Scalingo API
gem "scalingo"
And then execute:
bundle
require "scalingo"
scalingo = Scalingo::Client.new
scalingo.authenticate_with(access_token: ENV["SCALINGO_TOKEN"])
scalingo.self
Most methods map to one (and only one) request, and their signature follows this format:
client.section.request(app_id:, id:, body:)
user
), one, or two ids (many resources are nested under an app).metrics
, for instance, extracts the parts that are meant to be used as url fragments)You can refer to the code below to configure the gem globally. The values displayed match the default ones.
:warning: Configuration is copied when instanciating a Scalingo::Client
object;
changing the configuration globally will therefore not affect already existing objects.
Scalingo.configure do |config|
# Default region. Must be a supported region (osc_fr1, osc_secnum_fr1)
config.default_region = :osc_fr1
# Configure the User Agent header
config.user_agent = "Scalingo Ruby Client v#{Scalingo::VERSION}"
# These headers will be added to every request
# This should be a hash or a callable object that returns a hash.
config.additional_headers = {}
# Specify an adapter for faraday. Leave nil for the default one (Net::HTTP)
config.faraday_adapter = nil
end
You can also configure each client separately. Values not supplied will be copied from the global configuration.
scalingo = Scalingo::Client.new(user_agent: "A new kind of agent")
Scalingo::Client
instances hold configuration and the token used for authenticationScalingo::API::Client
subclasses (Scalingo::Auth
, Scalingo::Billing
, Scalingo::Regional
) provides access to the APIs.
You can use connection
(returns a faraday instance) on those objects to perform any request freely.Scalingo::API::Endpoint
subclasses (Scalingo::Auth::User
) instances belong to an api client (cf previous point).
They provide quick and uniform access to expected requests.require "scalingo"
scalingo = Scalingo::Client.new
scalingo.authenticate_with(access_token: "my_access_token")
# OR
scalingo.authenticate_with(bearer_token: "my_bearer_jwt")
# Return your profile
scalingo.self # or scalingo.auth.user.find
# List your SSH Keys
scalingo.keys.all # OR scalingo.auth.keys.all
# Show one SSH Key
scalingo.keys.show(id: "my-key-id")
# List your apps on the default region
scalingo.apps.all # OR scalingo.region.apps.all
# List your apps on osc-fr1
scalingo.osc_fr1.apps.all # OR scalingo.region(:osc_fr1).apps.all
# Preview the creation of an app on the default region
scalingo.apps.create(name: "my-new-app", dry_run: true)
Requests to the database API requires extra authentication for each addon you want to interact with. Addon authentication tokens are valid for one hour.
require "scalingo"
scalingo = Scalingo::Client.new
scalingo.authenticate_with(access_token: "my_access_token")
# First, authenticate using the `addons` API
dbclient = scalingo.osc_fr1.addons.database_client_for(app_id:, id:)
# Once authenticated for that specific addon, you can interact with
# database and backup APIs.
# IDs of databases are the IDs of the corresponding addons
# get all information for a given database
dbclient.databases.find(id:)
# get all backups for a given database
dbclient.backups.list(addon_id:)
# get URL to download backup archive
dbclient.backups.archive(addon_id:, id:)
bundle
bundle exec rspec
In order to deploy a new version, you first need to tag that version. For that, two files need to be updated:
lib/scalingo/version.rb
with the version numberOnce the PR is merged, you need to tag the version. EG:
git checkout master
git pull
git tag v4.0.beta3
git push origin master --tags
When the tags are pushed, you need to go here and create a new release with the new tag. Once this is done, a GitHub Action will take care of publishing the new version.
FAQs
Unknown package
We found that scalingo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.