Bug 848724 - Dose not check the domain name in the URL via gear REST api
Summary: Dose not check the domain name in the URL via gear REST api
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Master
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Ravi Sankar
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-16 09:50 UTC by Wei Sun
Modified: 2015-05-15 00:51 UTC (History)
2 users (show)

Fixed In Version: devenv_2051
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-17 21:29:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Wei Sun 2012-08-16 09:50:23 UTC
Description of problem:
Using gear REST api , whatever the domain name is, it will add the event successfully.

Version-Release number of selected component (if applicable):
devenv_1997

How reproducible:
always

Steps to Reproduce:
1.create domain :wsundevman
2.create app:myapp1
3.Get gear usage using REST api with wrong domain
curl -k -X GET -H "Accept: application/xml" --user wsun:redhat https://ec2-174-129-77-200.compute-1.amazonaws.com/broker/rest/domains/a/applications/myapp1/gears

  
Actual results:
[openshift@localhost wsun]$ curl -k -X GET -H "Accept: application/xml" --user wsun:redhat https://ec2-174-129-77-200.compute-1.amazonaws.com/broker/rest/domains/a/applications/myapp1/gears
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
  </supported-api-versions>
  <messages/>
  <version>1.1</version>
  <data>
    <gear>
      <uuid>14700405ed7e4598b94b2a0be5b73232</uuid>
      <components>
        <component>
          <internal-port nil="true"></internal-port>
          <name>php-5.3</name>
          <proxy-host nil="true"></proxy-host>
          <proxy-port nil="true"></proxy-port>
        </component>
        <component>
          <database-name>myapp1</database-name>
          <connection-url>mysql://127.0.250.129:3306/</connection-url>
          <password>7wy8YTMt3lmH</password>
          <username>admin</username>
          <internal-port nil="true"></internal-port>
          <name>mysql-5.1</name>
          <proxy-host nil="true"></proxy-host>
          <proxy-port nil="true"></proxy-port>
        </component>
      </components>
    </gear>
  </data>
  <type>gears</type>
  <status>ok</status>
</response>


Expected results:
it should return error message like, "domain does not exist"

Additional info:
[openshift@localhost wsun]$ curl -k -X GET -H "Accept: application/xml" --user wsun:redhat https://ec2-174-129-77-200.compute-1.amazonaws.com/broker/rest/domains/a/applications/myapp1/
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
  </supported-api-versions>
  <messages>
    <message>
      <exit-code>127</exit-code>
      <field nil="true"></field>
      <severity>error</severity>
      <text>Domain not found.</text>
    </message>
  </messages>
  <version>1.1</version>
  <data>
    <datum nil="true"></datum>
  </data>
  <type nil="true"></type>
  <status>not_found</status>
</response>

Comment 1 Ravi Sankar 2012-08-17 17:27:18 UTC
We have this issue from day 1. This is not specific to gear REST api, any REST api may have this issue. Given valid 'user' and valid user 'application', we are able to retrieve app information and it doesn't care about the domain.

This will be fixed by EOD along with duplicate code cleanup in REST api controllers.

Comment 2 Ravi Sankar 2012-08-21 02:15:04 UTC
https://github.com/openshift/li/pull/280

Comment 3 Ravi Sankar 2012-08-22 08:48:10 UTC
Fixed in git revision bb8b12198.

Comment 4 Wei Sun 2012-08-23 02:44:21 UTC
verified on devenv-stage_233

1.create a domain:wsundev823
2.2.create app:phptest
3.Get gear usage using REST api with wrong domain
[sunwei@dhcp-8-229 dev]$ curl -k -X GET -H "Accept: application/xml" --user wsun:redhat https://ec2-23-22-239-11.compute-1.amazonaws.com/broker/rest/domains/a/applications/phptest/gears
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <type nil="true"></type>
  <version>1.1</version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
  </supported-api-versions>
  <data>
    <datum nil="true"></datum>
  </data>
  <status>not_found</status>
  <messages>
    <message>
      <field nil="true"></field>
      <exit-code>127</exit-code>
      <text>Domain a not found</text>
      <severity>error</severity>
    </message>
  </messages>
</response>


Note You need to log in before you can comment on or make changes to this bug.