fix extra white space on all PDF embedded links

@mig5 @hutchy68

Extra white space on all PDF embedded links (on the right-hand side) has been noted in the wiki. Doesn’t happen with other external resources - perhaps related to the CSP policy? Can you please investigate e.g. see here for example (cookie PDF paper):

http://dds6qkxpwdeubwucdiaord2xgbbeyds25rbsgr73tbfpqpt4a6vjwsyd.onion/wiki/Data_Collection_Techniques#Cookie_Threats

1 Like

Hi @torjunkie, I confirm this is due to the Content Security Policy.

The page appears to try and add this little PDF logo from WikiMedia when a .pdf is linked to:

https://upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif

The CSP blocks that (on purpose).

Whilst whitelisting upload.wikimedia.org briefly in order to prove the point, I realised that when on .onion, the above URL actually is converted to http:// because of the http:// in the .onion. So this would actually break encryption for onion visitors if we were to whitelist it. I could try and rewrite the page content on the page response but it’s a bit fiddly for such a minor thing. Moreover, Patrick wanted external resources blocked in the CSP on purpose (in case someone somehow embeds an asset that has legal implications etc)

My advice:

  1. Disable the icon by using this method (if it works): Help:External link icons - Wikipedia

  2. Ignore it?

  3. Whitelist the upload.wikimedia .org in the CSP (if @Patrick wants that policy change), but only on the whonix.org site, not on the .onion

Let me know what you and Patrick want to do. 1) is probably the easiest win, but requires some discipline from the page editors to remember to use the ‘plainlinks’ class when linking to external resources like PDFs.

Cheers
Mig

2 Likes

mig5:

  1. Disable the icon by using this method (if it works): Help:External link icons - Wikipedia

Best.

1 Like

This is now fixed.

usage:

{{archive_link|link=https://cseweb.ucsd.edu/~hovav/dist/canvas.pdf|text=Studies}}

or:

{{link|link=https://cseweb.ucsd.edu/~hovav/dist/canvas.pdf|text=Studies}}