
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
This project provides a wrapper around the Instructure Canvas API.
To install, add lms-api
to your Gemfile:
gem "lms-api"
Your app must tell the gem which model is used to represent the
authentication state. For instance, if you're using ActiveRecord, you
might have an Authentication
model, which encapsulates a temporary
API token.
class Authentication < ActiveRecord::Base
# token: string
end
Then, you tell the gem about this model:
LMS::Canvas.auth_state_model = Authentication
This allows the gem to transparently refresh the token when the token expires, and do so in a way that respects multiple processes all trying to do so in parallel.
To use the API wrapper, instantiate a LMS::Canvas
instance with the
url of the LMS instance you want to communicate with, as well as the
current authentication object, and (optionally) a hash of options to use
when refreshing the API token.
Require the gem:
require "lms_api"
auth = Authentication.first # or however you are storing global auth state
api = LMS::Canvas.new("http://your.canvas.instance", auth,
client_id: "...",
client_secret: "..."
redirect_uri: "..."
refresh_token: "...")
You can get the URL for a given LMS interface via the ::lms_url
class method:
params = {
id: id,
course_id: course_id,
controller: "foo",
account_id: 1,
all_dates: true,
other_param: "foobar"}
url = LMS::Canvas.lms_url("GET_SINGLE_ASSIGNMENT", params)
Once you have the URL, you can send the request by using api_*_request
methods:
api_get_request(url, headers={})
api_post_request(url, payload, headers={})
api_delete_request(url, headers={})
api_get_all_request(url, headers={})
api_get_blocks_request(url, headers={}, &block)
The last two are convenience methods for fetching multiple pages of data.
The api_get_all_request
method returns all rows in a single array. The
api_get_blocks_request
method yields each "chunk" of data to the block.
FAQs
Unknown package
We found that lms-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.