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.
@ng-vcl/store
Advanced tools
npm install @ng-vcl/store --save
import { NgModule } from '@angular/core';
import { StoreModule } from 'ng-vcl';
import { AppComponent } from './app.component';
import { REDUCERS } from './reducers';
import { EFFECTS } from './effects';
@NgModule({
imports: [
StoreModule.forRoot({
enableRouter: true, // enables the StoreRouter
reducers: [ ... ], // optional - Your reducers
effects: [ ... ] // optional - Effect classes
})
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
export const initialState: BooksState = {
loading: false,
books: [],
error: null
};
export class SearchBooksAction {
constructor(public query: string) {}
}
export class SearchBooksCompleteAction {
constructor(public books: any[]) {}
}
export class SearchBooksErrorAction {
constructor(public error: any) {}
}
function bookReducer(state = initialState, action: SearchBooksAction | SearchBooksCompleteAction | SearchBooksErrorAction) {
if (action instanceof SearchBooksAction) {
return {
loading: true,
books: [],
error: null
};
} else if (action instanceof SearchBooksCompleteAction) {
return {
loading: false,
books: [...action.books],
error: null
};
} else if (action instanceof SearchBooksErrorAction) {
return {
loading: false,
books: [],
error: action.error
};
}
return state;
}
export const BOOK_REDUCERS = {
books: bookReducer
}
@Injectable()
export class BooksService {
constructor(
private store: Store,
) { }
books$ = this.store.select<BooksState>(state => state.books);
public search(query: string) {
this.store.dispatch(new SearchBooksAction(query));
}
}
@Injectable()
export class BooksEffects {
constructor(
private actions$: StoreActions,
private http: Http
) { }
@Effect()
search = this.actions$
.ofType(SearchBooksAction)
.switchMap( ({query}) => {
return this.http.get(`${API}?q=${query || ''}`)
.map(res => res.json())
.map(result => result.items)
.map(items => {
return new SearchBooksCompleteAction(items);
})
.catch(err => {
return Observable.of(new SearchBooksErrorAction(err));
});
});
}
FAQs
ng-vcl store
We found that @ng-vcl/store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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.