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.
ctrl-content-manager
Advanced tools
An abstraction around contentful.
Yarn is recommended for installation.
$ yarn add ctrl-content-manager
But you can still use npm:
$ npm install --save ctrl-content-manager
const _ = require('lodash')
const CtrlContentManager = require('ctrl-content-manager')
const cm = new CtrlContentManager({
accessTokens: {
production: 'contentful_production_token'
, preview: 'contentful_preview_token'
}
, fetchInterval: 60 * 60 * 1000
, isProduction: process.env.NODE_ENV === 'production'
, space: 'contentful_space_id'
, parsing: {
keyed: {
tags: 'title'
, authors: 'name'
}
, singles: [
'globalElements'
, 'blogPostElements'
]
}
})
cm.startFetchInterval()
// Psuedo blog server code
http.get('/blog/?slug', (request, reply) {
// Get URL Slug.
const slug = request.params.slug
// Lookup the blog post by slug.
const blogPost = cm.find('blogPosts', {slug})
// If that post doesn't exist, show a 404 page with 3 random post suggestions.
if (!blogPost) {
return reply('404-template', {
suggestedBlogs: _.sampleSize(cm.get('blogPosts'), 3)
})
}
// Otherwise
// Get generic blog post elements. (E.g., nav buttons, colors, section titles)
const blogPostElements = cm.get('blogPostElements')
// Get the page title suffix. (E.g., ' - My Blog')
const titleSuffix = cm.get('globalElements.titleSuffix')
// Get tags that aren't already tagged on this post.
const otherTags = _.omit(cm.get('tags'), _.map(blogPost.tags, 'title'))
// Get authors that aren't this post's author.
const otherAuthors = _.omit(cm.get('authors'), blogPost.author.name)
// Render and serve the blog post.
return reply('blog-post-template', {
blogPost
, blogPostElements
, titleSuffix
, otherTags
, otherAuthors
})
})
Full documentation to come soon!
Copyright (c) 2016 Martin Experiments LLC
FAQs
An abstraction around contentful.
We found that ctrl-content-manager 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.