Skip to content

Commit

Permalink
Bump httpclient dependency (#453)
Browse files Browse the repository at this point in the history
* Revert "Disable SQL server functionality (#448)"

This reverts commit 37a3a61.

* Bump httpclient version
  • Loading branch information
charlesbluca authored Apr 8, 2022
1 parent fa74aef commit 37ea6b6
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 74 deletions.
6 changes: 2 additions & 4 deletions continuous_integration/recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
noarch: python
entry_points:
# TODO: re-enable server once CVEs are resolved
# - dask-sql-server = dask_sql.server.app:main
- dask-sql-server = dask_sql.server.app:main
- dask-sql = dask_sql.cmd:main
string: py_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script: {{ PYTHON }} -m pip install . --no-deps -vv
Expand Down Expand Up @@ -46,8 +45,7 @@ test:
- dask_sql
commands:
- pip check
# TODO: re-enable server once CVEs are resolved
# - dask-sql-server --help
- dask-sql-server --help
- dask-sql --help
requires:
- pip
Expand Down
7 changes: 2 additions & 5 deletions dask_sql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
from .cmd import cmd_loop
from .context import Context
from .datacontainer import Statistics

# from .server.app import run_server
from .server.app import run_server

__version__ = get_versions()["version"]
del get_versions

# TODO: re-enable server once CVEs are resolved
# __all__ = [__version__, cmd_loop, Context, run_server, Statistics]
__all__ = [__version__, cmd_loop, Context, Statistics]
__all__ = [__version__, cmd_loop, Context, run_server, Statistics]
2 changes: 1 addition & 1 deletion dask_sql/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def run_server(
from dask_sql.server.app import run_server

self.stop_server()
self.sql_server = run_server(
self.server = run_server(
context=self,
client=client,
host=host,
Expand Down
3 changes: 0 additions & 3 deletions dask_sql/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,6 @@ def _init_app(
context: Context = None,
client: dask.distributed.Client = None,
):
# TODO: re-enable server once CVEs are resolved
raise NotImplementedError

app.c = context or Context()
app.future_list = {}

Expand Down
4 changes: 0 additions & 4 deletions docs/source/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
SQL Server
==========

.. warning::

``dask-sql``'s SQL server functionality is currently exploitable and has been disabled until the exposed vulnerabilities can be resolved.

``dask-sql`` comes with a small test implementation for a SQL server.
Instead of rebuilding a full ODBC driver, we re-use the `presto wire protocol <https://github.com/prestodb/presto/wiki/HTTP-Protocol>`_.

Expand Down
5 changes: 5 additions & 0 deletions planner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
<artifactId>avatica-core</artifactId>
<version>1.20.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.apiguardian</groupId>
<artifactId>apiguardian-api</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def build(self):
},
entry_points={
"console_scripts": [
# TODO: re-enable server once CVEs are resolved
# "dask-sql-server = dask_sql.server.app:main",
"dask-sql-server = dask_sql.server.app:main",
"dask-sql = dask_sql.cmd:main",
]
},
Expand Down
16 changes: 0 additions & 16 deletions tests/integration/test_cve_fix.py

This file was deleted.

5 changes: 0 additions & 5 deletions tests/integration/test_jdbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
from dask_sql.server.app import _init_app, app
from dask_sql.server.presto_jdbc import create_meta_data

# TODO: re-enable server once CVEs are resolved
pytest.skip(
"SQL server is disabled until related CVEs are resolved", allow_module_level=True
)

# needed for the testclient
pytest.importorskip("requests")

Expand Down
63 changes: 29 additions & 34 deletions tests/integration/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
from dask_sql import Context
from dask_sql.server.app import _init_app, app

# TODO: re-enable server once CVEs are resolved
pytest.skip(
"SQL server is disabled until related CVEs are resolved", allow_module_level=True
)

# needed for the testclient
pytest.importorskip("requests")

Expand All @@ -28,35 +23,6 @@ def app_client():
app.client.close()


def get_result_or_error(app_client, response):
result = response.json()

assert "nextUri" in result
assert "error" not in result

status_url = result["nextUri"]
next_url = status_url

counter = 0
while True:
response = app_client.get(next_url)
assert response.status_code == 200

result = response.json()

if "nextUri" not in result:
break

next_url = result["nextUri"]

counter += 1
assert counter <= 100

sleep(0.1)

return result


def test_routes(app_client):
assert app_client.post("/v1/statement", data="SELECT 1 + 1").status_code == 200
assert app_client.get("/v1/statement", data="SELECT 1 + 1").status_code == 405
Expand Down Expand Up @@ -208,3 +174,32 @@ def test_inf_table(app_client, user_table_inf):
assert len(result["data"]) == 3
assert result["data"][1] == ["+Infinity"]
assert "error" not in result


def get_result_or_error(app_client, response):
result = response.json()

assert "nextUri" in result
assert "error" not in result

status_url = result["nextUri"]
next_url = status_url

counter = 0
while True:
response = app_client.get(next_url)
assert response.status_code == 200

result = response.json()

if "nextUri" not in result:
break

next_url = result["nextUri"]

counter += 1
assert counter <= 100

sleep(0.1)

return result

0 comments on commit 37ea6b6

Please sign in to comment.