Zum Hauptinhalt springen
LIVE
CVSS 4.8CVE-2026-138092 | A security flaw has been discovered in ggml-org llama.cpp up to 0.8.0. This vulnerability affects the function ggml_roll of the file ggml/src/ggml.c of the component Ggml Tensor Library Roll Operation. The manipulation results in integer overflow. The attack needs to be approached locally. Upgrading to version 0.9.0 is able to resolve this issue. The patch is identified as 0978a6e9022fb9bd6874b86154ee304e81929b9f. It is suggested to upgrade the affected compCVSS 10.0CVE-2026-138091 | A vulnerability was identified in Tenda AC10U 15.03.06.48. This affects the function TendaTelnet of the file /goform/telnet of the component Web UI. The manipulation leads to missing authentication. The attack is possible to be carried out remotely. The exploit is publicly available and might be used.CVSS 10.0CVE-2026-138090 | A vulnerability was determined in Tenda AC10U 15.03.06.48. Affected by this issue is the function ate_ifconfig_set of the file /bin/httpd of the component ATE Service. Executing a manipulation can lead to os command injection. The attack can be executed remotely. The exploit has been publicly disclosed and may be utilized.CVSS 6.9CVE-2026-138089 | A vulnerability was found in Youzan ZanProxy up to 5.1.0. Affected by this vulnerability is the function processRedirect of the file src/core/proxy/middleware/rule.ts of the component Forwarding Rule Redirect. Performing a manipulation of the argument Target results in path traversal. Remote exploitation of the attack is possible. The exploit has been made public and could be used. The project was informed of the problem early through an issue report but hasCVSS 6.9CVE-2026-138088 | A vulnerability has been found in SchneeHertz exhentai-manga-manager up to 1.6.16. Affected is the function mangaToLANraragiArchive of the file index.js of the component LAN Browsing Service. Such manipulation leads to missing authentication. The attack may be launched remotely. The exploit has been disclosed to the public and may be used. The reported GitHub issue was closed with the reason "completed". However, it was not possible to determine the PR or coCVSS 6.9CVE-2026-138087 | A flaw has been found in linhaojun857 aurora up to 07e9524caacf6ceb021f3408e73f900f230d05f2. This impacts the function generalKey of the file aurora-springboot/src/main/resources/application-prod.yml of the component JWT Token Service. This manipulation of the argument secret causes use of hard-coded cryptographic key . The attack may be initiated remotely. The exploit has been published and may be used. This product uses a rolling release model to deliverCVSS 6.9CVE-2026-138086 | A security vulnerability has been detected in wonderunit storyboarder 3.0.0. The impacted element is the function MobileServer of the file src/js/express-app/app.js. The manipulation leads to missing authentication. The attack can be initiated remotely. The exploit has been disclosed publicly and may be used. The project was informed of the problem early through an issue report but has not responded yet.CVSS 5.3CVE-2026-138085 | A weakness has been identified in ThingsBoard up to 4.2.2.7/4.3.1.7/4.4.0. The affected element is the function downloadTestReport of the file application/src/main/java/org/thingsboard/server/controller/DashboardReportController.java of the component Report Service. Executing a manipulation of the argument userId can lead to authorization bypass. It is possible to launch the attack remotely. The exploit has been made available to the public and could be used
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

How To Set Up React Context

Prop drilling is usually the reason we reach for React Context: state that started in one component ends up threaded through five layers of props, and every…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 6 Min. Lesezeit
Quelle: dev.to
Rubrik: Programmation sécurisée

Prop drilling is usually the reason we reach for React Context: state that started in one component ends up threaded through five layers of props, and every layer in between has to know about data it doesn't use. Context fixes that. But "use Context" isn't a setup — there are a dozen ways to structure the files, and most of them share a papercut that has annoyed me in every codebase I've worked in.



This article walks through the setup I've landed on. It's three files, it makes "Go to Definition" actually useful, and it uses a lint rule to make the one risky part of the pattern impossible to get wrong. The running example is a tic-tac-toe game — the full working project is at react-context-boilerplate-example.






The papercut



Here's the workflow friction. In a typical Context setup, components access state through a hook:




const { winner, resetGame } = useGame();






You're reading a component, you want to know how resetGame actually works, so you Command + Click on useGame. And you land... in a file that contains a useContext call and nothing else. The actual state management — the useState calls, the update logic — lives inside the provider component in a different file. So you go searching for it.



Every. Single. Time.



The setup below fixes that: Go to Definition on the consumer hook lands in the same file as all the state-management logic.






The structure



Three pieces, two files:




src/context/
├── GameContext.ts ← the context, the public hook, AND the state logic
└── GameProvider.tsx ← a thin shell






The trick is that the state management isn't written inside the provider component. It's written as a hook, in the same file as the consumer hook.






Step 1: The context file



GameContext.ts contains three things: the context object, the public hook that components use, and a private hook holding all the state logic.




