
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
graphql-metal
Advanced tools
**GraphQL Metal** is an experimental prototype that runs a (node.js) graphQL "server" on AWS Lambda as close to the "metal" as possible (or at least closer to the metal than apollo-server).
GraphQL Metal is an experimental prototype that runs a (node.js) graphQL "server" on AWS Lambda as close to the "metal" as possible (or at least closer to the metal than apollo-server).
GraphQL Metal uses graphql-jit and falls back to graphql-js if the query can't be compiled.
The only runtime dependencies of this package are:
{
"graphql": "^15.4.0",
"graphql-jit": "^0.4.3",
"graphql-tools": "^7.0.1",
"tiny-lru": "^7.0.6"
}
const typeDefs = `
type Query {
getPost(id: ID!): Post!
}
type Post {
id: ID!
content: String!
}
`
const posts = [{ id: "1", content: "Hello World!" }]
const resolvers = {
Query: {
getPost: (_, args) => {
return posts.find(_ => _.id === args.id)
}
}
import { createHandler } from "graphql-metal"
export const handler = createHandler({
typeDefs,
resolvers,
createContext: event => ({ authHeader: event.headers["authorization"] }),
createHeaders: event => ({ "accesss-control-allow-origin": "*" })
})
You can configure caching and jit settings like so:
import { createHandler, GraphQLQueryCache } from "graphql-metal"
export const handler = createHandler({
typeDefs,
resolvers,
jitThreshold: 2 // cache + jit a query as soon as we see it 2x
queryCache: new GraphQLQueryCache({ maxSize: 10, ttlInMs: 30 * 60 * 1000 })
createContext: event => ({ authHeader: event.headers["authorization"] }),
createHeaders: event => ({ "accesss-control-allow-origin": "*" }),
})
import { event } from "graphql-metal"
import { Context } from "aws-lambda"
it("should get a post by id", async () => {
const result = await handler(event({
query: `
query getPostQuery($id: ID!) {
getPost(id: $id) {
id
}
}
`,
variables: { id: "1" }
}),
{} as Context, // fake Lambda context
() => {} // fake Lambda "callback"
)
expect(result).toEqual({
statusCode: 200,
headers: { "accesss-control-allow-origin": "*", "content-type": "application/json" },
body: JSON.stringify({ data: { getPost: { id: "1" } } })
})
})
Generally you'll want to connect your shiny new Lambda handler to API gateway. But you can also directly invoke your Lambda handler via the AWS SDK like so:
import { Lambda } from "aws-sdk"
const query = `
query getPostQuery($id: ID!) {
getPost(id: $id) {
id
}
}
`
const variables = variables: { id: "1" }
const payload = {
httpMethod: "POST",
headers,
body: JSON.stringify({ query, variables })
}
const request: Lambda.Types.InvocationRequest = {
FunctionName: "foo-function",
InvocationType: "RequestResponse",
Payload: JSON.stringify(payload)
}
const lambda = new Lambda({ region: "us-east-1" })
const { StatusCode, FunctionError, Payload } = await lambda.invoke(request)
FAQs
**GraphQL Metal** is an experimental prototype that runs a (node.js) graphQL "server" on AWS Lambda as close to the "metal" as possible (or at least closer to the metal than apollo-server).
The npm package graphql-metal receives a total of 0 weekly downloads. As such, graphql-metal popularity was classified as not popular.
We found that graphql-metal 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.