Hello all,
I've been trying to implement a "widget" in an internal service (web based), which displays live information about Change Requests from Gerrit. Naturally, the CORS policies get applied and the requests get blocked by Gerrit (while using basic authentication in the headers of the request).
As far I can understand I could:
- Setup Gerrit to allow that origin by configuring site.allowOriginRegex.
- Setup a reverse proxy in front of Gerrit to do, basically, the same as in option 1.
However, when browsing Gerrit's documentation, I came across a section that made me believe there is a third option: access tokens.
The relevant text is this: "Alternatively applications can use access_token in the URL (see above) to authorize requests. Mutations sent as POST with a request content type of text/plain can skip CORS preflight."
As I understand it, if I provide the correct parameter on the request (the access token), I should be able to "bypass" the CORS policy (i.e., Gerrit will not block my cross-origin request), or am I wrong in my interpretation?
Would anyone advice against such a method, if supported? Why?
I myself can see the potential danger of getting the token "stolen" and reused in unauthorized services, while configuring Gerrit to accept CORS from my application as being "more secure". But alas, I'm no expert.
Additionally, where am I supposed to get those access tokens?
I haven't found any more references to these tokens anywhere in the documentation nor the world wide web...
I can always go with options 1 or 2, but I'd like to understand if this really is a possibility, or if I'm reading too much into the documentation.
Thank you in advance, for any help any of you can provide,
Fábio Almeida