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.
refinerycms-pgsearch
Advanced tools
By: JGW Maxwell
Powered by: pg_search. This only works on PostgreSQL databases, ideally 9.0+.
Simply use this by adding the following to your Gemfile
:
gem 'refinerycms-pgsearch'
# or for the latest and greatest
gem 'refinerycms-pgsearch', github: 'jgwmaxwell/refinerycms-pgsearch'
Then run bundle install
, and rails g refinery:search
to generate the migrations. Finally, run rake db:migrate
and rake db:seed
to finish setting up.
The default installation will search in Pages. If you wish to find results in other plugins you have created or installed, you can specify these in config/initializers/refinery/search.rb
like so:
Refinery::Search.configure do |config|
config.searchable_models = {
"Refinery::Page" => [:title, :all_parts],
"Refinery::Blog::Post" => [:title, :body]
}
end
This will index Pages and Blog Posts for you. The format is: "STRING_OF_MODEL_CLASS" => [:array, :of, :attribute, :symbols]
. You might notice that Pages are indexing :all_parts
- this is a convenience to get the content out of multiple page parts that will be defined if you use it.
Simple pass another line into the hash in the initializer, such as:
"Employee" => [:name, :bio]
You can use any public method, as well. So if you have :first_name
and :last_name
but a method like name
to join them, it can be indexed.
If at any point you need to rebuild your search index, run rake refinery:search:rebuild
to update all your search records!
A sample search form can be found in views/refinery/shared/_search.html.erb. You can either use this partial directly, or copy the appropriate parts.
If you wish to override the url used in the search results just add a url
method to your model and the result of this method will be used instead.
You'll need to run the generator, migrate the database, update the new initializer and remove the old code from application.rb
. Then remove the acts_as_indexed
statements from your models but otherwise it should be good to go. Let me know if you need help.
FAQs
Unknown package
We found that refinerycms-pgsearch 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.
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.