@rom13/protector

1.32.0 • Public • Published

Protector JS (Node)

🦍

Protector est un scanner d'objet

return : true / false ou Complexité trop élevé (cas d'un objet trop complexe).

Il vérifie si les String dans vos objets contiennent des charactères spéciaux qui peuvent créer un risque de sécurité.

Requis : nodeJs

Installation :

Dans votre terminal tapez ceci :

npm install @rom13/protector

Dans votre app importez protector :

const { Protector } = require("@rom13/protector");

Création d'un protector :

const protector = new Protector();

Protector.isprotek()

EXEMPLE: Créons un objet à examiner et verifions avec isprotek() le rapport.

let hack = {
  pseudo: "hacker",
  nom: "unkhnown",
  age: 30.5,
  hobbies: "<script/>",
  balek: "ahahah",
  objet: {
    nom: "jason^^",
    age: 34,
  },
  test: ["tes*", "test2", 34, "ji"],
};

console.log(protector.isprotek(hack)); // return = false

Trois réponses possibles : true (l'objet est safe), false (l'objet n'est pas validé par Protector)

protector gère un niveau de complexité bas .

Si dans votre objet, il y a un objet qui a lui même un autre objet ou un Array, Protector vous répondra que la version ne couvre pas ce niveau de complexité.

Protector.clean()

EXEMPLE: Nettoyons un string avec Protector.clean().

let string = "Je s|<uis un s@tring pirate ah:ah^^";

console.log(protector.clean(string)); // return = Je suis un string pirate ahah

Enjoy 😎

Readme

Keywords

none

Package Sidebar

Install

npm i @rom13/protector

Weekly Downloads

34

Version

1.32.0

License

ISC

Unpacked Size

5.87 kB

Total Files

3

Last publish

Collaborators

  • rom1313