Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
detective-scss
Advanced tools
The detective-scss npm package is designed for analyzing SCSS (Sassy CSS) files to find and extract import statements. This can be particularly useful in build tools and bundlers that need to understand dependencies between SCSS files to correctly assemble them. It parses SCSS content and returns an array of strings, each representing an import found within the file.
Extract import statements from SCSS content
This feature allows you to pass SCSS content as a string to the detective function, which then returns an array of the import paths found within that content. It's useful for dependency resolution and bundling processes.
const detective = require('detective-scss');
const content = `$importedVar: #123;
@import 'another-file';
body { color: $importedVar; }`;
const imports = detective(content);
// imports would be ['another-file']
postcss-import is a PostCSS plugin to transform @import rules by inlining content. It differs from detective-scss by not only detecting imports but also inlining them as part of the PostCSS processing pipeline, making it more suited for direct use in CSS build processes.
node-sass-import is a tool for resolving import statements in SCSS files similar to detective-scss. However, it is specifically tailored for use with the Node.js bindings of libsass (node-sass), offering a more integrated experience for users of that library.
Find the dependencies of an scss file
npm install detective-scss
Note: This is specific to the .scss style syntax of the Sass preprocessor. For Sass support, please see node-detective-sass.
It's the SASS counterpart to detective, detective-amd, and detective-es6.
const fs = require('fs');
const detective = require('detective-scss');
const content = fs.readFileSync('styles.scss', 'utf8');
// list of imported file names (ex: '_foo.scss', '_foo', etc)
const dependencies = detective(content);
// or to also detect any url() references to images, fonts, etc.
const allDependencies = detective(content, { url: true });
url
(optional): (Boolean
) also detect any url()
references to images, fonts, etc.FAQs
Find the dependencies of an scss file
The npm package detective-scss receives a total of 1,137,358 weekly downloads. As such, detective-scss popularity was classified as popular.
We found that detective-scss demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.