
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
@antdp/authorized
Advanced tools
通过判断是否进入主界面还是登录界面。
npm i @antdp/authorized --save
import React from 'react';
import BasicLayout from '@antdp/basic-layouts';
import UserLogin from '@antdp/user-login';
import Authorized from '@antdp/authorized';
// 入口页面
const UserLayout = (props) => {
return (
<Authorized authority={!props.token} redirectPath="/login">
<UserLogin />
</Authorized>
)
};
// 登录页面
const Layout = (props) => {
return (
<Authorized authority={!props.token} redirectPath="/">
<BasicLayout />
</Authorized>
)
};
interface AuthorizedProps {
/**
* 准入权限/权限判断
*/
authority?: boolean;
/**
* 权限异常时重定向的页面路由
*/
redirectPath?: string;
children?: React.ReactNode;
}
/**
* @description: 页面权限
* @param {Array} menuRouter 原始 routes.json 文件中路由
* @param {string} path 当前路径
* @return {*}
*/
type GetAuthorizedPageProps = (menuRouter: Array<any>, path: string) => boolean
// 按钮权限
interface AuthorizedBtnProps {
// 权限路径
path?: string,
// 展示内容
children?: React.ReactNode
}
FAQs
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
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.