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.
mojfile-uploader-api-client
Advanced tools
An API client for mojfile-uploader
Please refer to the above project if you want to build your own client around the API.
In your project, create an initializer with the following:
MojFileUploaderApiClient::HttpClient.configure do |client|
client.base_url = 'http://localhost:3003' # mandatory
client.options = {} # optional - supports :headers, :verify_ssl, :open_timeout, :read_timeout
end
MojFileUploaderApiClient.add_file(title: 'test', filename: 'test.txt', data: 'bla bla bla', collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757')
=> {:collection=>"a45c556f-a628-41d3-8c29-351f84e63757", :key=>"7c6aca2c-eb7a-4194-8166-9fd6ac82127b.test.txt"}
With a folder name:
MojFileUploaderApiClient.add_file(folder: 'subfolder', title: 'test', filename: 'test.txt', data: 'bla bla bla', collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757')
=> {:collection=>"a45c556f-a628-41d3-8c29-351f84e63757", :folder=>"subfolder", :key=>"7c6aca2c-eb7a-4194-8166-9fd6ac82127b.test.txt"}
Or you can use the AddFile
client directly:
MojFileUploaderApiClient::AddFile.new(title: 'test', filename: 'test.txt', data: 'bla bla bla', collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757').call
=> #<MojFileUploaderApiClient::Response:0x007fe4e5c85ce0
@body={:collection=>"a45c556f-a628-41d3-8c29-351f84e63757", :key=>"7c6aca2c-eb7a-4194-8166-9fd6ac82127b.test.txt"},
@code=200>
MojFileUploaderApiClient.add_file(title: 'test', filename: 'test.txt', data: 'bla bla bla')
=> {:collection=>"741635f7-488a-49cc-a3f1-9ee38795e28e", :key=>"0543a21d-e884-4076-89be-41cc09b00da1.test.txt"}
Or you can use the AddFile
client directly:
MojFileUploaderApiClient::AddFile.new(title: 'test', filename: 'test.txt', data: 'bla bla bla').call
=> #<MojFileUploaderApiClient::Response:0x007fe4e5b8cc58
@body={:collection=>"741635f7-488a-49cc-a3f1-9ee38795e28e", :key=>"0543a21d-e884-4076-89be-41cc09b00da1.test.txt"},
@code=200>
MojFileUploaderApiClient.delete_file(collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757', filename: 'test1.txt')
=> RequestError
With a folder:
MojFileUploaderApiClient.delete_file(collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757', folder: 'subfolder', filename: 'test1.txt')
=> RequestError
Or you can use the DeleteFile
client directly:
MojFileUploaderApiClient::DeleteFile.new(collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757', filename: 'test1.txt').call
=> #<MojFileUploaderApiClient::Response:0x007fe4e59c8098 @body={:body_parser_error=>"743: unexpected token at ''"}, @code=204>
MojFileUploaderApiClient.list_files(collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757')
=> {:collection=>"a45c556f-a628-41d3-8c29-351f84e63757",
:files=>[{:key=>"a45c556f-a628-41d3-8c29-351f84e63757/test1.txt", :title=>"test1.txt", :last_modified=>"2016-11-30T15:30:52.000Z"}]}
With a folder:
MojFileUploaderApiClient.list_files(collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757', folder: 'subfolder')
=> {:collection=>"a45c556f-a628-41d3-8c29-351f84e63757", :folder=>"subfolder",
:files=>[{:key=>"a45c556f-a628-41d3-8c29-351f84e63757/subfolder/test1.txt", :title=>"test1.txt", :last_modified=>"2016-11-30T15:30:52.000Z"}]}
Or you can use the ListFiles
client directly:
MojFileUploaderApiClient::ListFiles.new(collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757').call
=> #<MojFileUploaderApiClient::Response:0x007fe4e5ac91e0
@body=
{:collection=>"a45c556f-a628-41d3-8c29-351f84e63757",
:files=>[{:key=>"a45c556f-a628-41d3-8c29-351f84e63757/test1.txt", :title=>"test1.txt", :last_modified=>"2016-11-30T15:30:52.000Z"}]}
@code=200>
Fork, then clone the repo:
git clone git@github.com:your-username/mojfile-uploader-api-client.git
Make sure the tests pass:
bundle exec rake
Make your change. Add specs for your change. Make the specs pass:
bundle exec rake
Push to your fork and submit a pull request.
Some things that will increase the chance that your pull request is accepted:
Released under the MIT License. Copyright (c) 2016 Ministry of Justice.
FAQs
Unknown package
We found that mojfile-uploader-api-client demonstrated a not healthy version release cadence and project activity because the last version was released 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.