New to Kestra?
Use blueprints to kickstart your first workflows.
Audits NPM package dependencies to detect typosquatting impostor packages and prevent malicious software supply-chain compromises.
Software supply-chain attacks increasingly rely on typosquatting, where attackers publish malicious packages with names nearly identical to popular libraries (such as loadash for lodash or expres for express). When developers make a typing error during package installation or automated dependency updates pull in malicious clones, unauthorized code executes inside build pipelines or production servers. This sentinel continuously parses application package manifests, computes string edit distances against popular open-source libraries, and alerts Application Security teams on Slack before malicious dependencies reach production.
0 6 * * *) or triggers via CI/CD commit webhooks.package.json manifest via HTTP GET requests using optional repository authentication headers.dependencies and devDependencies into a consolidated package catalog.io.kestra.plugin.core.flow.If task evaluates whether suspicious_packages_count exceeds max_tolerated_suspicious_packages.SlackIncomingWebhook listing flagged dependencies and target libraries.flowchart TD
A[daily_dependency_audit Schedule Trigger] --> B[scan_npm_dependencies Python Script]
B --> C[check_typosquat_findings Flowable If]
C -- Typosquats Flagged --> D[notify_slack_appsec Webhook]
C -- Safe Dependencies --> E[log_typosquat_audit Log]
D --> E
E --> F[export_typosquat_manifest Return]
package.json to reject PRs introducing suspicious libraries.| Name | Type | Default | Description |
|---|---|---|---|
package_json_url |
STRING |
https://raw.githubusercontent.com/company/repo/main/package.json |
URL pointing to the raw package.json manifest to inspect for suspicious dependencies. |
levenshtein_distance_threshold |
INT |
1 |
Levenshtein distance threshold for flagging near-identical package names against popular libraries. |
alert_on_typosquat_risk |
BOOL |
true |
Whether to dispatch alerts when suspected impostor package dependencies are detected. |
max_tolerated_suspicious_packages |
INT |
0 |
Maximum permissible suspicious package count before triggering high-severity alerts. |
{{ outputs.scan_npm_dependencies.vars.total_dependencies_scanned }}: Total number of dependencies analyzed in the manifest.{{ outputs.scan_npm_dependencies.vars.suspicious_packages_count }}: Count of flagged packages matching popular libraries within the distance threshold.{{ outputs.scan_npm_dependencies.vars.suspicious_packages_details }}: Serialized JSON list of flagged dependencies and target libraries.{{ outputs.export_typosquat_manifest.value }}: Structured dictionary containing the consolidated security audit report.GITHUB_READ_TOKEN: Personal access token with read permissions to private repository contents.SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL used for sending security alerts.GITHUB_READ_TOKEN and SLACK_WEBHOOK_URL in your Kestra Secret storage.company.security namespace.package_json_url to point to a target repository's raw package.json.@types/lodash or @angular/core) contain slashes and scope prefixes. Ensure edit distance calculations evaluate root package names appropriately.api.github.com/repos/{owner}/{repo}/contents/package.json) with an Authorization header.https://registry.npmjs.org/{pkg}) to check package age and weekly download counts; typosquats typically have low downloads and recent publish dates.package.json files via a Kestra ForEach task.