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.
Model-based dynamic multi-level APIs for any provider, plus multiple consumption channels
Lightweight framework for building dynamic multi-level APIs for any provider (Express, socket.io, etc.), consumable via multiple channels (HTTP, socket.io, etc.)
To install the latest version, use NPM:
$ npm install api-core
In API Core every API is built from edges. An edge defines operations and relations of a Data Model.
Every edge provides the following operations:
Every operation provides standard features like filtering, sorting, population and pagination.
Also every operation is available via all enabled channels.
So while you can list students via a HTTP request, you also can do the same via a socket.io message or any custom channel defined by you.
You can use API Providers to make your API consumable via different channels.
We have (or working on) providers for the following channels:
Also you can implement your own API provider.
Every API requires a set of data models. As with API Providers, you have a bunch of options when choosing your library for creating the models.
We have (or working on) data model libraries for the following frameworks:
Also you can implement your own API model library.
We have two working examples in the following repository, one with a local in-memory model (master branch) and one with a Mongoose model (mongodb branch).
Working Demo: api-demo
A complete API with 5 models and relations in 67 lines:
import {ApiEdgeError, OneToOneRelation, OneToManyRelation, ApiEdgeQueryResponse, Api} from "api-core";
import {MongooseModelFactory} from "api-model-mongoose";
import {EllipseApiRouter} from "api-provider-ellipse";
import * as mongoose from "mongoose";
const Ellipse = require('ellipse'),
app = new Ellipse;
mongoose.Promise = global.Promise;
mongoose.connect("mongodb://localhost/api-demo");
const ObjectId = mongoose.Schema.Types.ObjectId;
const studentEdge =
MongooseModelFactory.createModel("student", "students", {
id: String,
firstName: String,
lastName: String,
email: String,
phone: String,
school: { type: ObjectId, ref: 'school' },
classId: { type: ObjectId, ref: 'class' }
}),
classEdge =
MongooseModelFactory.createModel("class", "classes", {
id: String,
name: String,
semester: String,
room: String,
school: { type: ObjectId, ref: 'school' }
}),
courseEdge =
MongooseModelFactory.createModel("course", "courses", {
id: String,
name: String,
class: { type: ObjectId, ref: 'class' },
courseType: { type: ObjectId, ref: 'courseType' }
}),
courseTypeEdge =
MongooseModelFactory.createModel("courseType", "courseTypes", {
id: String,
name: String
}),
schoolEdge =
MongooseModelFactory.createModel("school", "schools", {
id: String,
name: String,
address: String,
phone: String
});
const api10
= new Api({name: 'test-service', version: '1.0'})
.edge(studentEdge);
const api11
= new Api({name: 'test-service', version: '1.1'})
.edge(studentEdge)
.edge(classEdge)
.edge(courseEdge)
.edge(courseTypeEdge)
.edge(schoolEdge);
app.use(require('body-parser').json());
const router = new EllipseApiRouter(api11, api10);
router.apply(app);
app.listen(8080);
We maintain high test coverage to provide a reliable framework for your APIs.
To run tests, execute the following NPM commands:
$ npm install
$ npm test
The MIT License. Free forever. :)
FAQs
Model-based dynamic multi-level APIs for any provider, plus multiple consumption channels
The npm package api-core receives a total of 151 weekly downloads. As such, api-core popularity was classified as not popular.
We found that api-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.