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.
Generate WebAPI mocking response data from your rails application's request-spec.
And run proxy server for mocking response.
Inspired by autodoc.
Add this line to your rails application's Gemfile:
gem "automock", group: :test
Download and install by running:
$ bundle install
And setup mocking server.
$ rake automock:setup
This generate automock
directory under your rails root.
Mocking server is inside it.
I recommend adding automock directory to .gitignore.
Then run mocking server.
$ rake automock:server
By default, proxy server use 8001 port and target application using 3000 port.
Mocking management server use 8000 port.
Now you can access it, localhost:8000.
And access localhost:8001, you can receive response by proxy.
Run rspec with AUTOMOCK=1 to generate mocking data for your request-specs tagged with :automock.
AUTOMOCK=1 rspec
describe 'GET /api/v1/users' do
context 'This is test API', automock: true do
before do
get '/api/v1/users'
end
it 'receives 200 and users json' do
expect(response.status).to eq 200
end
# and more example...
end
end
You can manage mocking data, on or off, by mocking response management server. By default, mocking management server use 8000 port. So you can access it.
Selected mocking data is used by proxy.
Unselected api is passed through normally.
You can change automock's using port by rake args.
Example:
$ rake automock:server automock_port=3001 rails_port=3002 proxy_port=3003
After checking out the repo, run bin/setup
to install dependencies.
If you run mocking server, run bin/server
to start it.
Then, run rake spec
to run the tests for ruby code.
And change directory to server
, then run npm run test
to run the tests for mocking server.
Bug reports and pull requests are welcome on GitHub at https://github.com/joe-re/automock. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that automock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.