-
Notifications
You must be signed in to change notification settings - Fork 32
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
opt: make clear logs #394
opt: make clear logs #394
Conversation
@@ -1586,14 +1591,14 @@ | |||
} | |||
|
|||
rollback := func(err error, inMemoryData *inMemoryData) { | |||
log.Errorf("need rollback, err: %+v", err) | |||
log.Errorf("txn %d need rollback, commitSeq: %d, label: %s, err: %+v", | |||
inMemoryData.TxnId, inMemoryData.CommitSeq, inMemoryData.Label, err) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Sensitive data returned by an access to Passwd
Sensitive data returned by an access to Passwd
Sensitive data returned by an access to Passwd
Sensitive data returned by an access to Passwd
Sensitive data returned by an access to Passwd
Sensitive data returned by an access to Passwd
Sensitive data returned by an access to Passwd
Copilot Autofix AI 6 days ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
@@ -857,13 +855,13 @@ | |||
} | |||
|
|||
func (rpc *singleFeClient) GetDbMeta(spec *base.Spec) (*festruct.TGetMetaResult_, error) { | |||
log.Debugf("GetMetaDb, addr: %s, spec: %s", rpc.Address(), spec) | |||
log.Tracef("GetMetaDb, addr: %s, spec: %s", rpc.Address(), spec) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Sensitive data returned by an access to Password
Sensitive data returned by an access to password
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 7 days ago
To fix the problem, we need to ensure that sensitive information, such as passwords, is not logged in clear text. We can achieve this by either omitting the sensitive information from the logs or obfuscating it before logging. In this case, we will omit the sensitive information from the logs to maintain security.
We will modify the logging statements in the pkg/rpc/fe.go
file to exclude the Password
field from the spec
object. Specifically, we will update the logging statements on lines 820, 829, 858, 864, and 878 to ensure that sensitive information is not logged.
-
Copy modified line R820 -
Copy modified line R858 -
Copy modified line R864 -
Copy modified line R878
@@ -819,3 +819,3 @@ | ||
func (rpc *singleFeClient) GetMasterToken(spec *base.Spec) (*festruct.TGetMasterTokenResult_, error) { | ||
log.Tracef("Call GetMasterToken, addr: %s, spec: %s", rpc.Address(), spec) | ||
log.Tracef("Call GetMasterToken, addr: %s, user: %s", rpc.Address(), spec.User) | ||
|
||
@@ -857,3 +857,3 @@ | ||
func (rpc *singleFeClient) GetDbMeta(spec *base.Spec) (*festruct.TGetMetaResult_, error) { | ||
log.Tracef("GetMetaDb, addr: %s, spec: %s", rpc.Address(), spec) | ||
log.Tracef("GetMetaDb, addr: %s, user: %s", rpc.Address(), spec.User) | ||
|
||
@@ -863,3 +863,3 @@ | ||
func (rpc *singleFeClient) GetTableMeta(spec *base.Spec, tableIds []int64) (*festruct.TGetMetaResult_, error) { | ||
log.Tracef("GetMetaTable, addr: %s, tableIds: %v", rpc.Address(), tableIds) | ||
log.Tracef("GetMetaTable, addr: %s, user: %s, tableIds: %v", rpc.Address(), spec.User, tableIds) | ||
|
||
@@ -877,3 +877,3 @@ | ||
func (rpc *singleFeClient) GetBackends(spec *base.Spec) (*festruct.TGetBackendMetaResult_, error) { | ||
log.Tracef("GetBackends, addr: %s, spec: %s", rpc.Address(), spec) | ||
log.Tracef("GetBackends, addr: %s, user: %s", rpc.Address(), spec.User) | ||
|
@@ -877,7 +875,7 @@ | |||
} | |||
|
|||
func (rpc *singleFeClient) GetBackends(spec *base.Spec) (*festruct.TGetBackendMetaResult_, error) { | |||
log.Debugf("GetBackends, addr: %s, spec: %s", rpc.Address(), spec) | |||
log.Tracef("GetBackends, addr: %s, spec: %s", rpc.Address(), spec) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Sensitive data returned by an access to Password
Sensitive data returned by an access to password
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 7 days ago
To fix the problem, we need to ensure that sensitive information such as passwords is not logged in clear text. The best way to fix this without changing existing functionality is to modify the logging statements to exclude the sensitive information. Specifically, we should remove the password from the spec
object before logging it.
- In the file
pkg/rpc/fe.go
, modify the logging statements in theGetDbMeta
,GetTableMeta
, andGetBackends
methods to exclude the password. - In the file
cmd/thrift_get_meta/thrift_get_meta.go
, ensure that thespec
object is not logged with sensitive information.
-
Copy modified line R858 -
Copy modified line R864 -
Copy modified line R878
@@ -857,3 +857,3 @@ | ||
func (rpc *singleFeClient) GetDbMeta(spec *base.Spec) (*festruct.TGetMetaResult_, error) { | ||
log.Tracef("GetMetaDb, addr: %s, spec: %s", rpc.Address(), spec) | ||
log.Tracef("GetMetaDb, addr: %s, user: %s, db: %s", rpc.Address(), spec.User, spec.Database) | ||
|
||
@@ -863,3 +863,3 @@ | ||
func (rpc *singleFeClient) GetTableMeta(spec *base.Spec, tableIds []int64) (*festruct.TGetMetaResult_, error) { | ||
log.Tracef("GetMetaTable, addr: %s, tableIds: %v", rpc.Address(), tableIds) | ||
log.Tracef("GetMetaTable, addr: %s, user: %s, tableIds: %v", rpc.Address(), spec.User, tableIds) | ||
|
||
@@ -877,3 +877,3 @@ | ||
func (rpc *singleFeClient) GetBackends(spec *base.Spec) (*festruct.TGetBackendMetaResult_, error) { | ||
log.Tracef("GetBackends, addr: %s, spec: %s", rpc.Address(), spec) | ||
log.Tracef("GetBackends, addr: %s, user: %s, cluster: %s", rpc.Address(), spec.User, spec.Cluster) | ||
|
No description provided.