So guys I have an issue like Make sure bypassing Vue built-in sanitization is safe here. with a href URL in vue js, which the URL i get from my API, and then I've tried to sanitize using @braintree/sanitize-url and then put it inside my Vue.prototype.$sanitize like this
import { sanitizeUrl } from "@braintree/sanitize-url"
Vue.prototype.$sanitize = sanitizeUrl
and then i used it on my component like this
data: () => ({
sanitizeUrl: null
}),
created() {
// BEFORE SANITIZE : "https://codepen.io/"
// AFTER SANITIZED : "https://codepen.io/"
this.sanitizeUrl = this.$sanitize(this.obj.info.url)
}
<a
:href="sanitizeUrl"
target="_blank"
rel="noreferrer noopener nofollow"
/>
everything's good but the sonar cloud still detects this URL is not sanitized yet
like Make sure bypassing Vue built-in sanitization is safe here.
how can I sanitize this URL from my API? Thank you guys