Skip to content

Capture request headers in the audit topic #1027

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

Open
2 tasks done
yeikel opened this issue Apr 15, 2025 · 4 comments
Open
2 tasks done

Capture request headers in the audit topic #1027

yeikel opened this issue Apr 15, 2025 · 4 comments
Assignees
Labels
area/audit scope/backend Related to backend changes status/triage/completed Automatic triage completed type/enhancement En enhancement/improvement to an already existing feature

Comments

@yeikel
Copy link
Collaborator

yeikel commented Apr 15, 2025

Issue submitter TODO list

  • I've searched for an already existing issues here
  • I'm running a supported version of the application which is listed here and the feature is not present there

Is your proposal related to a problem?

I expose the UI behind a proxy that receives and forwards the request. This proxy includes additional and meaningful headers in the request that are currently not captured.

That causes the following data to be persisted in the audit logs that is not enough to trace/audit the usage :

{
	"timestamp": "2025-04-15T20:05:09.872497460Z",
	"username": "Unknown",
	"clusterName": "kafka-cluster",
	"resources": [],
	"operation": "getTopics",
	"result": {
		"success": true
	}
}

Describe the feature you're interested in

  1. Add a new entry in the configuration to specify the list of headers to log. For example, a tentative name could be audit-request-headers-properties

For example:

kafka:
  clusters:
    - name: local
      audit:
        topic-audit-enabled: true
        console-audit-enabled: true
        # The other properties were omitted for brevity
        # A list of request headers that should be persisted if present in the request
        audit-request-headers-properties:
          - User-Agent
          - my-custom-header    
  1. Read and persist the headers in the audit log under a new configuration property such as requestHeaders
{
	"timestamp": "2025-04-15T20:05:09.872497460Z",
	"username": "Unknown",
	"clusterName": "kafka-cluster",
	"resources": [],
        "requestHeaders": {
         "User-Agent" : "PostmanRuntime/7.30.0",
         "my-custom-header" : "the custom value"
}, 
	"operation": "getTopics",
	"result": {
		"success": true
	}
}

Describe alternatives you've considered

I considered to this audit at my proxy but it will split the audit to two different places

Version you're running

b71a753

Additional context

No response

@yeikel yeikel added status/triage Issues pending maintainers triage type/feature A brand new feature labels Apr 15, 2025
@kapybro kapybro bot added area/audit status/triage/manual Manual triage in progress status/triage/completed Automatic triage completed and removed status/triage Issues pending maintainers triage labels Apr 15, 2025
@yeikel
Copy link
Collaborator Author

yeikel commented Apr 15, 2025

@Haarolean What are your thoughts about this one? I'd be interested to implement it if accepted

@germanosin
Copy link
Member

@yeikel Thanks again for your contribution! Appreciate the feature description. Just one small addition from my side — let's include these headers only if they’re explicitly enabled in the config and specified as a list.

@yeikel
Copy link
Collaborator Author

yeikel commented Apr 16, 2025

@yeikel Thanks again for your contribution! Appreciate the feature description. Just one small addition from my side — let's include these headers only if they’re explicitly enabled in the config and specified as a list.

Thank you for the feedback @germanosin

I updated the issue to reflect these changes. Could you please re-review and share any other feedback?

Also, please confirm if I can pick this up to send a PR :)

@Haarolean
Copy link
Member

@Haarolean What are your thoughts about this one? I'd be interested to implement it if accepted

sure thing!

@Haarolean Haarolean added type/enhancement En enhancement/improvement to an already existing feature scope/backend Related to backend changes and removed type/feature A brand new feature status/triage/manual Manual triage in progress labels Apr 16, 2025
@Haarolean Haarolean moved this to In Development in Up for grabs Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/audit scope/backend Related to backend changes status/triage/completed Automatic triage completed type/enhancement En enhancement/improvement to an already existing feature
Projects
Status: In Development
Development

No branches or pull requests

3 participants