Skip to content

Go SDK: Keep workload tokens out of task error logs - #69926

Closed
viiccwen wants to merge 1 commit into
apache:mainfrom
viiccwen:fix-go-sdk-start-task-token-logging
Closed

viiccwen wants to merge 1 commit into
apache:mainfrom
viiccwen:fix-go-sdk-start-task-token-logging

Conversation

@viiccwen

Copy link
Copy Markdown
Contributor

When the Go SDK worker received an HTTP error while starting a task, it logged the complete request headers. Because the API client carries the task-scoped bearer token in the Authorization header, the token was included in the task error log.

Limit the logged request details to an explicit allowlist containing the request path, method, and correlation ID. This preserves useful diagnostics without including request credentials, query parameters, or other headers.

The regression test sends a real HTTP request containing a bearer token to a test server, returns an HTTP 400 response, and verifies both that the request carried the token and that the resulting structured log contains neither the token nor the Authorization header.


Was generative AI tooling used to co-author this PR?
  • Yes - GPT-5.6 Sol

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@viiccwen
viiccwen force-pushed the fix-go-sdk-start-task-token-logging branch from 3dc02af to e6ce608 Compare July 16, 2026 12:17

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! LGTM overall.

Comment thread go-sdk/pkg/worker/runner_test.go
Comment thread go-sdk/pkg/worker/runner.go
Comment thread go-sdk/pkg/worker/runner_test.go
Comment thread go-sdk/pkg/worker/runner_test.go Outdated
Task logs can be available to readers who should not receive task-scoped API credentials. A start-task API failure must not widen access to the bearer token carried by the request.

Signed-off-by: viiccwen <vicwen@apache.org>
@viiccwen
viiccwen force-pushed the fix-go-sdk-start-task-token-logging branch from e6ce608 to 697a425 Compare July 20, 2026 08:11
@viiccwen

viiccwen commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Hello @jason810496 @uranusjr, politely tag for further review.

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, as #71874 was merged. We don't need this PR any more. Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants