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.
simple-boot-core
Advanced tools
npm init -y
npm install simple-boot-core
tsc --init --experimentalDecorators --emitDecoratorMetadata
// index.ts
import {SimpleApplication} from 'simple-boot-core';
import {Router} from 'simple-boot-core/decorators/route/Router';
import {Sim} from 'simple-boot-core/decorators/SimDecorator';
@Sim()
class User {
say() {
console.log('say~ hello');
}
}
@Sim() @Router({ path: '', route: {'/user': User}})
class AppRouter {}
new SimpleApplication(AppRouter).run().routing('/user').then(it => {
it.getModuleInstance<User>()?.say();
})
npx ts-node index.ts
# say~ hello
Decorators must be declared to be managed.
@Sim()
class ProjectService {
sum(x: number, y: number) {
return x + y;
}
}
@Sim()
class User {
constructor(private projectService: ProjectService) {
}
say() {
console.log(`say~ hello: ${this.projectService.sum(5, 25)}`);
}
}
// 💥 call say()
// say~ hello: 30
Sim Object created just one call
@Sim()
class User implements OnSimCreate {
onSimCreate(): void {
console.log('on Create')
}
}
// output 💥
// on Create
@Sim()
class User {
@Before({property: 'say'})
sayBefore() {
console.log('sayBefore')
}
@After({property: 'say'})
sayAfter() {
console.log('sayAfter')
}
say() {
console.log(`say~ hello`);
}
}
// 💥 call say()
// sayBefore
// say~ hello
// sayAfter
@Sim()
class User {
@ExceptionHandler()
otherException(@Inject({situationType: ExceptionHandlerSituationType.ERROR_OBJECT}) e: any) {
console.log(`otherException : ${e.message}`)
}
@ExceptionHandler({type: Error})
errorTypeException(e: Error) {
console.log(`errorTypeException : ${e.message}`)
}
say1() {
console.log(`say~ hello`);
throw {message: 'otherException'}
}
say2() {
console.log(`say~ hello`);
throw new Error('error');
}
}
// 💥 call say1()
// say~ hello
// { message: 'otherException' }
// otherException : otherException
// 💥 call say2()
// say~ hello
// Error: error at ...
// errorTypeException : error
@Sim()
class GlobalAdvice {
@ExceptionHandler()
otherException(@Inject({situationType: ExceptionHandlerSituationType.ERROR_OBJECT}) e: any) {
console.log(`otherException : ${e.message}`)
}
@ExceptionHandler({type: Error})
errorTypeException(e: Error) {
console.log(`errorTypeException : ${e.message}`)
}
}
@Sim()
class User {
say1() {
console.log(`say~ hello`);
throw {message: 'otherException'}
}
say2() {
console.log(`say~ hello`);
throw new Error('error');
}
}
const option = new SimOption([GlobalAdvice])
new SimpleApplication(AppRouter, option).run().routing('/user').then(it => {
it.getModuleInstance<User>()?.say1();
})
// 💥 call say1()
// say~ hello
// { message: 'otherException' }
// otherException : otherException
// 💥 call say2()
// say~ hello
// Error: error at ...
// errorTypeException : error
@Sim()
@Router({
path: '',
route: {
'/user': User
}
})
class AppRouter {
}
@Sim()
@Router({
path: '',
route: {
'/user': User
}
})
class AppRouter implements RouterAction {
async canActivate(url: Intent, module: any) {
console.log('--', url, module)
}
}
const option = new SimOption([GlobalAdvice])
new SimpleApplication(AppRouter, option).run().routing('/user').then(it => {
it.getModuleInstance<User>()?.say();
})
// output 💥
// -- Intent { uri: '/user', data: undefined, event: undefined } User { say: [Function (anonymous)], say2: [Function (anonymous)] }
// say~ hello
@Sim()
@Router({
path: ''
})
class AppRouter {
@Route({path:'/user'})
user1() {
console.log('user say1~')
}
@Route({path:'/user'})
user2() {
console.log('user say2~')
}
}
const option = new SimOption([GlobalAdvice])
new SimpleApplication(AppRouter, option).run().routing('/user').then(it => {
it.propertyKeys?.forEach(key => {
it.executeModuleProperty(key);
})
})
// output 💥
// user say1~
// user say2~
@Sim({scheme: 'AppRouter'}) @Router({path: '',route: {'/user': User}})
class AppRouter {
say(intent: Intent) {
console.log('say1-->', intent.data);
}
}
const app = new SimpleApplication(AppRouter).run();
app.publishIntent(new Intent('AppRouter://say1', {name: 'visualkhh', age: 99}));
// output 💥
// say1--> { name: 'visualkhh', age: 99 }
const intent = new Intent('AppRouter://say2', ['visualkhh', 99]);
intent.publishType = PublishType.INLINE_DATA_PARAMETERS;
app.publishIntent(intent);
// output 💥
// say2--> visualkhh 99
const global = new Intent('://say2'); // <-- global intent message event
const queryParam = new Intent('scheme://say2?age=5&name=visualkhh'); // <-- query parameter
queryParam.queryParams.name;
queryParam.queryParams.age;
FAQs
front end SPA frameworks
The npm package simple-boot-core receives a total of 6 weekly downloads. As such, simple-boot-core popularity was classified as not popular.
We found that simple-boot-core 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.