Skip to content

Commit b880bb3

Browse files
authored
Quote password in the PostgreSQL connection string (#457)
* quote password * update change log
1 parent 5e1ea82 commit b880bb3

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

CHANGES.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010

1111
### Fixed
1212

13+
## [2.4.2]
14+
15+
### Added
16+
17+
### Changed
18+
19+
### Removed
20+
21+
### Fixed
22+
23+
* Quote password in pgsql strings to accomodate special characters. [455](https://github.com/stac-utils/stac-fastapi/issues/455)
24+
1325
## [2.4.1]
1426

1527
### Added
@@ -19,6 +31,7 @@
1931
### Removed
2032

2133
### Fixed
34+
2235
* `ciso8601` fails to build in some environments, instead use `pyiso8601` to parse datetimes.
2336

2437
## [2.4.0]
@@ -43,11 +56,12 @@
4356
* docker-compose now runs uvicorn with hot-reloading enabled
4457
* Bump version of PGStac to 0.6.2 that includes support for hydrating results in the API backed ([#397](https://github.com/stac-utils/stac-fastapi/pull/397))
4558
* Make item geometry and bbox nullable in sqlalchemy backend. ([#398](https://github.com/stac-utils/stac-fastapi/pull/398))
46-
* Transactions Extension update Item endpoint Item is now `/collections/{collection_id}/items/{item_id}` instead of
59+
* Transactions Extension update Item endpoint Item is now `/collections/{collection_id}/items/{item_id}` instead of
4760
`/collections/{collection_id}/items` to align with [STAC API
4861
spec](https://github.com/radiantearth/stac-api-spec/tree/main/ogcapi-features/extensions/transaction#methods) ([#425](https://github.com/stac-utils/stac-fastapi/pull/425))
4962

5063
### Removed
64+
5165
* Remove the unused `router_middleware` function ([#439](https://github.com/stac-utils/stac-fastapi/pull/439))
5266

5367
### Fixed
@@ -60,7 +74,7 @@
6074
* SQLAlchemy backend bulk item insert now works ([#356](https://github.com/stac-utils/stac-fastapi/issues/356))
6175
* PGStac Backend has stricter implementation of Fields Extension syntax ([#397](https://github.com/stac-utils/stac-fastapi/pull/397))
6276
* `/queryables` endpoint now has type `application/schema+json` instead of `application/json` ([#421](https://github.com/stac-utils/stac-fastapi/pull/421))
63-
* Transactions Extension update Item endpoint validates that the `{collection_id}` path parameter matches the Item `"collection"` property
77+
* Transactions Extension update Item endpoint validates that the `{collection_id}` path parameter matches the Item `"collection"` property
6478
from the request body, if present, and falls back to using the path parameter if no `"collection"` property is found in the body
6579
([#425](https://github.com/stac-utils/stac-fastapi/pull/425))
6680
* PGStac Backend Transactions endpoints return added Item/Collection instead of Item/Collection from request ([#424](https://github.com/stac-utils/stac-fastapi/pull/424))
@@ -99,7 +113,6 @@
99113
* Expanded on tests to ensure properly testing get and post searches ([#318](https://github.com/stac-utils/stac-fastapi/pull/318))
100114
* Ensure invalid datetimes result in 400s ([#323](https://github.com/stac-utils/stac-fastapi/pull/323))
101115

102-
103116
## [2.2.0]
104117

105118
### Added
@@ -161,13 +174,15 @@
161174
* Update pgstac to return 400 on invalid date parameter ([#240](https://github.com/stac-utils/stac-fastapi/pull/240))
162175

163176
## [2.0.0]
177+
164178
_2021-07_
165179

166180
* Refactor stac-fastapi into submodules ([#106](https://github.com/)stac-utils/stac-fastapi/pull/106)
167181
* Add pgstac backend ([#126](https://github.com/stac-utils/stac-fastapi/pull/126))
168182
* Upgrade to stac-pydantic 2.0.0 and stac-spec 1.0.0 ([#181](https://github.com/stac-utils/stac-fastapi/pull/181))
169183

170184
## [1.1.0]
185+
171186
_2021-01-28_
172187

173188
* Improve how the library declares API extensions ([#54](https://github.com/stac-utils/arturo-stac-api/pull/54))
@@ -178,11 +193,11 @@ _2021-01-28_
178193
* Fix `pre-commit` config ([#75](https://github.com/stac-utils/arturo-stac-api/pull/75))
179194

180195
## [1.0.0]
196+
181197
_2020-09-25_
182198

183199
* First PyPi release!
184200

185-
[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/2.2.0..main>
186201
[2.2.0]: <https://github.com/stac-utils/stac-fastapi/compare/2.1.1..2.2.0>
187202
[2.1.1]: <https://github.com/stac-utils/stac-fastapi/compare/2.1.0..2.1.1>
188203
[2.1.0]: <https://github.com/stac-utils/stac-fastapi/compare/2.1.0..main>

stac_fastapi/pgstac/stac_fastapi/pgstac/config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Postgres API configuration."""
22

33
from typing import Type
4+
from urllib.parse import quote
45

56
from stac_fastapi.pgstac.types.base_item_cache import (
67
BaseItemCache,
@@ -42,14 +43,14 @@ class Settings(ApiSettings):
4243
@property
4344
def reader_connection_string(self):
4445
"""Create reader psql connection string."""
45-
return f"postgresql://{self.postgres_user}:{self.postgres_pass}@{self.postgres_host_reader}:{self.postgres_port}/{self.postgres_dbname}"
46+
return f"postgresql://{self.postgres_user}:{quote(self.postgres_pass)}@{self.postgres_host_reader}:{self.postgres_port}/{self.postgres_dbname}"
4647

4748
@property
4849
def writer_connection_string(self):
4950
"""Create writer psql connection string."""
50-
return f"postgresql://{self.postgres_user}:{self.postgres_pass}@{self.postgres_host_writer}:{self.postgres_port}/{self.postgres_dbname}"
51+
return f"postgresql://{self.postgres_user}:{quote(self.postgres_pass)}@{self.postgres_host_writer}:{self.postgres_port}/{self.postgres_dbname}"
5152

5253
@property
5354
def testing_connection_string(self):
5455
"""Create testing psql connection string."""
55-
return f"postgresql://{self.postgres_user}:{self.postgres_pass}@{self.postgres_host_writer}:{self.postgres_port}/pgstactestdb"
56+
return f"postgresql://{self.postgres_user}:{quote(self.postgres_pass)}@{self.postgres_host_writer}:{self.postgres_port}/pgstactestdb"

0 commit comments

Comments
 (0)