Sections

The warning displayed in console contains three sections.

  1. A big STOP sign
  2. A caution text in bold
  3. A detailed message. It can be used to provide more details to users such as where to report an Self-XSS attack, etc...

Configuration

SXW.js has a config object with the following variables,

  • stopColor: This is the colour of the stop sign. The default value is red.
  • stopFontWeight: The font weight of the stop sign. The default value is bold.
  • cautionFontWeight: The font weight of the caution notice. The default value is bold.
  • cautionFontSize: The font size of the caution notice. The default value is 15px.

These variables can be customized to suit your website needs using the setConfig function.

Example js object for configuration
var config = {
  stopColor: "red",
  stopFontWeight: "bold",
  cautionFontWeight: "bold",
  cautionFontSize: "15px",
};

Content

SXW.js has a config object with the following variables for each language,

  • stopText: `*` based stop sign.
  • cautionText: A caution notice with a short one line content.
  • warningText: A detailed message to the customers with instructions to contact your security team and other details.

These variables can be modified using setContent function.

Example js object for content
var content = {
  en: {
    stopText: "*********  *********  *********  *********\n***           ***     ***   ***  ***   ***\n***           ***     ***   ***  ***   ***\n*********     ***     ***   ***  *********\n      ***     ***     ***   ***  ***\n      ***     ***     ***   ***  ***\n*********     ***     *********  ***",
    cautionText: "Caution: DO NOT PROCEED.",
    warningText: "This section is intended for developers only. Don't copy paste anything in this area.\nIf someone told you to copy and paste something here, it is a scam and will give them access to your account. In that case, kindly report this to our support team."
  }
};

Functions

There are four functions in the library that will be available into the sxwjs object.

  1. printStop - Prints just the huge stop sign
    Example: sxwjs.printstop('en');
  2. printCautionNotice - Prints the caution sign
    Example: sxwjs.printCautionNotice('en');
  3. printWarningText - Prints the detailed error message
    Example: sxwjs.printWarningText('en');
  4. printWarning - prints all the three sections
    Example: sxwjs.printWarning('en');
  5. setConfig - Assigns the provided configuration.
    Example: sxwjs.setConfig(config);
  6. getConfig - Retrives the configuration.
    Example: var config = sxwjs.getConfig();
  7. setContent - Can be used to modifiy the content such as warningText, cautionNotice, etc...
    Example: sxwjs.setContent(content);
  8. getContent - Retrives the content that will be displayed on the console.
    Example: var content = sxwjs.getContent();

Note: None of these functions are called by default. You can choose to call them as you wish.