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

Prohibit anonymous test execution using the REST API #66

Closed
rjmartell opened this issue Nov 5, 2014 · 13 comments · Fixed by #433
Closed

Prohibit anonymous test execution using the REST API #66

rjmartell opened this issue Nov 5, 2014 · 13 comments · Fixed by #433
Assignees
Projects
Milestone

Comments

@rjmartell
Copy link
Contributor

Authenticate all agents that submit requests to execute a test suite using the REST API. Perhaps this can be done preemptively using the HTTP "basic" authentication scheme (see RFC 7235) over TLS (i.e. https).

@rjmartell
Copy link
Contributor Author

The teamengine-realm component implements a custom Tomcat Realm for checking credentials from user files in ${TE_BASE}/users; it is configured in the web application Context (META-INF/context.xml).

@rjmartell
Copy link
Contributor Author

The teamengine web app is configured to use form-based (login) authentication. It is not possible to declare multiple authentication mechanisms for a single web app in the standard deployment descriptor (web.xml).

@rjmartell
Copy link
Contributor Author

Switching to the "Basic" authentication scheme (RFC 2617) over TLS/SSL would be one solution for protecting both the web resources and the test run controller (*/run) endpoints.

@rjmartell
Copy link
Contributor Author

However, there is no simple log out mechanism when using the basic authn scheme because the browser will cache credentials and resend them in subsequent requests. There are ways to "trick" some browsers into discarding the credentials, but they are not universal and may not be worth it.

So if a user wanted to log in as another user, the cache must be deliberately cleared or the browser restarted.

@bermud
Copy link
Contributor

bermud commented Jan 7, 2016

@rjmartell, I'm fine with your solution. I don't see a big issue with the cache problems. We do want to make the REST API secure using the same user password that the user uses for login through the web interface.

@bermud
Copy link
Contributor

bermud commented Jun 20, 2016

@rjmartell. this issue is very important. Session logs also need to be created to keep consistency with the other running methods and also to be able to generate statistic appropriately. Has this been updated based on the latest authentication related fixes?

@dstenger dstenger self-assigned this Oct 30, 2017
@dstenger
Copy link
Contributor

dstenger commented Nov 3, 2017

@bermud
Should anonymous test execution via REST API be disabled?

The requirement to execute test runs with a registered user via REST API is also covered by 1. of #238.
This issue also includes authentication via Web Browser Interface.

@dstenger dstenger assigned bermud and unassigned keshavnangare Nov 3, 2017
@dstenger dstenger assigned lgoltz and unassigned rjmartell Jul 11, 2018
@dstenger dstenger added this to To do in CITE via automation Jun 27, 2019
@dstenger dstenger moved this from To do to In progress in CITE Jun 27, 2019
@lgoltz lgoltz moved this from In progress to Needs discussion in CITE Jul 31, 2019
@dstenger dstenger assigned ghobona and unassigned bermud Jan 7, 2020
@ghobona
Copy link
Contributor

ghobona commented Jun 15, 2020

@dstenger Yes, let's disable anonymous test execution via REST API please. Users should be authenticated first, before running a test, even when using the REST API.

@ghobona ghobona removed their assignment Jun 15, 2020
@dstenger
Copy link
Contributor

@keshav-nangare
Can you please prototype an implementation (seperate branch) containing a proposed solution?
Please use basic auth as authentication mechanism.

@dstenger dstenger assigned keshavnangare and unassigned dstenger, lgoltz and ghobona Jun 23, 2020
@dstenger dstenger moved this from Needs discussion to In progress in CITE Jun 23, 2020
@keshavnangare
Copy link
Contributor

@dstenger @ghobona

Following are my findings:

  • Current authenticate mechanism
    Web app - FORM-based

  • Implementing a BASIC authentication mechanism for Web app + REST API

    1. Our existing Realm-based authentication mechanism used to validate the user's credentials.
    2. The browser will cache the credentials and it can be cleared after the browser gets restarted.
    3. The LogOut mechanism will not work due to browser cache.
  • Proposed Solution

    1. Keep the Web app authentication as it is.
    2. Implement Basic authentication for REST API.
      1. Add a new filter which will be used for URL's having pattern as /rest/*.
      2. If the user does not send credentials in the header, it will prompt asking for credentials. If credentials send via header validation will be done with the existing Realm-based authentication mechanism and if validation failed again prompts get opened.
      3. Valid users can access REST API until the browser gets restarted without asking for credentials as the browser will send the cached valid credentials with every request.

@ghobona
Copy link
Contributor

ghobona commented Jul 8, 2020

Related to #397

@keshavnangare
Copy link
Contributor

Fixed with #433 PR.

@keshavnangare keshavnangare moved this from In progress to To verify in CITE Jul 8, 2020
@dstenger dstenger assigned dstenger and lgoltz and unassigned keshavnangare Aug 5, 2020
@dstenger dstenger added this to the 5.5 milestone Jan 20, 2022
@dstenger
Copy link
Contributor

TODO: Update documentation.

CITE automation moved this from To verify to Done Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
CITE
  
Done
Development

Successfully merging a pull request may close this issue.

6 participants