Per https://github.com/nextcloud/tasks/issues/2274#issuecomment-1873495567, I’m unable to view ![title](https://example.com/image.extension)
{.MD} in tasks descriptions at Login – Nextcloud. This appears to be due to CSP (mis)configuration. Am I able to modify this as an unprivileged user, or must I ask the host? A client-side bypass workaround is acceptable.
I’m unable to view
![title](https://example.com/image.extension){.MD}
in tasks descriptions
Reading through the issue I was surprised the image loaded for @raimund-schluessler: I didn’t think any standard components of Server or shipped-by-default apps set the ContentSecurityPolicy
to permit img-src
from arbitrary domains… other than under very narrow and carefully considered and controlled circumstances. (And AFAIK the tasks
app doesn’t override/adjust the CSP itself).
Then I came up with a hypothesis: they might have an app like integration_github
installed… Which just so happens to explicitly add the GH image domain to NC’s Content-Security-Policy here:
I suspect img-src sources other than GH would not have worked (there may be an override in debug
mode also - I can’t remember).
So I don’t think what you’re trying to do normally works; it doesn’t for me on latest NC27 on a test instance (lacking the above mentioned app). I did not check any other versions.
But to your question…
Am I able to modify this as an unprivileged user, or must I ask the host? A client-side bypass workaround is acceptable.
Server-side: No.
Client-side: Yes, there are browser extensions (and, browser options, sometimes) that can be used to adjust/override the Content-Security-Policy. Should be easy to find via your favorite search engine for your browser.
P.S. It looks like your host is using v25.0.8 (a bit out of date even within NC25 which made it to v25.0.13 before reaching end of life).
P.P.S. CSP references you might find helpful:
For me it works with basically every domain. But you are right, on my local dev server with very few apps installed, loading images is blocked by CSP as well.
However, I couldn’t figure out yet which app(s) allow images. A quick search in GitHub shows that there are multiple apps, of which a few are installed on my productioni instance, that completely allow all image domains. Such as
Maps
Notes
PDF Viewer
And there are multiple more that partially allow image domains. So, yes, I guess you are right that the reason it just works here is an app allowing all images to load.
@raimund-schluessler, seems like a significant security deficiency that the administrator can’t comprehensively see all security policy overrides at a moment’s notice, right? I’m surprised NC appears to lack that.