Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.