Socket
Socket
Sign inDemoInstall

eslint-plugin-anti-trojan-source

Package Overview
Dependencies
84
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

2

dist/index.js

@@ -1,1 +0,1 @@

var n=Object.create;var r=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var s=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var l=t=>r(t,"__esModule",{value:!0});var m=(t,o,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of d(o))!f.call(t,e)&&e!=="default"&&r(t,e,{get:()=>o[e],enumerable:!(i=c(o,e))||i.enumerable});return t},h=t=>m(l(r(t!=null?n(s(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var a=h(require("anti-trojan-source"));function u(t){return{onCodePathStart:function(o,i){i.tokens.forEach(e=>{e.value&&(0,a.hasTrojanSource)({sourceText:e.value})&&t.report({node:i,data:{text:e.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this code: '{{text}}'."})}),i.comments.forEach(e=>{e.value&&(0,a.hasTrojanSource)({sourceText:e.value})&&t.report({node:i,data:{text:e.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this comment: '{{text}}'."})})}}}module.exports={rules:{"no-bidi":{create:u}}};
var u=Object.create;var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var f=t=>o(t,"__esModule",{value:!0});var l=(t,i,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of c(i))!m.call(t,r)&&r!=="default"&&o(t,r,{get:()=>i[r],enumerable:!(e=n(i,r))||e.enumerable});return t},h=t=>l(f(o(t!=null?u(d(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var a=h(require("anti-trojan-source"));function s(t){return{onCodePathStart:function(i,e){e.tokens&&Array.isArray(e.tokens)&&e.tokens.forEach(r=>{r.value&&(0,a.hasTrojanSource)({sourceText:r.value})&&t.report({node:e,data:{text:r.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this code: '{{text}}'."})}),e.comments&&Array.isArray(e.comments)&&e.comments.forEach(r=>{r.value&&(0,a.hasTrojanSource)({sourceText:r.value})&&t.report({node:e,data:{text:r.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this comment: '{{text}}'."})})}}}module.exports={rules:{"no-bidi":{create:s}}};

@@ -1,1 +0,1 @@

var n=Object.create;var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var s=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var u=t=>i(t,"__esModule",{value:!0});var h=(t,a)=>{u(t);for(var o in a)i(t,o,{get:a[o],enumerable:!0})},l=(t,a,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of d(a))!f.call(t,e)&&e!=="default"&&i(t,e,{get:()=>a[e],enumerable:!(o=c(a,e))||o.enumerable});return t},m=t=>l(u(i(t!=null?n(s(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);h(exports,{noBidi:()=>p});var r=m(require("anti-trojan-source"));function p(t){return{onCodePathStart:function(a,o){o.tokens.forEach(e=>{e.value&&(0,r.hasTrojanSource)({sourceText:e.value})&&t.report({node:o,data:{text:e.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this code: '{{text}}'."})}),o.comments.forEach(e=>{e.value&&(0,r.hasTrojanSource)({sourceText:e.value})&&t.report({node:o,data:{text:e.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this comment: '{{text}}'."})})}}}0&&(module.exports={noBidi});
var s=Object.create;var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var u=t=>i(t,"__esModule",{value:!0});var f=(t,a)=>{u(t);for(var e in a)i(t,e,{get:a[e],enumerable:!0})},h=(t,a,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of n(a))!d.call(t,r)&&r!=="default"&&i(t,r,{get:()=>a[r],enumerable:!(e=c(a,r))||e.enumerable});return t},l=t=>h(u(i(t!=null?s(m(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);f(exports,{noBidi:()=>p});var o=l(require("anti-trojan-source"));function p(t){return{onCodePathStart:function(a,e){e.tokens&&Array.isArray(e.tokens)&&e.tokens.forEach(r=>{r.value&&(0,o.hasTrojanSource)({sourceText:r.value})&&t.report({node:e,data:{text:r.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this code: '{{text}}'."})}),e.comments&&Array.isArray(e.comments)&&e.comments.forEach(r=>{r.value&&(0,o.hasTrojanSource)({sourceText:r.value})&&t.report({node:e,data:{text:r.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this comment: '{{text}}'."})})}}}0&&(module.exports={noBidi});
{
"name": "eslint-plugin-anti-trojan-source",
"version": "1.0.0",
"version": "1.0.1",
"description": "ESLint plugin to detect and stop Trojan Source attacks",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -7,35 +7,39 @@ import { hasTrojanSource } from "anti-trojan-source";

// at the start of analyzing a code path
node.tokens.forEach((tokenObject) => {
if (
tokenObject.value &&
hasTrojanSource({ sourceText: tokenObject.value })
) {
context.report({
node: node,
data: {
text: tokenObject.value.toString("utf-8"),
},
message:
"Detected potential trojan source attack with unicode bidi introduced in this code: '{{text}}'.",
});
}
});
if (node.tokens && Array.isArray(node.tokens)) {
node.tokens.forEach((tokenObject) => {
if (
tokenObject.value &&
hasTrojanSource({ sourceText: tokenObject.value })
) {
context.report({
node: node,
data: {
text: tokenObject.value.toString("utf-8"),
},
message:
"Detected potential trojan source attack with unicode bidi introduced in this code: '{{text}}'.",
});
}
});
}
node.comments.forEach((tokenObject) => {
if (
tokenObject.value &&
hasTrojanSource({ sourceText: tokenObject.value })
) {
context.report({
node: node,
data: {
text: tokenObject.value.toString("utf-8"),
},
message:
"Detected potential trojan source attack with unicode bidi introduced in this comment: '{{text}}'.",
});
}
});
if (node.comments && Array.isArray(node.comments)) {
node.comments.forEach((tokenObject) => {
if (
tokenObject.value &&
hasTrojanSource({ sourceText: tokenObject.value })
) {
context.report({
node: node,
data: {
text: tokenObject.value.toString("utf-8"),
},
message:
"Detected potential trojan source attack with unicode bidi introduced in this comment: '{{text}}'.",
});
}
});
}
},
};
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc