
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
unclosed-tag-finder
Advanced tools
A library to find unclosed html5 tags, that are normally optional.
A library that finds unclosed html5 tags that are normally optional (via W3C check). These optional tags could be:
user$ npm install unclosed-tag-finder -g
user$ vi valid-utf8-unclosed.html
<!DOCTYPE html>
<html>
<head>
<title>Das sind Umlaute: öäü</title>
</head>
<body>
<p
class="test"
>Das ist ein Test.<br />
<p>äöü
<ul>
<li>123
</ul>
</body>
</html>
user$ npm install html-validator-cli -g
user$ html-validator --file=valid-utf8-unclosed.html
Page is valid
or
user$ xmllint --html --noout valid-utf8-unclosed.html
The page is valid.
user$ unclosed-tag-finder valid-utf8-unclosed.html
valid-utf8-unclosed.html:7 (missing close tag: <p/>)
opening tag: <p
class="test"
>
valid-utf8-unclosed.html:10 (missing close tag: <p/>)
opening tag: <p>
valid-utf8-unclosed.html:12 (missing close tag: <li/>)
opening tag: <li>
Although the html file is valid, we found some unclosed html5 tags.
#!/usr/bin/env node
/* load some libraries */
var unclosedTagFinder = require('unclosed-tag-finder');
var fs = require('fs');
var finder = new unclosedTagFinder.builder();
/* check command line arguments */
if (process.argv.length < 3) {
console.error('No file to validate was given. Abort..');
process.exit(1);
}
/* read given file */
fs.readFile(process.argv[2], 'utf-8', function(err, html) {
if (err) {
console.log(err);
process.exit(1);
return;
}
var unclosedTags = finder.getUnclosedTags(html, process.argv[2]);
if (unclosedTags.length == 0) {
return;
}
/* prints out missing close tag issues */
for (var i = 0; i < unclosedTags.length; i++) {
if (unclosedTags[i].hasNoCloseTag) {
console.info(unclosedTags[i].filename + ':' + unclosedTags[i].line + ' (missing close tag: <' + unclosedTags[i].name + '/>)');
console.info(unclosedTags[i].tag);
console.info('');
}
}
/* prints out missing open tag issues */
for (var i = 0; i < unclosedTags.length; i++) {
if (unclosedTags[i].hasNoOpenTag) {
console.info(unclosedTags[i].filename + ':' + unclosedTags[i].line + ' (missing open tag: <' + unclosedTags[i].name + '>)');
console.info(unclosedTags[i].tag);
console.info('');
}
}
});
user$ chmod 775 listUnclosedTags.js
Now check the file with the listUnclosedTags.js script:
user$ ./listUnclosedTags.js valid-utf8-unclosed.html
valid-utf8-unclosed.html:7 (missing close tag: <p/>)
opening tag: <p
class="test"
>
valid-utf8-unclosed.html:10 (missing close tag: <p/>)
opening tag: <p>
valid-utf8-unclosed.html:12 (missing close tag: <li/>)
opening tag: <li>
You will find more informations and the source code at GitHub.
For an executable npm package please have a look at npmjs.com.
ISC © Björn Hempel
FAQs
A library to find unclosed html5 tags, that are normally optional.
The npm package unclosed-tag-finder receives a total of 150 weekly downloads. As such, unclosed-tag-finder popularity was classified as not popular.
We found that unclosed-tag-finder 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.