Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

graphql-passport

Latest version: v0.6.11

Overview

Last scanned
15 Oct 2026
Published
15 Oct 2026
AI: Suspicious npm package Publisher: ericbf, jkettmann
150 Stars
16 Forks
3 Versions
39.0K Downloads
TypeScript Repo language

Scan summary

graphql-passport was last scanned on 15 Oct 2026 at version 0.6.11. Risk score 85 of 100 (high). High-severity rules fired.

  • Releases: 3 versions; the latest 2 were published on 15 Oct 2026.
  • Findings: 3 rules fired in version 0.6.11 (8 instances: 1 high, 1 medium, 6 low). The score describes this version only.
  • Downloads: 38,950 downloads.

Versions

3 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.6.11 LATEST 15 Oct 2026 3 rules fired
0.6.10 15 Oct 2026 4 rules fired
0.6.8 19 Jan 2024 Not shown

Rules fired in 0.6.11: 3

Findings

1 High 1 Medium 6 Low

Findings for v0.6.11. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

Hidden or install-time code sweeps many credential stores

A file that is obfuscated or that an install hook runs names many unrelated credential stores: npm, cloud CLIs, Kubernetes or Vault, SSH and git, AI tool configs, browser wallets, instance metadata, CI tokens. A stealer sweeps everything a developer machine or CI runner holds; a tool reads the one store it needs.

HIGH

Obfuscated code across many files

MEDIUM

Obfuscated JavaScript

LOW
Checking access…

🔒 Create a free account to see all 8 findings with descriptions and instance counts

The score describes 0.6.11; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

graphql-passport provides simple functionality to authenticate with Passport.js from mutation resolvers.

Inside your resolvers you can get access to the following functions and attributes inside the context.

context.authenticate("graphql-local", { email, password }) // not available for subscriptions
context.login(user) // not available for subscriptions
context.logout() // not available for subscriptions
context.isAuthenticated()
context.isUnauthenticated()
context.getUser()

authenticate and login are basically passport.authenticate and passport.login wrapped in a promise. user, logout, isAuthenticated and isUnauthenticated are just copies of the corresponding passport functions and attributes.

Usage

For a full working example including detailed instructions visit this blog post about how to authenticate with user credentials using GraphQL and passport. Continue reading here for a short summary.

Initialize the GraphQLLocalStrategy and create the GraphQL context by using buildContext.

import { ApolloServer } from "apollo-server-express"
import express from "express"
import session from "express-session"
import { buildContext, GraphQLLocalStrategy } from "graphql-passport"
import passport from "passport"

passport.use(
    new GraphQLLocalStrategy((email, password, done) => {
        // Adjust this callback to your needs
        const users = User.getUsers()
        const matchingUser = users.find(
            (user) => email === user.email && password === user.password
        )
        const error = matchingUser ? null : new Error("no matching user")
        done(error, matchingUser)
    })
)

const app = express()
app.use(session(options)) // optional
app.use(passport.initialize())
app.use(passport.session()) // if session is used

const server = new ApolloServer({
    typeDefs,
    resolvers,
    context: ({ req, res }) => buildContext({ req, res, User })
})

server.applyMiddleware({ app, cors: false })

app.listen({ port: PORT }, () => {
    console.log(`🚀 Server ready at http://localhost:${PORT}${server.graphqlPath}`)
})

If you need to pass the request object into GraphQLLocalStrategy, you can pass the passReqToCallback option in an object as the first argument, then add it as the first argument of the verify function:

passport.use(
  new GraphQLLocalStrategy( { passReqToCallback: true }, (req, email, password, done) => {
    // access the request object
    const host = req.headers.host;
    ...
  })
);

Inside your resolvers you can call context.authenticate to authenticate the user with the given credentials. If you want to use express-session as well you need to call context.login(user) after authenticate.

const resolvers = {
    Query: {
        currentUser: (parent, args, context) => context.getUser()
    },
    Mutation: {
        login: async (parent, { email, password }, context) => {
            // instead of email you can pass username as well
            const { user, info } = await context.authenticate("graphql-local", {
                email,
                password
            })

            // only required if express-session is used
            context.login(user)

            return { user }
        }
    }
}

