View Issue Details

IDProjectCategoryView StatusLast Update
0023939mantisbtapi restpublic2018-04-29 19:21
Reporterjdg Assigned Tovboctor  
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version2.10.0 
Summary0023939: Option to bypass Auth layer for REST API
Description

Hi!

I'm currently in the middle of deploying a Mantis instance for my team. I realize that it's experimental, but I got the REST API working from within the employee release of our application and would prefer not to hard-code an API key. Is there an easy way to disable Auth for POST requests to /api/rest/issues?

Thanks in advance for your help! Love what you guys are doing here!

Steps To Reproduce
  1. Make POST request to /api/rest/issues, get it working with an API key
  2. Realize that there's no way to disable the Auth layer
  3. Curl up into a ball and cry at your lack of PHP knowledge
TagsNo tags attached.

Activities

vboctor

vboctor

2018-02-06 20:55

manager   ~0058787

REST API is no longer experimental. It is now enabled by default and should be able to serve most of scenarios.

What kind of authentication do you want to happen if you disable API key auth? How do you guarantee that a rogue client won't just post to your API?

The API also has a need to attribute the calls to a user within MantisBT, hence, there needs to be someway to determine the user. In case of anonymous access, that would be the anonymous user and in such case there is no need for an authorization header.

jdg

jdg

2018-02-08 15:46

reporter   ~0058804

Thanks for the response, @vboctor!

We host our bug tracker internally, so users outside the network won't be able to access it. I realize that this is definitely not best practice, so I plan to revisit that in a later implementation.

Ah, ok. I wasn't aware that the anonymous user could bypass auth if enabled. Should I just enable anonymous access and identify POST requests from our integrated application as that user?

vboctor

vboctor

2018-02-10 16:38

manager   ~0058815

You will need to have:

  • Anonymous access enabled and such user must have enough access to do the actions you need to trigger via the API (e.g. report issues).
  • Don't pass the Authorization header when calling the API which will auth as anonymous user automatically.

Having said that, I think you are better off creating a user for the API access and hard-coding the API key created for such user. This way you don't have anonymous access to your MantisBT and have users use that by mistake.