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.
Convert plain HTML to Google AMP (Accelerated Mobile Pages)
npm install ampify --save
const ampify = require('ampify');
const html = '<YOUR_HTML_CONTENT>';
const amp = ampify(html, {cwd: 'amp'});
console.log(amp); // Content of AMP HTML
String
''
String
true
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<img src="image.png">
</html>
body {
background-color: #fff;
}
<html amp="">
<head>
<style amp-custom="">body{background-color:#fff}</style>
</head>
<amp-img src="image.png" width="600" height="400"></amp-img>
</html>
See /examples
folder for full source code.
const ampify = require('ampify');
const express = require('express');
const app = express();
app.get('/article', (req, res) => {
const html = `
<html>
<head>
<title>AMP page</title>
</head>
<body>
<div>
<p>This is an AMP article</p>
</div>
</body>
</html>
`;
const amp = ampify(html, {cwd: 'amp'});
res.send(amp); // serving AMP content
});
app.listen(3000, () => {
console.log('Listening on port 3000!');
});
const ampify = require('ampify');
const express = require('express');
const app = express();
app.use((req, res, next) => {
if (req.url.startsWith('/amp')) {
const send = res.send;
res.send = function (html) {
const amp = ampify(html, {cwd: 'amp'});
send.call(this, amp);
};
}
next();
});
app.get('/amp/article', (req, res) => {
const html = `
<html>
<head>
<title>AMP page</title>
</head>
<body>
<div>
<p>This is AMP article</p>
</div>
</body>
</html>
`;
res.send(html);
});
app.get('/article', (req, res) => {
const html = `
<html>
<head>
<title>HMTL page</title>
</head>
<body>
<div>
<p>This is HTML article</p>
</div>
</body>
</html>
`;
res.send(html);
});
app.listen(3000, () => {
console.log('Listening on port 3000!');
});
MIT (c) Ruslan Kazakov and contributors
FAQs
Convert plain HTML to Google Accelerated Mobile Pages (AMP)
The npm package ampify receives a total of 881 weekly downloads. As such, ampify popularity was classified as not popular.
We found that ampify 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.