Usage with subscriptions

When using subscriptions you may want to only expose events related to the currently logged in user. Since subscriptions use websockets they don't pass the session and Passport middlewares like queries or mutations. To be able to access the user object from the context inside the subscription resolvers you need to do some additional work.

import express from 'express';
import session from 'express-session';
import { ApolloServer } from 'apollo-server-express';
import passport from 'passport';
import { GraphQLLocalStrategy, buildContext, createOnConnect } from 'graphql-passport';

...
const sessionMiddleware = session(options); // optional
const passportMiddleware = passport.initialize();
const passportSessionMiddleware = passport.session(); // if session is used

const app = express();
app.use(sessionMiddleware);
app.use(passportMiddleware);
app.use(passportSessionMiddleware);

const server = new ApolloServer({
  typeDefs,
  resolvers,
  context: ({ req, res }) => buildContext({ req, res, User }),
  subscriptions: {
    onConnect: createOnConnect([
      sessionMiddleware,
      passportMiddleware,
      passportSessionMiddleware,
    ])
  }
});

...

Now you can access isAuthenticated(), isUnauthenticated(), and getUser() on the context. Follwing example only allows a connection when the user is logged in. It only notifies the user if they are the receiver of the message.

const resolvers = {
  Subscription: {
    messageReceived: {
      subscribe: withFilter(
        (parent, args, context) => {
          if (context.isUnauthenticated()) {
            throw new Error('You need to be logged in');
          }
          return pubSub.asyncIterator([MESSAGE_RECEIVED])
        },
        (payload, variables, context) => payload.messageReceived.receiverId === context.user.id,
      ),
    },
  },
  Query: { ... },
  Mutation: {
    ...
    sendMessage: (parent, { text, receiverId }, context) => {
      const message = { text, receiverId };
      pubSub.publish(MESSAGE_RECEIVED, { messageReceived: message });
      return message;
    }
  },
};

Typescript

This library cannot know what fields the user type contains in a given project. In order to define your own Context type you must provide your user type to the PassportContext/PassportSubscriptionContext generic parameter.

Creating a simple context

First, we need to define the user type. In this example the type is defined in a file called MyUser.ts and has the fields firstName and lastName.

export type MyUser = {
    firstName: string
    lastName: string
}

We can now define the context interface specific to the project. We use the above user type in place of the generic for the PassportContext and PassportSubscriptionContext interfaces. For this example we create a file named MyContext.ts with following content.

import { Request as ExpressRequest } from 'express';
import { PassportSubscriptionContext, PassportContext } from 'graphql-passport';
import { MyUser } = './path/to/MyUser';

export interface MyContext extends PassportContext<MyUser, ExpressRequest>{}

export interface ProjectSubscriptionContext extends PassportSubscriptionContext<MyUser, ExpressRequest>{}
Using the context type in the resolvers

The MyContext type can now be used inside the resolvers. Below you can see an example of a resolver that concatenates the user's first and last name defined above.

import { MyContext } from "./path/to/MyContext"

const resolvers = {
    Query: {
        User: {
            name: (parent: unknown, data: SomeData, context: MyContext) => {
                const user = context.getUser()
                return `${user.firstName} ${user.lastName}`
            }
        }
    }
}
Working with data sources

If you use Apollo's data sources you might want to add dataSources to the interface. This can be achieved as follows.

import { Request as ExpressRequest } from 'express';
import { PassportSubscriptionContext, PassportContext } from 'graphql-passport';
import { MyUser } = './path/to/MyUser';

export interface MyContext extends PassportContext<MyUser, ExpressRequest>{
  dataSources: {
    myOtherAPI: { ... }
  }
}

export interface ProjectSubscriptionContext extends PassportSubscriptionContext<MyUser, ExpressRequest>{
  dataSources: {
    myOtherAPI: { ... }
  }
}

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm graphql-passport

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

PolinRider Returns
npm

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Frame 2085668439 (1)
Group 1261154229