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.
A simple CLI for making HTML files from EJS templates.
npm i -D ejs2html
Usage: ejs2html [options] <config> [dest]
Options:
-h, --help output usage information
-V, --version output the version number
Everything runs off of the config file. It looks something like this.
{
"files": [
{
"dest": "index.html",
"template": "layout",
"locals": {
"title": "Home",
"message": "Welcome to my app."
}
},
{
"dest": "about/index.html",
"template": "layout.ejs",
"locals": {
"title": "About",
"message": "This is the about page."
}
}
],
"globals": {
"app_name": "My App"
}
}
At the root level of the config should be:
Each file object inside of files
should include:
dest
param from the command line.[cli-dest]/[file-dest][.html]
..html
extension is optional_"src/ejs/config.json"
{
"files": [
{
"dest": "index.html",
"template": "layout",
"locals": {
"title": "Home",
"message": "Welcome to my app."
}
}
],
"globals": {
"app_name": "My App"
}
}
_"src/ejs/layout.ejs"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= app_name %></title>
</head>
<body>
<h1><%= title %></h1>
<p><%= message %></p>
</body>
</html>
Running...
ejs2html _src/ejs/config.json
Yields...
"index.html"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My App</title>
</head>
<body>
<h1>Home</h1>
<p>Welcome to my app.</p>
</body>
</html>
===
_"src/ejs/partials/header.ejs"
<h1><%= title %></h1>
_"src/ejs/partials/body.ejs"
<p><%= message %></p>
_"src/ejs/layout.ejs"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= app_name %></title>
</head>
<body>
<%- include('partials/header') %>
<%- include('partials/body') %>
</body>
</html>
Running the following with same config as above would yield the same result as the previous example...
ejs2html _src/ejs/config.json
===
_"src/ejs/config.json"
{
"files": [
{
"dest": "index.html",
"template": "layout",
"locals": {
"title": "Home",
"message": "Welcome to my app."
}
},
{
"dest": "about/index.html",
"template": "layout",
"locals": {
"title": "About",
"message": "This is the about page."
}
}
],
"globals": {
"app_name": "My App"
}
}
_"src/ejs/layout.ejs"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= app_name %></title>
</head>
<body>
<h1><%= title %></h1>
<p><%= message %></p>
</body>
</html>
Running...
ejs2html _src/ejs/config.json
Yields...
"index.html"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My App</title>
</head>
<body>
<h1>Home</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum, excepturi.</p>
</body>
</html>
"about/index.html"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My App</title>
</head>
<body>
<h1>About</h1>
<p>This is the about page.</p>
</body>
</html>
npm run sample
Runs some example stuff inside of /example
.
FAQs
A simple CLI for making HTML files from EJS templates.
The npm package ejs2html receives a total of 69 weekly downloads. As such, ejs2html popularity was classified as not popular.
We found that ejs2html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.