{"id":15931216,"url":"https://github.com/sxwjs/sxwjs","last_synced_at":"2025-08-15T23:31:33.494Z","repository":{"id":57164016,"uuid":"182740755","full_name":"sxwjs/sxwjs","owner":"sxwjs","description":"A javascript library to display warning aginst self XSS attacks","archived":false,"fork":false,"pushed_at":"2021-01-10T16:07:56.000Z","size":133,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-08T22:51:38.672Z","etag":null,"topics":["console-warning","javascript","javascript-library","js","js-library","npm","nuget","security","self-xss","self-xss-warning","sxw-js","sxwjs","website-security","xss-attacks","xss-prevention"],"latest_commit_sha":null,"homepage":"https://sxw.js.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sxwjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-22T10:01:23.000Z","updated_at":"2022-08-24T11:24:28.000Z","dependencies_parsed_at":"2022-09-06T04:02:35.643Z","dependency_job_id":null,"html_url":"https://github.com/sxwjs/sxwjs","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/sxwjs/sxwjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwjs%2Fsxwjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwjs%2Fsxwjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwjs%2Fsxwjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwjs%2Fsxwjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sxwjs","download_url":"https://codeload.github.com/sxwjs/sxwjs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwjs%2Fsxwjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269663702,"owners_count":24455828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console-warning","javascript","javascript-library","js","js-library","npm","nuget","security","self-xss","self-xss-warning","sxw-js","sxwjs","website-security","xss-attacks","xss-prevention"],"created_at":"2024-10-07T01:04:30.019Z","updated_at":"2025-08-15T23:31:33.174Z","avatar_url":"https://github.com/sxwjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SXW.js\n[![Website](https://img.shields.io/badge/website-sxw.js.org-blue.svg?style=flat-square\u0026logo=mozilla%20firefox)](https://sxw.js.org/)\n[![GitHub License](https://img.shields.io/github/license/sxwjs/sxwjs.svg?style=flat-square)](#)\n[![GitHub issues](https://img.shields.io/github/issues-raw/sxwjs/sxwjs.svg?style=flat-square)](#)\n[![Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors)\n\n#### About\nSXW.js is a javascript library that is used to display console warnings against Self XSS attacks.\n\n**Status**: [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/sxwjs/sxwjs/CI?logo=github\u0026style=flat-square)](https://github.com/sxwjs/sxwjs/actions?query=workflow%3ACI)\n\n#### Download via\n[![npm](https://img.shields.io/npm/v/@sxwjs/sxwjs.svg?style=flat-square\u0026logo=npm)](https://www.npmjs.com/package/@sxwjs/sxwjs)\n[![Nuget](https://img.shields.io/nuget/v/sxw.js.svg?style=flat-square\u0026logo=nuget)](https://www.nuget.org/packages/sxw.js/)\n[![GitHub release](https://img.shields.io/github/release/sxwjs/sxwjs.svg?style=flat-square\u0026logo=github)](https://github.com/sxwjs/sxwjs/releases)\n[![CDN](https://img.shields.io/jsdelivr/npm/hy/@sxwjs/sxwjs?label=CDN%20-%20jsdelivr\u0026logo=jsdelivr\u0026logoColor=white\u0026style=flat-square)](https://www.jsdelivr.com/package/npm/@sxwjs/sxwjs)\n\n## Usage\n\n#### Using npm\n 1. Install the [npm package](https://www.npmjs.com/package/@sxwjs/sxwjs) using\n    ```bash\n    npm i @sxwjs/sxwjs\n    ```\n 2. Import sxwjs module\n 3. Call the required function inside sxwjs module\n    ```typescript\n    import sxwjs from '@sxwjs/sxwjs';\n    ...\n    ...\n    sxwjs.printWarning();\n    ```\n\n#### Using js file directly\n\n 1. Include the sxw.js file in your website either directly or via CDN.\n 2. If you are using CDN try the following URL\n    ```html\n    \u003cscript src=\"https://cdn.jsdelivr.net/npm/@sxwjs/sxwjs@4.0.0/src/sxw.min.js\"\u003e\u003c/script\u003e\n    ```\n 3. The script will register built-in functions into `window.sxwjs` object.\n 4. At the end of the HTML document call the printWarning function in `window.sxwjs` as shown in the sample code.\n    ```javascript\n    \u003cscript\u003e\n        window.sxwjs.printWarning();\n    \u003c/script\u003e\n    ```\n\n#### Using nuget\n 1. Install the [nuget package](https://www.nuget.org/packages/sxw.js/)\n 2. Include the sxw.js file from the content folder into your website.\n 3. At the end of the HTML document call the printWarning function in `window.sxwjs` similar to the one mentioned above.\n\n\n### Customizations\n\n##### Sections\nThe warning displayed in console contains three sections.\n 1. A huge STOP sign\n 2. A caution text in bold\n 3. A detailed message saying that this section is intented for developers only. It also warns aginst copy pasting content in the console.\n\n##### Configuration\nSXW.js has a config object with the following variables,\n\nVariable name | Default value | Description\n------------ | ------------- | ---------\nstopColor | red | the colour of the stop sign\nstopFontWeight | bold | Font weight for stop sign\ncautionFontWeight | bold | Font weight for caution sign\ncautionFontSize | 15px | Font size for caution sign\n\nExample js object:\n\n````js\nvar config = {\n        stopColor: \"red\",\n        stopFontWeight: \"bold\",\n        cautionFontWeight: \"bold\",\n        cautionFontSize: \"15px\",\n    };\n````\n\n##### Content\n\nSXW.js has a predefined object with the following variables for defining the content to be displayed,\n\nVariable name | Default value | Description\n------------ | ------------- | ---------\nstopText | `*` based stop sign text | The text used to print STOP sign\ncautionText | Caution: DO NOT PROCEED. | Text for caution notice\nwarningText | 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. | The content of the detailed error message\n\n````js\nvar content = {\n        en: {\n            stopText: \"*********  *********  *********  *********\\n***           ***     ***   ***  ***   ***\\n***           ***     ***   ***  ***   ***\\n*********     ***     ***   ***  *********\\n      ***     ***     ***   ***  ***\\n      ***     ***     ***   ***  ***\\n*********     ***     *********  ***\",\n            cautionText: \"Caution: DO NOT PROCEED.\",\n            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.\"\n        }\n    };\n````\n\nYou can define content in multiple languages as shown here. Just pass the appropriate language code to the printing function.\n\n##### Functions\n\nThere are three functions in the library that will be available into the `window.sxwjs` object.\n\n 1. `printStop` - Prints just the huge stop sign.\n 2. `printCautionNotice` - Prints the caution notice.\n 3. `printWarningText` - Prints the the detailed error message.\n 4. `printWarning` - Prints all the three sections.\n 5. `setConfig` - Assigns the provided configuration.\n 6. `getConfig` - Retrives the configuration.\n 7. `setContent` - Can be used to modifiy the content such as warningText, cautionNotice, etc...\n 8. `getContent` - Retrives the content that will be displayed on the console.\n\nNone of these functions are called by default. You can choose to call them as you wish.\n\nExample Usage:\n\n````js\nwindow.sxwjs.setConfig(myConfig);\nwindow.sxwjs.printWarning('en');\nwindow.sxwjs.printStop('en');\nwindow.sxwjs.printCautionNotice('en');\n````\n\n### Credits \u0026 Thanks\n\n#### Contributors\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://kolappannathan.github.io/\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/8157105?v=4\" width=\"80px;\" alt=\"Kolappan Nathan\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKolappan Nathan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/sxwjs/sxwjs/commits?author=kolappannathan\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#maintenance-kolappannathan\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/shivarajnaidu\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/12374494?v=4\" width=\"80px;\" alt=\"yuvaraj\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eyuvaraj\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/sxwjs/sxwjs/commits?author=shivarajnaidu\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n#### Services \u0026 Tools used\n\n1. [Github](https://github.com) - Provides free hosting for repos and website.\n2. [js.org](https://js.org) - Provides subdomain for our website.\n3. [Shields.io](https://shields.io) - Provides those beatutiful status icons.\n4. [Azure Devops](https://dev.azure.com/sxw-js/sxw-js) - Free CI/CD for open source projects.\n5. [ImgBot](https://imgbot.net) - Automatic compression of new images\n6. [Pull](https://probot.github.io/apps/pull) - Automatic update of forked repos\n7. [allcontributors](https://allcontributors.org) - Helps maintaing list of contributors of the project\n8. [Adobe Spark](https://spark.adobe.com) - Used to create logo, banners, etc...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsxwjs%2Fsxwjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsxwjs%2Fsxwjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsxwjs%2Fsxwjs/lists"}