Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
ferrum-har is a gem that adds the ability to capture HAR files while running tests using ferrum.
Add ferrum-har to your Gemfile and bundle install
:
gem "ferrum-har"
Use ferrum as normal and call the har
method on
the page
(or browser
) object. Chrome must be used as the browser engine.
Note, the devtools window in Chrome will be opened by ferrum-har for the duration of the ferrum test run. This is mandatory to obtain the HAR from Chrome.
browser = Ferrum::Browser.new
page = browser.create_page
page.go_to("https://www.bbc.co.uk")
page.network.wait_for_idle
# Returns the HAR as a JSON string
puts page.har
Creating a HAR file from ferrum network objects is complex and potentially incompatible with the HAR generated by other tools (including Chrome).
Instead, ferrum-har contains a small Chrome extension that
is automatically loaded into the test browser. When the har
method is called, this extension
asks the Chrome devtools Network panel for the HAR file and returns it to the Ruby process. This
means the HAR is always a valid version of exactly what Chrome would produce.
The JS method that is ultimately called is chrome.devtools.network.getHAR()
and you can read more
about it here.
One ramification of this is that the Chrome devtools must be open for the extension to work.
To get the extension to be loaded we must pass some switches to the Chrome process via ferrum,
specifically the --auto-open-devtools-for-tabs
and --load-extension
switches. This is done
by ferrum-har automatically.
For further reading, a full list of Chrome switches can be found here.
ferrum-har
uses semantic versioning, so major version changes will usually
require additional actions to be taken upgrading from one major version to another.
A full changelog can be found here: CHANGELOG.md
Some ideas for improvements.
"user-data-dir=profile" => "somedir"
And have a "Default/Preferences" file in there that contains a sizing element like this:
{
"devtools": {
"preferences": {
"inspector-view.split-view-state": "{\"vertical\":{\"size\":1},\"horizontal\":{\"size\":0}}"
}
}
}
However, that doesn't work as it stands as it is just a partial profile. We could add an entire
Chrome profile but that would be hundreds of files.FAQs
Unknown package
We found that ferrum-har demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.