Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@lightbase/next-preset
Advanced tools
An easy to use preset for Next.js projects at Lightbase
The following page extensions are configured by next-preset:
api.ts
, page.tsx
This means that _app.tsx
becomes _app.page.tsx
, _document.tsx
becomes _document.page.tsx
, etc.
This configuration allows the placement of component files in the /pages
directory, for storing local components with the page they're used on, without them becoming available as a route.
...
├── ...
├── src
│ ├── pages
│ │ ├── about-us
│ │ │ ├── components
│ │ │ │ └── Employee.tsx 👈 The component
│ │ │ └── index.page.tsx 👈 The page
├── ...
These headers are configured by default, because they're considered good security practice.
You can overwrite these headers by setting the header yourself in next.config.js
.
Header | Value |
---|---|
x-frame-options | deny |
content-security-policy. | frame-ancestors 'none' |
x-content-type-options | nosniff |
Referrer-Policy | same-origin |
Strict-Transport-Security | max-age=31536000 |
Permissions-Policy | interest-cohort=() |
When next-preset is used, a check is run on next build
to make sure that the output does not contain any non-ES5 JavaScript code. This is done so your app does not unexpectedly break in certain browsers.
When offending output is found, the build fails and you're notified.
[PRESET] Checking browser compatibility...
[PRESET]
You might want to add the following entries to `preset.transpileModules` in `next.config.js`:
- yup
For more information, see: https://github.com/martpie/next-transpile-modules
Most modules can be transpiled. Modules that can't be transpiled can be ignored. Be sure to check if the module can be safely ignored or if you need to take additional steps per the modules' instructions.
next-transpile-modules is included and configured by next-preset.
Modules to be transpiled can be added by setting the preset.transpileModules
option in next.config.js
.
const { withPreset } = require("@lightbase/next-preset");
module.exports = withPreset({
...
preset: {
transpileModules: [
"yup",
"dequal",
],
...
},
...
});
Some modules produce non-ES5 code and cannot be transpiled, e.g. Mapbox-GL. Usually the module does not support older browsers, so it does not make sense for them to transpile to ES5 or support it.
Modules to be ignored can be added by setting the preset.ignoreModules
option in next.config.js
.
const { withPreset } = require("@lightbase/next-preset");
module.exports = withPreset({
...
preset: {
ignoreModules: ["mapbox-gl"],
...
},
...
});
In order for the browser compatibility check to function, source maps are enabled and will be available alongside your app.
If you're using @sentry/nextjs, source maps are already enabled.
FAQs
An easy to use preset for Next.js projects at Lightbase
The npm package @lightbase/next-preset receives a total of 0 weekly downloads. As such, @lightbase/next-preset popularity was classified as not popular.
We found that @lightbase/next-preset demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.