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.
@midgar/apollo-server
Advanced tools
PLugin Midgar pour ajouter un service Apollo serveur avec loader de modules graphql et injéction de services.
$ npm i @midgar/apollo-server --save
Si tout s'est bien passé, un message de confirmation s'affiche:
#midgar-cli
@midgar/apollo-server added to plugins.js !
Ajoute un dossier de plugin midgar-graphql: ./graphql/ pour les modules graphl.
Un module graphql est un fichier javacript exportant les typeDefs et les resolvers graphql.
Exemple d'un module graphl:
import { gql } from 'apollo-server-express'
// Type defs graphql
const typeDefs = gql`
type User {
id: ID!
email: String!
}
extend type Query {
addUser(email: String): User
getUsers: [User]
}
`
export default {
// Services à incjecter
dependencies: ['mid:user']
graphql: (mid, userService) => {
return {
typeDefs,
resolvers:{
User: {
...
}
Query: {
createUser: async (parent, args, ctx, info) => {
await userService.create(args.email, args.parssword)
},
getUsers: (parent, args, ctx, info) => {
...
},
}
}
}
}
}
Vous pouvez séparrer le fichier si besoin:
import typeDefs from './user.typedefs'
import resolvers from './user.resolvers'
export default {
dependencies: ['mid:user']
graphql: (...args) => {
return {
typeDefs,
resolvers: () => resolvers(...args)
}
}
}
Les fichiers *.typedefs.js et *.resolvers.js ne sont pas importé lors de l'import des modules graphql.
FAQs
A Midgar plugin to add graphql server
We found that @midgar/apollo-server 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.