-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
chore: add logs to db test connection and post failures #13223
Changes from 6 commits
a6f9c78
d59e224
07c3fb3
9a84f7e
df6d508
732a638
0bf3b38
dc1d2c4
94e17d3
9fa0f73
99c5eca
65dadfd
12c9acc
eb697ec
23d9411
0af5cab
23a7a6f
42ae1cd
d323eb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,6 +238,7 @@ def post(self) -> Response: | |
except DatabaseInvalidError as ex: | ||
return self.response_422(message=ex.normalized_messages()) | ||
except DatabaseConnectionFailedError as ex: | ||
logger.warning("Database connection failed: %s", item["sqlalchemy_uri"]) | ||
return self.response_422(message=str(ex)) | ||
except DatabaseCreateFailedError as ex: | ||
logger.error( | ||
|
@@ -607,6 +608,7 @@ def test_connection( # pylint: disable=too-many-return-statements | |
TestConnectionDatabaseCommand(g.user, item).run() | ||
return self.response(200, message="OK") | ||
except DatabaseTestConnectionFailedError as ex: | ||
logger.warning(ex) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this log will read out the following: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is one possible error message - others are not so innocuous and include username and password information. We've seen that with a few different database engines. |
||
return self.response_422(message=str(ex)) | ||
|
||
@expose("/<int:pk>/related_objects/", methods=["GET"]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log will be masked uri
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that
item["sqlalchemy_uri"
is only updated with the masked version if line 236 is reached - ifCreateDatabaseCommand(...).run()
fails, as we can expect if this code is reached, then I believe there's a good chance that the fullsqlalchemy_uri
will be logged.While the masked URI is better than the full URI, it still exposes username and additional connection information that it might be better not to have in logs.