Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't associate Draw.io with Gitlab (both self-hosted) #163

Open
pi3rrot opened this issue Aug 9, 2024 · 4 comments
Open

Can't associate Draw.io with Gitlab (both self-hosted) #163

pi3rrot opened this issue Aug 9, 2024 · 4 comments

Comments

@pi3rrot
Copy link

pi3rrot commented Aug 9, 2024

Hello,

I'm using the last version in date of Draw.io v24.7.5 with Gitlab 17.2.2-ce.0 from omnibus installer on Debian 12.
I can't grant access to Draw.io in my Gitlab instance.

I have read the manual and set the values like
https://github.com/jgraph/docker-drawio/blob/dev/self-contained/README.md#gitlab

I replace the value https://gitlab.com/oauth/token without oauth/token because it redirect like oauth/token/oauth/authentication

It's under a Nginx reverse-proxy, with CORS values like

Nginx reverse-proxy :

        add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; connect-src 'self' https://gitlab.mydomain.fr; img-src * data:; media-src * data:; font-src * about:; style-src 'self' 'unsafe-inline';";

js/PreConfig.js file :

window.DRAWIO_PUBLIC_BUILD = false;
window.EXPORT_URL = 'https://draw.mydomain.fr';
window.PLANT_URL = 'REPLACE_WITH_YOUR_PLANTUML_SERVER';

window.DRAWIO_BASE_URL = 'https://draw.mydomain.fr'; // Replace with path to base of deployment, e.g. https://www.example.com/folder
window.DRAWIO_VIEWER_URL = 'https://draw.mydomain.fr/js/viewer.min.js'; // Replace your path to the viewer js, e.g. https://www.example.com/js/viewer.min.js

window.DRAWIO_LIGHTBOX_URL = null; // Replace with your lightbox URL, eg. https://www.example.com
window.DRAW_MATH_URL = 'math/es5';
window.DRAWIO_CONFIG = null; // Replace with your custom draw.io configurations. For more details, https://www.drawio.com/doc/faq/configure-diagram-editor

window.DRAWIO_GITLAB_URL = 'https://gitlab.mydomain.fr';
window.DRAWIO_SERVER_URL = 'https://draw.mydomain.fr/';
window.DRAWIO_GITLAB_ID = '16cfb06db2nonothisisnotthegoodone6435bbd38';
window.DRAWIO_GITLAB_SECRET = 'gloas-yieghaej1athisisnothegoodonetooohteb6coh2Fah6coopohling3i';
window.DRAWIO_CSP_HEADER= 'default-src \'self\'; script-src \'self\' \'unsafe-inline\'; connect-src \'self\' https://gitlab.mydomain.fr; img-src * data:; media-src * data:; font-src * about:; style-src \'self\' \'unsafe-inline\';';

urlParams['sync'] = 'manual';

It give me an error HTTP 400 when I try to grant access.

@davidjgraph
Copy link

Which is bad request. How, precisely, is the requested formed?

@pi3rrot
Copy link
Author

pi3rrot commented Aug 9, 2024

Sorry my miss, this is it. (values are fakes for the paste)

https://draw.mydomain.fr/gitlab?code=ohqu9joba6yeeki6thee3diet9kie6eiwae3chuz8Ahziathaew6Oosheebeeyij&state=cId%3Dohqu9joba6yeeki6thee3diet9kie6eiwae3chuz8Ahziathaew6Oosheebeeyij%26domain%3Ddraw.mydomain.fr%26token%3Dohqu9joba6yeeki6thee3diet9kie6eiwa

@archcat111
Copy link

After clicking 'Authorize' in GitLab, the page redirects (302) to the draw.io URL, but the same error occurs.

@elmagnificogi
Copy link

elmagnificogi commented Sep 11, 2024

same issue to me

your PreConfig.js header is not right

you could see some like:
(function() {
try {
var s = document.createElement('meta');
s.setAttribute('content', 'src 'self'; script-src 'self' https://code.jquery.com 'unsafe-inline'; connect-src 'self' https://你的gitlab; img-src * data:; media-src * data:; font-src * about:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; frame-src 'self' https://你的gitlab;');
s.setAttribute('http-equiv', 'Content-Security-Policy');
var t = document.getElementsByTagName('meta')[0];
t.parentNode.insertBefore(s, t);
} catch (e) {} // ignore
})();

it's about CSP, you maybe use a wrong header.

you could use my header, it's ok

DRAWIO_CSP_HEADER=default-src 'self'; script-src 'self' https://code.jquery.com 'unsafe-inline'; connect-src 'self' http://MY_SERVER_URL; img-src * data:; media-src * data:; font-src * about:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; frame-src 'self' http://MY_SERVER_URL;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants