Language: TypeScript
Label: vulnerable
CWE: CWE-284 \u2014 Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized 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;
};