Skip to content

James main dev 01#327

Closed
lstruman wants to merge 7 commits into
mainfrom
james-main-dev-01
Closed

James main dev 01#327
lstruman wants to merge 7 commits into
mainfrom
james-main-dev-01

Conversation

@lstruman

Copy link
Copy Markdown
Contributor

No description provided.

lstruman added 6 commits July 14, 2026 00:20
…ogging of sensitive information'"

This reverts commit e98851e.
…ogging of sensitive information'"

This reverts commit dbb2aad.
…ogging of sensitive information'"

This reverts commit f3f60c5.
…ogging of sensitive information'"

This reverts commit d1d7181.
…ogging of sensitive information'"

This reverts commit df0fb2f.
Copilot AI review requested due to automatic review settings July 14, 2026 07:45
Comment thread http/webconfig_server.go Dismissed
Comment thread http/webconfig_server.go Dismissed
Comment thread http/webconfig_server.go Dismissed
Comment thread http/webconfig_server.go Dismissed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes logging behavior across the server by removing redaction/sanitization and logging more request/Kafka details (headers, device_id, and Kafka output payloads).

Changes:

  • Removed header-key filtering/redaction in util.HeaderToMap.
  • Removed sensitive-field sanitization in common.FilterLogFields.
  • Expanded Kafka and token-related logs in http/webconfig_server.go to include previously masked identifiers/payloads.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
util/dict.go Changes how HTTP headers are converted for logging (now unredacted and can panic on empty header values).
http/webconfig_server.go Logs more Kafka message/device information and changes token/header logging behavior.
common/log_fields.go Changes log field filtering from sanitizing/redacting to mostly pass-through cloning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread util/dict.go
Comment on lines 213 to 218
func HeaderToMap(header http.Header) map[string]string {
m := make(map[string]string)
for k, v := range header {
if !isSafeHeaderKey(k) {
m[k] = "****"
continue
}
if len(v) == 0 {
m[k] = ""
continue
}
m[k] = v[0]
}
return m
Comment thread http/webconfig_server.go
Comment on lines 1065 to 1067
if len(m.DeviceId) != 16 {
log.WithFields(tfields).Warn("invalid device_id")
log.WithFields(tfields).Warn("invalid device_id " + m.DeviceId)
continue
Comment thread http/webconfig_server.go
Comment on lines +1086 to 1088
tfields["output_key"] = mac
tfields["output_body"] = m
log.WithFields(tfields).Info("send")
Comment thread http/webconfig_server.go
Comment on lines 1093 to 1098
fields := xw.Audit()
fields["logger"] = "token"
tfields := common.FilterLogFields(fields)
delete(tfields, "header")
var headerMap map[string]string
var isObfuscated bool
if itf, ok := tfields["header"]; ok {
Comment thread common/log_fields.go
Comment on lines 48 to 66
func FilterLogFields(src log.Fields, excludes ...string) log.Fields {
fields := log.Fields{}
for k, v := range src {
switch ty := v.(type) {
case map[string]string:
fields[k] = maps.Clone(ty)
case map[string]interface{}:
fields[k] = maps.Clone(ty)
case string:
if slices.Contains(nonEmptyFields, k) {
if len(ty) > 0 {
fields[k] = sanitizeLogValue(k, ty)
fields[k] = ty
}
} else {
fields[k] = sanitizeLogValue(k, ty)
fields[k] = ty
}
case map[string]string:
fields[k] = sanitizeLogValue(k, maps.Clone(ty))
case map[string]interface{}:
fields[k] = sanitizeLogValue(k, maps.Clone(ty))
default:
fields[k] = sanitizeLogValue(k, ty)
fields[k] = ty
}
Copilot AI review requested due to automatic review settings July 14, 2026 07:58
@lstruman lstruman closed this Jul 14, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants