Problem with my plugin

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
xSana_83
Posts: 9
Joined: 26 Jan 2022, 08:43

Problem with my plugin

Post by xSana_83 »

hi, I’m coming to you because I have a migration project, from version 1.2.0 to 2.25.2, to do for my business. I managed to migrate all the data on this new version with the plugins they had. However, they created a plugins themselves that I manage to run in MantisBT except for rendering an array. My array now
Sans titre(1).png
Sans titre(1).png (248.84 KiB) Viewed 3586 times
In the old version, they used JQuery Librairie with DataTables and on this new version I can’t make it work. I tried to use JSTables which works on a test page that I created but not on MantisBT. This is my old painting
Sans titre.png
Sans titre.png (208.51 KiB) Viewed 3586 times
So, I don’t know where the problem I encounter can come from and if there is a way to solve the problem of the rendering of the painting. I am attaching a screenshot of my terminal with some errors.
Capture d’écran du 2022-01-25 10-52-54.png
Capture d’écran du 2022-01-25 10-52-54.png (160.99 KiB) Viewed 3594 times
xSana_83
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Problem with my plugin

Post by cas »

This looks to be coming from security issues. Please check your CSP headers.
Check this forum on CSP headers or google on CSP & mantisbt
There is a lot of info available.
Just be careful with removing all such policies, they are there for a reason, certainly if your mantis is available to the outside world.
xSana_83
Posts: 9
Joined: 26 Jan 2022, 08:43

Re: Problem with my plugin

Post by xSana_83 »

So I looked my way through the CSP and changed that on the source code.
CSP.png
CSP.png (445.57 KiB) Viewed 3557 times
Which allowed me to run a board and also something else. However, I don’t know why it put the MantisBT tabs like this left and right.
scp2.png
scp2.png (113.47 KiB) Viewed 3557 times
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Problem with my plugin

Post by cas »

Please do not change the values in config_defaults, make only changes in config/config_inc.php
I cannot indicate why the columns look like this, centered 8O
dregad
Developer
Posts: 75
Joined: 26 Jul 2010, 14:24

Re: Problem with my plugin

Post by dregad »

By setting $g_custom_headers as you did (which as cas said you really should do in config_inc.php), you are completely disabling content security policy. This is a considerable security risk, particularly if your Mantis is used on the Internet, as it potentially exposes your system to all sorts of vulnerabilities (e.g. cross-site scripting). I strongly recommend you don't do that, and try to specifically adapt the policy to your specific needs instead.

You probably should adapt your custom plugin and make sure external script resources are loaded via a hook into the EVENT_LAYOUT_RESOURCES event, and update the CSP using the EVENT_CORE_HEADERS event, with appropriate calls to http_csp_add().

With regards to the messed up layout, I would guess that some of the additional CSS you're loading conflicts with the default ones.
xSana_83
Posts: 9
Joined: 26 Jan 2022, 08:43

Re: Problem with my plugin

Post by xSana_83 »

Hello, I was able to succeed my project with your help. However, the company where I work have chosen to want to remove this security. So, it works as it should and for the visual, it was a problem with Bootstrap. Thank you for your help!
Post Reply