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.
loopback-connector-apachecouchdb
Advanced tools
CouchDB connector for Loopback.io. Heavily borrowing from the original CouchDB-nano adapter for jugglingdb by Nicholas Westlake and Anatoliy Chakkaev, but adapted/partially rewritten for use with Loopback.io. Based on loopback-connector-couch by @mattange
Use gulp
to produce end file in ./lib
. Else, use directly the provided version or modify gulpfile as you need.
Upon initialisation, you can specify different authorisations, and up to 3 different connections will be established to the database: one for reader, one for writer and one for admin (see below why you need an admin one).
To use it you need to load the loopback-connector-juggler first if used programmatically, as any other connector. Otherwise, set things up in your datasources.json (see Loopback.io documentation for details):
"YOURDATASOURCENAME": {
"name": "YOURDATASOURCENAME", //Loopback.io - mandatory
"connector": "apachecouchdb", //Loopback.io - mandatory
"db": "DBNAME", //"db" or "database" - required
"host": "127.0.0.1", //this is also the default if not included
"port": 5984, //this is also the default if not included
"protocol": "http", //this is also the default if not included
"auth": { //optional, including each of its members
"admin": {
"username": "YOURUSERNAME_ADMIN",
"password": "YOURPASSWORD_ADMIN"
},
"reader": {
"username": "YOURUSERNAME_READER",
"password": "YOURPASSWORD_READER"
},
"writer": {
"username": "YOURUSERNAME_WRITER",
"password": "YOURPASSWORD_WRITER"
}
},
"views": [ //optional
{
"ddoc": "existing_design_document",
"name": "existing_design_document_view"
},
...
]
}
This adapter will automatically a number of design documents on your database:
\_design/loopback
document contains by_model
view that maps documents to their model name (set as property in the model as "loopbackModel"). To do so, authorisation enabled to modify design documents is required in the parameters if the CouchDB server is not in party mode.index: true
it will create one design document named \_design/loopback_<modelName>
and one view named by_<propertyName>
for each indexed property. Again, authorisation enabled to modify design documents is required.views
option.During querying of database for standard Loopback.io API endpoints this adapter will:
where
.loopback/by_model
view to reduce the number of documents it has to load and scan.include_docs
set to true
offset
is used as skip
query parameterlimit
is used as limit
query parameteroffset
and limit
are ignored in the request if a specific id
is requested via where
(e.g. {"where": {"id":"someID"}}
). If where
is included (e.g. {"where":{"foo":"bar"}}
), then the results are retrieved in their entirety, then filtered via where
and then offset
and limit
, so that for example all items that satisfy the where
criteria can be retrieved in various paginated requests.queryView
API endpoint (only generated if the options specify additional views to be made available in the CouchDB database) will return the output of the view (with specific keys as requested), that may or may not be linked to the Model being used for the query, if the same CouchDB database is used for multiple document types: fundamentally, no checks are done on the output of the view (other than any _id into id and removing loopbackModel property in case present).PUT /modelName/{id} | updateAttributes
API endpoint will work as expected, but will not return the updated _rev
(working to solve that issue). Consider updating the entire document via PUT /modelName
, as that will allow to update the _rev
in the response.Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
FAQs
CouchDB adapter for Loopback.io
We found that loopback-connector-apachecouchdb 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.