fix(ingest): mask password in info-level logs (#2835)

This commit is contained in:
Harshal Sheth 2021-07-06 16:41:54 -07:00 committed by GitHub
parent 288d17f07e
commit 6b59cdeb82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -504,7 +504,7 @@ source:
options: # options is same as above options: # options is same as above
# See https://github.com/mxmzdlv/pybigquery#authentication for details. # See https://github.com/mxmzdlv/pybigquery#authentication for details.
credentials_path: "/path/to/keyfile.json" # optional credentials_path: "/path/to/keyfile.json" # optional
include_views: True # whether to include views, defaults to True include_views: True # whether to include views, defaults to True
# table_pattern/schema_pattern is same as above # table_pattern/schema_pattern is same as above
``` ```

View File

@ -71,7 +71,7 @@ def ingest(config: str) -> None:
pipeline_config = load_config_file(config_file) pipeline_config = load_config_file(config_file)
try: try:
logger.info(f"Using config: {pipeline_config}") logger.debug(f"Using config: {pipeline_config}")
pipeline = Pipeline.create(pipeline_config) pipeline = Pipeline.create(pipeline_config)
except ValidationError as e: except ValidationError as e:
click.echo(e, err=True) click.echo(e, err=True)

View File

@ -4,6 +4,7 @@ from dataclasses import dataclass, field
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type
from urllib.parse import quote_plus from urllib.parse import quote_plus
import pydantic
from sqlalchemy import create_engine, inspect from sqlalchemy import create_engine, inspect
from sqlalchemy.engine.reflection import Inspector from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.sql import sqltypes as types from sqlalchemy.sql import sqltypes as types
@ -116,7 +117,7 @@ class SQLAlchemyConfig(ConfigModel):
class BasicSQLAlchemyConfig(SQLAlchemyConfig): class BasicSQLAlchemyConfig(SQLAlchemyConfig):
username: Optional[str] = None username: Optional[str] = None
password: Optional[str] = None password: Optional[pydantic.SecretStr] = None
host_port: str host_port: str
database: Optional[str] = None database: Optional[str] = None
scheme: str scheme: str
@ -125,7 +126,7 @@ class BasicSQLAlchemyConfig(SQLAlchemyConfig):
return make_sqlalchemy_uri( return make_sqlalchemy_uri(
self.scheme, self.scheme,
self.username, self.username,
self.password, self.password.get_secret_value() if self.password else None,
self.host_port, self.host_port,
self.database, self.database,
uri_opts=uri_opts, uri_opts=uri_opts,