
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@ag.common/app-layout
Advanced tools
Common application shell for apps in the user-facing authenticated space of the Export Service
Common application shell for apps in the user-facing authenticated space of the Export Service
yarn add @ag.common/app-layout
import { AppLayout } from '@ag.common/app-layout';
import { useAuthentication } from '@ag.common/auth';
import { useBusinessDetails } from '@ag.common/auth';
import { useRouter } from 'next/router';
function App() {
const router = useRouter();
const businessDetails = useBusinessDetails();
return (
<AppLayout activePath={router.asPath} businessDetails={businessDetails}>
<YourApplication />
</AppLayout>
);
}
It may make sense for your application to start from its root when a user changes context.
import { AppLayout } from '@ag.common/app-layout';
import { useAuthentication } from '@ag.common/auth';
import { useBusinessDetails } from '@ag.common/auth';
import { useRouter } from 'next/router';
function App() {
const router = useRouter();
const businessDetails = useBusinessDetails();
const onBusinessSelected = (business: Business) => {
businessDetails.setSelectedBusiness(business);
router.push('/your-app-base-path-here');
};
return (
<AppLayout
activePath={router.asPath}
businessDetails={{
...businessDetails,
setSelectedBusiness: onBusinessSelected,
}}
>
<YourApplication />
</AppLayout>
);
}
You may want to interrupt a user before allowing them to change their selected business if they have pending changes.
import { AppLayout } from '@ag.common/app-layout';
import { useAuthentication } from '@ag.common/auth';
import { useBusinessDetails } from '@ag.common/auth';
import { useRouter } from 'next/router';
function App() {
const router = useRouter();
const businessDetails = useBusinessDetails();
const [targetBusiness, setTargetBusiness] = useState<Business | undefined>();
return (
<AppLayout
activePath={router.asPath}
businessDetails={{
...businessDetails,
setSelectedBusiness: (business: Business) => {
setTargetBusiness(business);
},
}}
>
<Modal
isOpen={targetBusiness !== undefined}
onClose={setTargetBusiness(undefined)}
title="Are you sure you want to leave this page?"
actions={
<ButtonGroup>
<Button
onClick={() => {
businessDetails.setSelectedBusiness(targetBusiness);
setTargetBusiness(undefined);
}}
>
Leave this page
</Button>
<Button variant="secondary" onClick={setTargetBusiness(undefined)}>
Stay on this page
</Button>
</ButtonGroup>
}
>
<Text as="p">You will lose all changes made since your last save.</Text>
</Modal>
<YourApplication />
</AppLayout>
);
}
Your app may not handle single-named users. If you want to block these users from your app, pass through the auth claims and the app layout will display a helpful message instead.
import { AppLayout } from '@ag.common/app-layout';
import { authService } from '@ag.common/auth';
import { useRouter } from 'next/router';
function App() {
const router = useRouter();
const claims = authService.getAccountInfo()?.idTokenClaims;
return (
<AppLayout activePath={router.asPath} claims={claims}>
<YourApplication />
</AppLayout>
);
}
You can provide your own error message or handle analytics by providing a component that overrides the default.
import { AppLayout } from '@ag.common/app-layout';
import { authService } from '@ag.common/auth';
import { useRouter } from 'next/router';
function App() {
const router = useRouter();
const claims = authService.getAccountInfo()?.idTokenClaims;
return (
<AppLayout
activePath={router.asPath}
claims={claims}
errorComponents={{
MissingGivenName: (props) => (
<Fragment>
<p>everything is fine, actually</p>
{props.children}
</Fragment>
),
}}
>
<YourApplication />
</AppLayout>
);
}
FAQs
Common application shell for apps in the user-facing authenticated space of the Export Service
The npm package @ag.common/app-layout receives a total of 69 weekly downloads. As such, @ag.common/app-layout popularity was classified as not popular.
We found that @ag.common/app-layout demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.