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.
The sole purpose of this gem is to provide the boilerplate code necessary to import and proces data from files for my applications. This reduces duplication and eases maintenance.
Add this line to your application's Gemfile:
gem 'importeer_plan'
And then execute:
$ bundle
Or install it yourself as:
$ gem install importeer_plan
Importeer.new takes two options:
name (string)
an options-hash
My applications-classes for processing data from external files inherit from Importeer, depending the file-type:
class ImporteerSomething < ImporteerPlan::MyXls
attr_accessor :my_var, :another_var
#call importeer("filename") to import the file in batches of 1000, optional importeer("filename", {size_batch: 1234})
def initialize(*)
super
@my_var = MyVar.all
@another_var = AnotherVar.all
end
end
e = ImporteerPlan::MyXls.new('example.xls')
e.importeer
this works, after you created a file like this:
#save this file as: importeer_example.rb
class ImporteerExample < ImporteerPlan::MyXls
def importeer_batch(batch)
batch.each do |row|
handle_my_model row
end
end
def handle_my_model ref
r=MyModel.new
r.attribute_one = ref[0] unless ref[0].blank?
r.another_attribute = ref[1] unless ref[1].blank?
r.save! if r.attributes.values.any? {|x| !x.blank?}
end
end
Starting 0.3.0, i added some configuration-options. The most basic configuration is setting the path to find the files to import. The default is creating a folder in the 'public' folder, but you could so something like:
ImporteerPlan.configure do |config|
config.dir = Rails.root.join('imports')
end
commaf(string) where string is a dutch amount, separated by ',' turning to a float
pointf(string) where string is a dutch amount, separated by '.' turning to a float
ImporteerPlan uses minitest. Run rake to start the test-suite.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that importeer_plan 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.