-
Notifications
You must be signed in to change notification settings - Fork 459
[aw] Decouple Process Safe Outputs client token from project-specific token #45999
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
Changes from all commits
72a976c
e136e17
9ae4b93
65dfd4e
ea7118f
bb6e74c
8866a06
5af8ac4
60abf42
0b13b43
454e9c1
9e55343
a653044
e21b4d9
34ad470
f079e87
6e445b0
f13f053
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,24 +272,18 @@ func (c *Compiler) buildHandlerManagerStep(data *WorkflowData) ([]string, error) | |
| } | ||
|
|
||
| // With section for github-token | ||
| // Use the standard safe outputs token for all operations. | ||
| // If project operations are configured, prefer the project token for the github-script client. | ||
| // Rationale: update_project/create_project_status_update call the Projects v2 GraphQL API, which | ||
| // cannot be accessed with the default GITHUB_TOKEN. GH_AW_PROJECT_GITHUB_TOKEN is the required | ||
| // token for Projects v2 operations. | ||
| // Use the standard safe-outputs token for the shared github-script client. | ||
| // Project operations use GH_AW_PROJECT_GITHUB_TOKEN from env with dedicated handler logic. | ||
| steps = append(steps, " with:\n") | ||
| // Token precedence for the handler manager step: | ||
| // 1. Project token (if project operations are configured) - already set above | ||
| // 2. Safe-outputs level token (so.GitHubToken) | ||
| // 3. Magic secret fallback via getEffectiveSafeOutputGitHubToken() | ||
| // 1. Safe-outputs level token (so.GitHubToken) | ||
| // 2. Magic secret fallback via getEffectiveSafeOutputGitHubToken() | ||
| // | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctness regression: project handlers lose project PAT when no per-handler github-token is configuredThis change decouples the step-level Broken scenario: safe-outputs:
update-project:
project: https://github.com/orgs/myorg/projects/1
# No github-token — user expects secrets.GH_AW_PROJECT_GITHUB_TOKEN to be usedPreviously, Suggested fix: In Also, the comment in @copilot please address this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 60abf42 and prior commits: project handlers now get |
||
| // Note: We do NOT fall back to per-output tokens (add-comment, create-issue, etc.) | ||
| // because those are specific to their operations. The handler manager needs a | ||
| // general-purpose token for the github-script client. | ||
| configToken := "" | ||
| if projectToken != "" { | ||
| configToken = projectToken | ||
| } else if data.SafeOutputs != nil && data.SafeOutputs.GitHubToken != "" { | ||
| if data.SafeOutputs != nil && data.SafeOutputs.GitHubToken != "" { | ||
| configToken = data.SafeOutputs.GitHubToken | ||
| } | ||
| c.addSafeOutputGitHubTokenForConfig(&steps, data, configToken) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 60abf42 and prior commits: runtime project-handler auth is now wired through per-handler token fallback/client rebinding, so project operations no longer depend on the shared step-level client token path.