import { createContext, useContext, useState } from 'react';
import type { GameContextI, Winner, BoardContent, Player } from '../types';
import {
INITIAL_BOARD_CONTENT,
INITIAL_CURR_PLAYER,
INITIAL_WINNER,
} from '../constants/gameConstants';

export const GameContext = createContext<GameContextI | null>(null);

// PUBLIC: components call this to access the game state.
export function useGame() {
const context = useContext(GameContext);
if (!context) {
throw new Error('useGame must be used within a GameProvider');
}
return context;
}

// PRIVATE: only GameProvider should ever call this.
export function useGameStateManagement() {
const [currPlayer, setCurrPlayer] = useState<Player>(INITIAL_CURR_PLAYER);
const [winner, setWinner] = useState<Winner>(INITIAL_WINNER);
const [boardContent, setBoardContent] = useState<BoardContent>(
INITIAL_BOARD_CONTENT,
);

const updateSquareContent = (
rowIndex: number,
colIndex: number,
value: Player,
) => {
// ...update the board, check for a winner, advance the turn...
};

const resetGame = () => {
setCurrPlayer(INITIAL_CURR_PLAYER);
setWinner(INITIAL_WINNER);
setBoardContent(INITIAL_BOARD_CONTENT);
};

return {
winner,
currPlayer,
setCurrPlayer,
boardContent,
setBoardContent,
updateSquareContent,
resetGame,
};
}






A few things to notice:





  • The context is typed as GameContextI | null and the public hook throws if the context is missing. That null check happens once, here — components never have to handle a possibly-null context, and a component rendered outside the provider fails loudly with a message that says exactly what's wrong.


  • useGameStateManagement is a real hook, so it can use useState (or useReducer, or anything else) exactly as if the logic were written inline in the provider.


  • Both hooks are in one file. Go to Definition on useGame from any component takes you here — where the state logic lives. Papercut solved.






Step 2: The thin provider



Because the logic lives in the hook, the provider has almost nothing to do:




import React from 'react';
import { GameContext, useGameStateManagement } from './GameContext';

interface GameProviderProps {
children?: React.ReactNode;
}

export default function GameProvider({ children }: GameProviderProps) {
const contextValue = useGameStateManagement();
return (
<GameContext.Provider value={contextValue}>{children}</GameContext.Provider>
);
}









Step 3: Wrap the tree and consume



Wrap the part of the tree that needs the state (here, the whole app):




createRoot(document.getElementById('root')!).render(
<StrictMode>
<GameProvider>
<App />
</GameProvider>
</StrictMode>,
);






And any component underneath just calls the public hook:




import { useGame } from './context/GameContext';

function App() {
const { winner, resetGame } = useGame();
// ...
}






No prop drilling, no null checks, and jumping to useGame's definition drops you next to the actual logic.






The catch



There's one problem with this pattern, and it's the price of the co-location: useGameStateManagement has to be exported so the provider can import it. Which means it looks importable to everyone.



If a teammate skims the file, sees an exported hook that returns the entire game state, and calls it from a component — the code will compile, render, and even sort of work. But that component gets its own, brand-new copy of the state, completely detached from the context value every other component shares. Clicking a square updates one board; the rest of the app is looking at a different one. It's the kind of bug that costs an afternoon.



A // do not call this outside GameProvider comment is a speed bump, not a wall. What I wanted was a lint error.






Enforcing it with a lint rule



I packaged this up as eslint-plugin-restrict-callers: an ESLint rule that restricts which named functions may call a given function.




npm install --save-dev eslint-plugin-restrict-callers






Then in eslint.config.js (flat config, ESLint 9+):




import restrictCallers from 'eslint-plugin-restrict-callers';

export default [
{
plugins: { 'restrict-callers': restrictCallers },
rules: {
'restrict-callers/restrict-callers': ['error', {
restrictedFunctions: [
{
functionName: 'useGameStateManagement',
allowedCallers: ['GameProvider'],
alternative: 'useGame',
},
],
}],
},
},
];






Now calling the private hook anywhere other than GameProvider fails lint with a message that tells the reader what to do instead:




error  useGameStateManagement may only be called inside GameProvider. Use useGame instead






Each entry takes a functionName (the function to protect), allowedCallers (the functions permitted to call it), and optionally an alternative to suggest — or a fully custom message. It isn't hook-specific, either: you can use it any time a function has to be exported but is only meant for one caller. And because it's just config, every new context you add is one more entry in the array.






Recap




  1. Put the context, the public consumer hook, and the private state-management hook in one file — Go to Definition on the consumer hook lands on the logic.

  2. Keep the provider a thin shell that calls the private hook and passes the result to Context.Provider.

  3. Throw from the public hook when the context is null, so misplaced components fail loudly.

  4. Enforce the public/private boundary with eslint-plugin-restrict-callers instead of a comment.



The full working example — game and all — is at react-context-boilerplate-example, and the plugin lives at eslint-plugin-restrict-callers. If you've felt this papercut too, I'd love to hear how you've handled it.

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Discussion communautaire et commentaires

