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.
Ruby class representing an path through an object graph. Instance of the +ObjectPath+ class can be used to navigate through an object graph and the value(s) in the final step of the path are returned.
Add this line to your application's Gemfile:
gem 'object_path'
And then execute:
bundle install
Or install it yourself as:
gem install object_path
Paths are defined as a set of steps. These can be declared in a number of ways :-
require 'object_paths/object_path'
path = ObjectPaths::ObjectPath.new('address/street')
path = ObjectPaths::ObjectPath.new(['address', 'street'])
path = ObjectPaths::ObjectPath.new([:address, :street])
path = ObjectPaths::ObjectPath.new(ObjectPaths::ObjectPath.new('address/street'))
The path can then be used to navigate through an object graph :-
require 'object_paths/object_path'
class Address
attr_accessor :street
end
class Person
attr_accessor :address
end
address1 = Address.new
address1.street = '123 Main Street'
address2 = Address.new
address2.street = '456 High Street'
person1 = Person.new
person1.address = address1
person2 = Person.new
person2.address = address2
path.resolve(person1) # => '123 Main Street'
path.resolve(person2) # => '456 High Street'
If any step on the path is +Enumerable+ then the following steps with be resolved for each item and an +Array+ of results will be returned. If multiple steps are +Enumerable+ then the process will be repeated for each item. The resulting nested +Array+ will be flattened to a single +Array+. All +Array+ results are also comapected :-
require 'object_paths/object_path'
class Address
attr_accessor :street
end
class Person
attr_accessor :addresses
end
address1 = Address.new
address1.street = '123 Main Street'
address2 = Address.new
address2.street = '456 High Street'
person = Person.new
person.addresses = [address1, address2]
path = ObjectPaths::ObjectPath.new('addresses/street')
path.resolve(person) # => ['123 Main Street', '456 High Street']
To ease the creating of new Object Paths the +String+ and +Array+ classes have been extended to allow them to be converted to Object Paths. In both cases the instance method +to_object_path+ can be called to perform the conversions.
require 'object_paths/object_path'
'address/street'.to_object_path
['address', 'street'].to_object_path
%i[address street].to_object_path
FAQs
Unknown package
We found that object_path 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.