
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
@constellation4sitecore/security
Advanced tools
A collection of XM Cloud compatible libraries for SXA Sitecore Development.
Add NPM
npm i @constellation4sitecore/security --save
Serialize Items
npm@constellation4sitecore/security
Add CSP Middleware Plugin under lib/middleware/plugins/csp.ts
import { NextRequest, NextResponse } from 'next/server';
import { MiddlewarePlugin } from '..';
import { CSPMiddleware } from '@constellation4sitecore/security/middleware';
import { siteResolver } from 'lib/site-resolver';
import clientFactory from 'lib/graphql-client-factory';
class ContentSecurityPolicyPlugin implements MiddlewarePlugin {
private cspMiddleware: CSPMiddleware;
order = 2;
constructor() {
this.cspMiddleware = new CSPMiddleware({
clientFactory,
siteResolver,
cacheEnabled: true,
cacheTimeout: 86400, // Cache
disabled: () => process.env.NODE_ENV === 'development',
});
}
/**
* exec async method - to find coincidence in url.pathname and redirects of site
* @param req<NextRequest>
* @returns Promise<NextResponse>
*/
async exec(req: NextRequest, res?: NextResponse): Promise<NextResponse> {
return this.cspMiddleware.getHandler()(req, res);
}
}
export const cspPlugin = new ContentSecurityPolicyPlugin();
Create a report under pages/api/cspreports.ts
import type { NextApiRequest, NextApiResponse } from 'next';
import debuggers from '../../debug';
const cspReportsApi = async (req: NextApiRequest, res: NextApiResponse): Promise<void> => {
res.setHeader('Content-Type', 'text/plain');
debuggers.csp('CSP Report:', req.body);
return res.status(200).send({ success: true });
};
export default cspReportsApi;
Add Rewrite plugin lib/next-config/plugins/csreports.js
/**
* @param {import('next').NextConfig} nextConfig
*/
const cspReportsPlugin = (nextConfig = {}) => {
return Object.assign({}, nextConfig, {
async rewrites() {
return [
...(await nextConfig.rewrites()),
// cspReports route
{
source: '/cspreports.xml',
destination: '/api/cspreports',
},
];
},
});
};
module.exports = cspReportsPlugin;
Remove cspreports.xml from Edge middleware. add cspreports.xml to the matcher array in middleware.ts
In order to use next/cache which is not stable yet. Set the following env variable
CONSTELLATION_NEXT_CACHE_ENABLED=true
FAQs
A collection of XM Cloud compatible libraries for SXA Sitecore Development.
The npm package @constellation4sitecore/security receives a total of 37 weekly downloads. As such, @constellation4sitecore/security popularity was classified as not popular.
We found that @constellation4sitecore/security demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.