🌐 Rejoindre le chat principal

Lancez la discussion dans le flux diffusé du Social Chat ou proposez ci-dessus une contribution experte via le formulaire de complément.

Évaluation communautaire &amp; preuve sociale
⭐ Avis des lecteurs
–
Ø / 5.0
Pas encore d'évaluation des lecteurs
Cet article vous a-t-il été utile ?
0
Donner votre évaluation
Évaluation détaillée (facultatif)
Contenu & qualité
Source & fiabilité
Actualité
Briefing sécurité Gratuit · désabonnement en 1 clic

Intelligence Digest — gratuit

Chaque jour, les principales actualités sécurité · résiliable à tout moment

Groupes d’histoires apparentées & sources (IA vectorielle)

6 Cluster
25 sources
CVE-2026-72227 | Linux Kernel up to 6.12.96/6.18.39/7.1.4/7.2-rc2 batman-adv out-of-bounds (WID-SEC-2026-2852)
VulDB Updates il y a 2 h
24 autres sources
VulDB Updatesil y a 2 hCVE-2026-72228 | Linux Kernel up to 7.2-rc2 batman-adv skb_split memory leak (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72229 | Linux Kernel up to 7.2-rc2 batman-adv register_netdevice memory leak (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72231 | Linux Kernel up to 7.2-rc2 batman-adv batadv_send_tt_request allocation of resources (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72230 | Linux Kernel up to 7.2-rc2 batman-adv batadv_frag_send_packet memory leak (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72232 | Linux Kernel up to 7.2-rc2 batman-adv batadv_interface_tx out-of-bounds (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72234 | Linux Kernel up to 7.2-rc1 batman-adv batadv_get_vid use after free (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72233 | Linux Kernel up to 7.2-rc1 batman-adv batadv_bla_is_backbone_gw use after free (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72236 | Linux Kernel up to 7.2-rc3 s390/perf_cpum_cf __hw_perf_event_init config array index (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72235 | Linux Kernel up to 7.2-rc1 batman-adv batadv_interface_rx use after free (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72237 | Linux Kernel up to 7.2-rc2 BRS /x86/amd/brs amd_brs_match_plm information disclosure (WID-SEC-2026-2852) VulDB Updatesil y a 2 hCVE-2026-72238 | Linux Kernel up to 7.2-rc3 x86 boot early_serial_init integer overflow (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72215 | Linux Kernel up to 7.1.4 Console Output prom_printf stack-based overflow (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72216 | Linux Kernel up to 6.6.144/6.12.96/6.18.39/7.1.4 remoteproc qcom_add_minidump_segments allocation of resources (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72218 | Linux Kernel up to 7.1.4 lockd nlm_do_fopen reference count (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72217 | Linux Kernel up to 6.6.144/6.12.96/6.18.39/7.1.4 SUNRPC xdr_buf_to_bvec out-of-bounds (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72220 | Linux Kernel up to 6.18.39/7.1.4 sunrpc svc_release_rqst use after free (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72219 | Linux Kernel up to 7.1.4 lockd nlm_do_fopen allocation of resources (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72223 | Linux Kernel up to 7.1.4 nvdimm/btt drivers/nvdimm/btt.c discover_arenas memory leak (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72224 | Linux Kernel up to 7.1.4 nvdimm/btt drivers/nvdimm/btt.c btt_init memory leak (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72225 | Linux Kernel up to 7.1.4 jbd2 jbd2_journal_initialize_fast_commit num_fc_blks integer underflow (Nessus ID 335741 / WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-72226 | Linux Kernel up to 7.2-rc2 batman-adv out-of-bounds (WID-SEC-2026-2852) VulDB Updatesil y a 3 hCVE-2026-138368 | lwext4 up to 1.0.0 src/ext4_dir_idx.c ext4_dir_dx_checksum out-of-bounds (EUVD-2026-137767) VulDB Updatesil y a 3 hCVE-2026-138370 | gkostka lwext4 up to 1.0.0 src/ext4_fs.c ext4_fs_mark_bitmap_end out-of-bounds write (EUVD-2026-137769) VulDB Updatesil y a 3 hCVE-2026-138369 | lwext4 up to 1.0.0 src/ext4_fs.c ext4_fs_init_block_bitmap out-of-bounds write (EUVD-2026-137768)
Articles similaires
🔍 Verwandte News

Auch interessante Nachrichten How To Set Up React Context

Thematisch verwandte Begriffe: React, Context · 6 Treffer

Laden...

Chargement des vidéos ...

Laden...

Chargement des articles ...

Laden...

Chargement des vidéos ...

Laden...

Chargement des articles ...

Laden...

Chargement des vidéos ...

💬 Chargement des commentaires…
Sentinel CTI: ONLINE
Tirer pour actualiser
Widgets & Topics
Loading widgets…
Nächster Beitrag