Language: TypeScript
Label: vulnerable
CWE: CWE-269 \u2014 Improper Privilege Management
The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.

Code:
const AuthContainer = ({ children }) => {
    const dispatch = useDispatch();
    const config = useSelector((state) => state.config)
    const { user, authStatus } = useAuthenticator((context) => [context.user, context.authStatus]);

    useEffect(() => {
        applyMode(Mode[config.DISPLAY_THEME])
        applyDensity(Density[config.DISPLAY_TEXT_MODE])
    },[config])

    useEffect(() => {
        if (authStatus === "authenticated") {
            dispatch(setCurrentUser(user));
            dispatch(fetchConfig());
        }
    }, [dispatch, user, authStatus]);

    return children;
};