Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to replace the `vue:href` method

:href="" is scanned by sonarqube, showing Take care when using the v-bind:href directive to set URLs which can contain malicious Javascript (javascript:onClick(…)).
Brothers and sisters, is there any way to replace :href?

<el-table-column prop="link" width="70">
   <template slot-scope="{row}">
      <a :href="row.link" rel="opener" target="_blank" class="fast">{{row.link}}</a>
   </template>
</el-table-column>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Looking at the sonarqube report, your code href address may be a piece of executable code, which can be changed to a p tag, and then bind the click event to the p tag to achieve the purpose through window.open();

In addition, the address of the general dynamic a link still needs to be processed, otherwise there is a risk of script injection.

A js library is recommended:
https://www.npmjs.com/package/@braintree/sanitize-url

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading