
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@epfl-si/react-graphql-simple
Advanced tools
@epfl-si/react-graphql-simple
A nothing-up-our-sleeves binding for graphql-request
in a React application.
useGraphQLRequest
returns, and is never retried unless and until you restart()
it.@epfl-si/react-graphql-paginated
.The <GraphQLProvider>
React component takes a GraphQL endpoint URL and an optional authentication mechanism as parameters.
Here is an example where the authentication part is handled using @epfl-si/react-appauth
:
import { OIDCContext, useOpenIDConnectContext } from "@epfl-si/react-appauth";
import { GraphQLProvider } from "@epfl-si/react-graphql-simple";
function App() {
const oidcContextProps = { authServerUrl, ... }
return <OIDCContext { ...oidcContextProps }>
<GraphQLProvider endpoint="/graphql" authentication={
{ bearer: () => useOpenIDConnectContext().accessToken }
}>
<MoreComponentsForYourApp/>
</GraphQLProvider>
</OIDCContext>
}
The <GraphQLProvider>
component provides a React context, meaning that within its children elements, any component may call useGraphQLRequest
to perform GraphQL requests against the configured endpoint and wielding credentials from the configured authentication (if any).
Except for the part where it waits for authentication to succeed before sending the request, useGraphQLRequest
is implemented in terms of plain graphql-request
with no further ado.
Here is an example of a functional React component that calls useGraphQLRequest
:
import * as React from "react";
import { gql } from 'graphql-request';
import { useGraphQLRequest } from '@epfl-si/react-graphql-simple';
type Item = { id : number, title : string, description : string };
export function MyGraphQLCapableComponent() {
const { loading, data, error } = useGraphQLRequest<{ items: Item[] }>(gql`
{
items {
id
title
description
}
}`);
if (loading) return <Throbber/>;
if (error) return <p className="error">{error.toString()}</p>;
return <>{ items.map((item) => <p className="item">{item.title}</p>) }</>;
}
FAQs
Await authentication then perform GraphQL requests
We found that @epfl-si/react-graphql-simple demonstrated a healthy version release cadence and project activity because the last version was released less than 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.