{"id":15019504,"url":"https://github.com/dxphilo/v-safe-url","last_synced_at":"2026-02-04T14:36:51.159Z","repository":{"id":215747380,"uuid":"739701341","full_name":"dxphilo/v-safe-url","owner":"dxphilo","description":"Safe and secure URL sanitization in Vuejs","archived":false,"fork":false,"pushed_at":"2024-01-08T10:24:08.000Z","size":67,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T03:38:50.983Z","etag":null,"topics":["safe-url","vuejs","vuejs2","vuejs3"],"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/dxphilo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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-01-06T09:22:47.000Z","updated_at":"2024-01-07T20:24:36.000Z","dependencies_parsed_at":"2024-08-23T00:07:02.950Z","dependency_job_id":"b0d23d41-05b6-41bb-91a2-9ee17d674090","html_url":"https://github.com/dxphilo/v-safe-url","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"7b934a667e3331daa6b6fce295a203657486efb6"},"previous_names":["dxphilo/v-safe-url"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dxphilo/v-safe-url","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxphilo%2Fv-safe-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxphilo%2Fv-safe-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxphilo%2Fv-safe-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxphilo%2Fv-safe-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dxphilo","download_url":"https://codeload.github.com/dxphilo/v-safe-url/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxphilo%2Fv-safe-url/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261226317,"owners_count":23127299,"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":["safe-url","vuejs","vuejs2","vuejs3"],"created_at":"2024-09-24T19:53:37.502Z","updated_at":"2026-02-04T14:36:51.094Z","avatar_url":"https://github.com/dxphilo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# v-safe-url\n\nSecure URL Sanitization for Vue.js Applications\n\n## Why\n\nI built this to help with safe URL sanitization in VueJs application. Under the hood, we levarage [sanitize-url](https://github.com/braintree/sanitize-url)\n\n**Note:** The plugin has a bundle size of 1.59 kB, and you can also check its details on [bundlephobia](https://bundlephobia.com/package/v-safe-url).\n\n## Installation\n\nInstall the package using your preferred package manager:\n\n```bash\nnpm install v-safe-url\n\n# or\n\nyarn add v-safe-url\n\n# or\n\npnpm add v-safe-url\n```\n\n## Installation\n\nIn your Vue.js app entry file (main.ts or main.js), include the following:\n\n```\n  // In main.js or similar\n  import { createApp } from 'vue';\n  import VueSafeUrl from 'v-safe-url';\n\n  const app = createApp(App);\n  app.use(VueSafeUrl);\n  app.mount('#app');\n\n```\n\n## Usage\n\nApply the `v-safe-url` directive in your `a` link HTML tags to securely sanitize URLs.\n\n**Note:** The directive shoudl be used on `\u003ca\u003e` tags since it will inject the `href` attribute. If you need to use `usesafeUrl` in non-links, I suggest you check out the [useSafeUrl](#usesafeurl)\n\n```\n\u003cscript setup\u003e\nimport { ref } from 'vue';\n\nconst untrustedUrl = ref('www.example.com/\\u200D\\u0000\\u001F\\x00\\x1F\\uFEFFfoo');\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n  \u003cdiv\u003e\n    \u003ca v-safe-url=\"untrustedUrl\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eClick Here for a Safe Link\u003c/a\u003e \u003c!-- www.example.com/foo --\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n```\n\n## useSafeUrl\n\nAlternatively, if you prefer to sanitize the URL within the `\u003cscript\u003e` tag, import `useSafeUrl` from `v-safe-url`.\n\n```\n\u003cscript setup\u003e\nimport { useSafeUrl } from 'v-safe-url';\nimport { ref } from 'vue';\n\nconst uncleanUrl = ref('www.example.com/\\u200D\\u0000\\u001F\\x00\\x1F\\uFEFFfoo');\nconst safeUrl = useSafeUrl(uncleanUrl.value);\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n  \u003cdiv\u003e\n    \u003ch1\u003eUnsafe URL: {{ uncleanUrl }}\u003c/h1\u003e\n    \u003ch2\u003eSafe URL: {{ safeUrl }}\u003c/h2\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n```\n\nIf you encounter any issues, find a bug, wish to request a new feature, or propose general refactoring, please open an issue for discussion. Your feedback is valuable, and I appreciate your contributions. I hope this helps!\n\n## License\n\n[MIT](./LICENSE) License © 2023-PRESENT [John Philip](https://github.com/dxphilo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdxphilo%2Fv-safe-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdxphilo%2Fv-safe-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdxphilo%2Fv-safe-url/lists"}