{"id":16129131,"url":"https://github.com/radyakaze/nuxt-dompurify","last_synced_at":"2025-03-18T14:30:28.031Z","repository":{"id":257810127,"uuid":"867140681","full_name":"radyakaze/nuxt-dompurify","owner":"radyakaze","description":"A Nuxt 3 module for sanitizing HTML content using DOMPurify to protect against XSS attacks.","archived":false,"fork":false,"pushed_at":"2024-10-11T09:08:31.000Z","size":1348,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T20:51:18.307Z","etag":null,"topics":["dompurify","html-sanitization","html-sanitizer","nuxt","nuxt3","sanitizer","security","xss"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/radyakaze.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-03T14:18:29.000Z","updated_at":"2025-03-06T10:33:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"f99d0be6-2c62-4faa-904d-b4d9db856b5a","html_url":"https://github.com/radyakaze/nuxt-dompurify","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.3571428571428571,"last_synced_commit":"be58f6160867a29ae09ed4a67e69a42bad212c01"},"previous_names":["radyakaze/nuxt-dompurify"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radyakaze%2Fnuxt-dompurify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radyakaze%2Fnuxt-dompurify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radyakaze%2Fnuxt-dompurify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radyakaze%2Fnuxt-dompurify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radyakaze","download_url":"https://codeload.github.com/radyakaze/nuxt-dompurify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244239952,"owners_count":20421371,"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","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":["dompurify","html-sanitization","html-sanitizer","nuxt","nuxt3","sanitizer","security","xss"],"created_at":"2024-10-09T22:08:42.881Z","updated_at":"2025-03-18T14:30:28.024Z","avatar_url":"https://github.com/radyakaze.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nuxt DOMPurify\n\nA Nuxt 3 module that integrates DOMPurify for sanitizing HTML content. This module helps protect your application from XSS attacks by sanitizing any potentially dangerous HTML inputs.\n\n## Installation\n\nInstall the module via Yarn:\n\n```bash\nyarn add -D @radya/nuxt-dompurify\n```\n\n## Usage\n\nAdd the module to your Nuxt config file:\n\n```javascript\nexport default defineNuxtConfig({\n  modules: ['@radya/nuxt-dompurify'],\n})\n```\n\n### Example\n\nYou can use the directive `v-sanitize-html` to sanitize HTML content in your templates:\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv v-sanitize-html=\"dirtyHtml\" /\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\nconst dirtyHtml = `\n\u003cdiv\u003e\n  \u003ch1\u003eWelcome to My Website\u003c/h1\u003e\n  \u003ch3\u003eThis is H3 heading\u003c/h3\u003e\n  \u003cp\u003eThis is a \u003cstrong\u003esimple\u003c/strong\u003e paragraph.\u003c/p\u003e\n  \u003cimg src=\"image.jpg\" onerror=\"alert('Hacked!')\" /\u003e\n  \u003ca href=\"https://example.com\" onclick=\"stealCookies()\"\u003eClick me!\u003c/a\u003e\n  \u003cscript\u003ealert('This is an XSS attack!')\u003c/` + `script\u003e\n\u003c/div\u003e`\n\u003c/script\u003e\n```\n\nThis will sanitize the `dirtyHtml` variable, ensuring it is safe to render in the DOM.\n\n## Profiles\n\nThis module also supports **profiles** to allow different DOMPurify configurations for specific use cases. You can define profiles in your `nuxt.config.ts` like this:\n\n```ts\nexport default defineNuxtConfig({\n  modules: ['@radya/nuxt-dompurify'],\n  dompurify: {\n    profiles: {\n      profileName: {\n        ALLOWED_TAGS: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],\n      }\n    }\n  },\n})\n```\n\n### Using Profiles\n\nTo use a specific profile, you can pass the profile name as an argument to the `v-sanitize-html` directive:\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv v-sanitize-html:profileName=\"dirtyHTML\" /\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\nconst dirtyHtml = `\n\u003cdiv\u003e\n  \u003ch1\u003eWelcome to My Website\u003c/h1\u003e\n  \u003ch3\u003eThis is H3 heading\u003c/h3\u003e\n  \u003cp\u003eThis is a \u003cstrong\u003esimple\u003c/strong\u003e paragraph.\u003c/p\u003e\n  \u003cimg src=\"image.jpg\" onerror=\"alert('Hacked!')\" /\u003e\n  \u003ca href=\"https://example.com\" onclick=\"stealCookies()\"\u003eClick me!\u003c/a\u003e\n  \u003cscript\u003ealert('This is an XSS attack!')\u003c/` + `script\u003e\n\u003c/div\u003e`\n\u003c/script\u003e\n```\n\n## Contributing\n\nWe welcome contributions to `Nuxt DOMPurify`. Please follow these steps to get started:\n\n1. **Enable Corepack**: Ensure Corepack is enabled by running:\n   ```bash\n   corepack enable\n   ```\n\n2. **Install Dependencies**: Install all necessary dependencies by running:\n   ```bash\n   yarn install\n   ```\n\n3. **Generate Type Stubs**: Run the following command to generate type stubs:\n   ```bash\n   yarn dev:prepare\n   ```\n\n4. **Start Development Mode**: Use the following command to start the playground in development mode:\n   ```bash\n   yarn dev\n   ```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradyakaze%2Fnuxt-dompurify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradyakaze%2Fnuxt-dompurify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradyakaze%2Fnuxt-dompurify/lists"}