
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
safelinkify
Advanced tools
NodeJS anonymizer external links into outbound page. Anonymize external links to outbound page redirector for SEO.
Customized safelink url redirector. Transform and Anonymize all hyperlinks to outbound pages. Useful for SEO external links and ADS.
| page | source | samples |
|---|---|---|
| /page/safelink.html | safelink-decode.js layout template compiler | /page/safelink.html?url=aHR0cHM6Ly... |
| registry | link | commands |
|---|---|---|
| npm | https://www.npmjs.com/package/safelinkify | npm i safelinkify -D |
| github | https://github.com/dimaslanjaka/safelink | npm i https://github.com/dimaslanjaka/safelink -D |
| tarball | https://github.com/dimaslanjaka/safelink/raw/master/release/safelinkify.tgz | npm i https://github.com/dimaslanjaka/safelink/raw/master/release/safelinkify.tgz -D |
npm install safelinkify -D
yarn add safelinkify --dev
git clone --single-branch --branch main https://github.com/dimaslanjaka/safelink foldername
cd foldername
yarn install # or npm install
| Command | Description |
|---|---|
yarn start | Serve generated docs |
yarn dev | Watch and build docs |
yarn run docs | Build docs |
yarn run build | Build dist |
const options = {
// Exclude patterns (do not anonymize these patterns)
exclude: [
'domain.com',
/another.domain.com/,
/https?:\/\/?([^*]+)\.)?webmanajemen\.com/,
/([a-z0-9](?:[a-z0-9-]{1,61}[a-z0-9])?[.])*webmanajemen\.com/
],
// URL redirector
redirect: 'https://www.webmanajemen.com/page/safelink.html?url=',
// Debug
verbose: false,
// Encryption type: 'base64' | 'aes'
type: 'base64',
// Password for AES (default: 'root')
password: 'unique-password'
};
Script location: node_modules/safelinkify/dist/bundle.min.js
Include the script:
<script src="dist/bundle.min.js"></script>
<!-- or use CDN -->
<script src="https://raw.githack.com/dimaslanjaka/safelink/main/dist/bundle.min.js"></script>
<script src="https://cdn.statically.io/gh/dimaslanjaka/safelink/main/dist/bundle.min.js"></script>
Usage example:
<script>
const sf = new safelink(options);
// Automatically safelinkify all hyperlinks in body
sf.parse(document.querySelector('body')).then((result) => {
console.log(result);
// In-page redirector
sf.resolveQueryUrl(window.location.href);
});
</script>
import * as safelink from 'safelinkify/browser_module';
const sf = new safelinkify.safelink(options);
const processedExternalLinks = sf.parse(`
<a href="www.example.com/page.php?id=xxxx&name=yyyy">external</a>
<a href="http://www.example.com/page.php?id=xxxx&name=yyyy">external</a>
<a href="https://www.example.com/page.php?id=xxxx&name=yyyy">external</a>
<a href="www.example.com/page.php/404"></a>
<a href="http://external.domain.com">internal</a>
<a href="http://www.webmanajemen.com">internal</a>
<a href="http://webmanajemen.com">internal</a>
<a href="#http://webmanajemen.com">#internal</a>
<a href="?http://webmanajemen.com">?internal</a>
<a href="">internal</a>
`);
processedExternalLinks.then(console.log);
const { safelink } = require('safelinkify');
// or
const { default: safelink } = require('safelinkify/dist/safelink');
import safelinkify from 'safelinkify';
// const safelinkify = require('safelinkify');
const sf = new safelinkify.safelink(options);
const processedExternalLinks = sf.parse(`
<a href="www.example.com/page.php?id=xxxx&name=yyyy">external</a>
<a href="http://www.example.com/page.php?id=xxxx&name=yyyy">external</a>
<a href="https://www.example.com/page.php?id=xxxx&name=yyyy">external</a>
<a href="www.example.com/page.php/404"></a>
<a href="http://external.domain.com">internal</a>
<a href="http://www.webmanajemen.com">internal</a>
<a href="http://webmanajemen.com">internal</a>
<a href="#http://webmanajemen.com">#internal</a>
<a href="?http://webmanajemen.com">?internal</a>
<a href="">internal</a>
`);
processedExternalLinks.then(console.log);
Result:
<a href="www.example.com/page.php?id=xxxx&name=yyyy">external</a>
<a href="https://www.webmanajemen.com/page/safelink.html?url=aHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLnBocD9pZD14eHh4Jm5hbWU9eXl5eQ==">external</a>
<a href="https://www.webmanajemen.com/page/safelink.html?url=aHR0cHM6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS5waHA/aWQ9eHh4eCZuYW1lPXl5eXk=">external</a>
<a href="www.example.com/page.php/404"></a>
<a href="http://external.domain.com">internal</a>
<a href="http://www.webmanajemen.com">internal</a>
<a href="http://webmanajemen.com">internal</a>
<a href="#http://webmanajemen.com">#internal</a>
<a href="?http://webmanajemen.com">?internal</a>
<a href="">internal</a>
Reference: Gulp safelink task
import gulp from 'gulp';
import sf from 'safelinkify';
import { toUnix, join } from 'upath';
import through2 from 'through2';
const destDir = join(__dirname, 'build');
gulp.task('safelink', () => {
const safelink = new sf.safelink({
exclude: [
/https?:\/\/?([^*]+)\.)?webmanajemen\.com/,
/([a-z0-9](?:[a-z0-9-]{1,61}[a-z0-9])?[.])*webmanajemen\.com/
],
redirect: 'https://www.webmanajemen.com/page/safelink.html?url=',
verbose: false,
type: 'base64',
password: 'unique-password'
});
return gulp
.src(['**/*.html'], {
cwd: destDir,
ignore: [
'**/tmp/**',
'**/node_modules/**',
'**/monsters/**/*',
'**/attendants/**/*',
'**/materials/**/*',
'**/scenic-spots/**/*',
'**/static/**/*'
]
})
.pipe(
through2.obj(async (file, _enc, next) => {
if (file.isNull()) return next();
const content = String(file.contents);
const parsed = await safelink.parse(content);
if (parsed) {
file.contents = Buffer.from(parsed);
next(null, file);
} else {
console.log('cannot parse', toUnix(file.path).replace(toUnix(process.cwd()), ''));
next();
}
})
)
.pipe(gulp.dest(destDir));
});
FAQs
NodeJS anonymizer external links into outbound page. Anonymize external links to outbound page redirector for SEO.
The npm package safelinkify receives a total of 219 weekly downloads. As such, safelinkify popularity was classified as not popular.
We found that safelinkify demonstrated a healthy version release cadence and project activity because the last version was released less than 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
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.