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.
This is a simple Ruby wrapper around the Amazon's CloudSearch API. It has support for searching (with both simple and boolean queries), pagination and documents indexing.
Add this line to your application's Gemfile:
gem "cloud_search"
And then execute:
$ bundle
Or install it yourself as:
$ gem install cloud_search
The example bellow uses the Amazon's example database called imdb-movies
:
CloudSearch.configure do |config|
config.domain_id = "pl6u4t3elu7dhsbwaqbsy3y6be"
config.domain_name = "imdb-movies"
end
searcher = CloudSearch::Searcher.new
resp = searcher.with_fields(:actor, :director, :title, :year, :text_relevance)
.with_query("star wars")
.search
searcher = CloudSearch::Searcher.new
resp = searcher.with_fields(:actor, :director, :title, :year, :text_relevance)
.with_query("matri*")
.search
searcher = CloudSearch::Searcher.new
resp = searcher.with_fields(:actor, :director, :title, :year, :text_relevance)
.as_boolean_query
.with_query("year:2000")
.search
searcher = CloudSearch::Searcher.new
resp = searcher.with_fields(:actor, :director, :title, :year, :text_relevance)
.with_weights(:title => 3, :actor => 2, :default_weight => 1)
.as_boolean_query
.with_query("year:2000")
.search
searcher = CloudSearch::Searcher.new
resp = searcher.with_fields(:actor, :director, :title, :year, :text_relevance)
.with_query("matrix")
.ranked_with("my_rank_expression")
If you want to rank using descending order, just prepend the expression name with a '-' sign:
resp = searcher.with_fields(:actor, :director, :title, :year, :text_relevance)
.with_query("matrix")
.ranked_with("-my_rank_expression")
resp.results.each do |result|
movie = result["data"]
# List of actors on the movie
movie["actor"]
# Movie's name
movie["title"]
# A rank number used to sort the results
# The `text_relevance` key is added by AMS CloudSearch
movie["text_relevance"]
end
The results you get back are (currently) API-compatible with will_paginate:
searcher = CloudSearch::Searcher.new
resp = searcher.with_fields(:actor, :director, :title, :year, :text_relevance)
.with_query("star wars")
.with_items_per_page(30)
.at_page(10)
.search
resp.total_entries #=> 5000
resp.total_pages #=> 167
resp.current_page #=> 10
resp.offset #=> 300
resp.page_size #=> 30
document = CloudSearch::Document.new :type => "add", # or "delete"
:version => 123,
:id => 680,
:lang => :en,
:fields => {:title => "Lord of the Rings"}
indexer = CloudSearch::Indexer.new
indexer << document # add as many documents as you want (CloudSearch currently sets a limit of 5MB per documents batch)
indexer.index
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that eden_cloud_search 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.