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.
Really simple XML parsing ripped from Crack which ripped it from Merb.
Irons was created to bypass the stale development of Crack, improve its XML parser
and fix certain issues.
parser = Irons.new
parser.parse("<tag>This is the contents</tag>")
# => { 'tag' => 'This is the contents' }
Irons supports pluggable parsers and ships with both REXML and Nokogiri implementations.
It defaults to Nokogiri since v2.0.0, but you can change it to use REXML via:
Irons.new(:parser => :rexml) # or :nokogiri
Make sure Nokogiri is in your LOAD_PATH when parsing XML, because Irons tries to load it
when it's needed.
Besides regular typecasting, Irons features somewhat "advanced" typecasting:
TrueClass
and FalseClass
.Time
, Date
and DateTime
objects.You can disable this feature via:
Irons.new(:advanced_typecasting => false)
Irons can strip the namespaces from your XML tags. This feature might raise
problems and is therefore disabled by default. Enable it via:
Irons.new(:strip_namespaces => true)
Irons lets you specify a custom formula to convert XML tags to Hash keys.
Let me give you an example:
parser = Irons.new(:convert_tags_to => lambda { |tag| tag.snakecase.to_sym })
xml = '<userResponse><accountStatus>active</accountStatus></userResponse>'
parser.parse(xml) # => { :user_response => { :account_status => "active" }
Irons will automatically convert dashes in tag names to underscores. For example:
parser = Irons.new
parser.parse('<any-tag>foo bar</any-tag>') # => { "any_tag" => "foo bar" }
You can control this behavior with the :convert_dashes_to_underscores
option:
parser = Irons.new(:convert_dashes_to_underscores => false)
parser.parse('<any-tag>foo bar</any-tag>') # => { "any-tag" => "foo bar" }
FAQs
Unknown package
We found that irons demonstrated a not healthy version release cadence and project activity because the last version was released 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.
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.