Skip to content

Avoid process-wide cwd changes in authorization verification - #79737

Merged
pelikhan merged 3 commits into
mainfrom
copilot/graft-intelligence-daily-update-2026-11-19
Nov 21, 2026
Merged

pelikhan merged 3 commits into
mainfrom
copilot/graft-intelligence-daily-update-2026-11-19

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Authorization verification changed the process working directory to compile an isolated candidate snapshot, risking interference with concurrent work. The snapshot root is already passed explicitly through the verifier and compiler.

  • Verification: Remove the os.Getwd/os.Chdir save-and-restore sequence and use the explicit snapshot root.
  • Coverage: Add a test that verifies a snapshot from a separate caller directory and checks that the caller’s working directory remains unchanged.

@gh-aw-bot gh-aw-bot changed the title [WIP] Update daily graft intelligence report for 2026-11-19 Avoid process-wide cwd changes in authorization verification Nov 21, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 21, 2026 15:48
Copilot AI adaptive review requested due to automatic review settings November 21, 2026 15:48
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #79737 · codex · routed: gpt61 medium · ~3 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot fix ci failures

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #79737 · copilot · gpt56 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-1c4da1dc-a449-4ea3-9861-37a150898196","parents":[],"payload":{"id":"ldg-414a7f39-4c03-4930-acf3-43311f471a20","operation":"append","value":{"finding_count":0,"head_sha":"4cdf1c52da6ec739506e83e9cb885c4d36f056c8","outcome":"aligned"}},"sha":"sha256:d9ca609c4e0f24804a659b1114160dcd1cf2de324374bf25fb3919297e4d9b1f","timestamp":"2026-11-21T15:55:52.913Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the changed authorization verification path and its regression test. I found no actionable correctness, security, or maintainability issues on the changed lines.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-fd8ff81d-9f4b-4e98-9b45-199402ff1150","parents":[],"payload":{"id":"ldg-98bdc5a3-67aa-4dde-bcee-fab138667e93","operation":"append","value":{"finding_count":0,"head_sha":"4cdf1c52da6ec739506e83e9cb885c4d36f056c8","outcome":"no_findings"}},"sha":"sha256:96d88bf2ecc366c6aab0aca3a53e04032c99219954f672f9ad760077e9649d23","timestamp":"2026-11-21T15:56:50.676Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /tdd and /diagnosing-bugs. The production change is correct: the verifier passes gitRoot explicitly, so the remaining os.Getwd fallbacks are not reached here. One inline suggestion: the new test does not fail on the pre-fix code.

📋 Key Themes & Highlights

Key Themes

  • Weak regression test: the post-call cwd check passes before and after the fix.

Positive Highlights

  • ✅ Removing the process-wide chdir also removes the restore-failure path.
  • ✅ go test ./pkg/cli -run TestAuthorization and go vet ./pkg/cli pass.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again


after, err := os.Getwd()
require.NoError(t, err)
require.Equal(t, before, after)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/tdd] This test also passes on the pre-fix code, so it does not guard the regression. The old deferred chdir restores the directory before the post-call os.Getwd runs, so the check cannot see a mid-verification change.

💡 Suggested test shape

Sample the cwd from a goroutine while verification runs. Pre-fix code failed this check in 3 of 3 runs; the fixed code passed 3 of 3.

var moved atomic.Value
done := make(chan struct{})
sampled := make(chan struct{})
go func() {
    defer close(sampled)
    for {
        select {
        case <-done:
            return
        default:
        }
        if cwd, err := os.Getwd(); err != nil || cwd != before {
            moved.Store(cwd)
            return
        }
        time.Sleep(10 * time.Microsecond)
    }
}()
verifyAuthorizationCandidateDirectory(cmd, snapshot, mustParseAuthorizationPolicy(t), result)
close(done)
<-sampled
require.Nil(t, moved.Load(), "process cwd changed during verification")

Keep the post-call check too. The sampler is timing-based, but the old chdir window spans the whole verification call, so it is reliably caught.

@copilot please address this.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The test only checks the final working directory, so it misses temporary process-wide changes during verification that can interfere with concurrent work.

1 open issue
What changed in this PR

This PR makes gh-aw authorization verification use the explicit snapshot root instead of changing the process-wide working directory, addressing the interference risk highlighted in #79329.

Changes:

  • Remove working-directory save, change, and restore logic.
  • Add a test that verifies a snapshot from a separate caller directory and checks the working directory after verification.
File Description
pkg/​cli/​authorization_policy_test.go Tests verification from a separate caller directory.
pkg/​cli/​authorization_command.go Removes process-wide working-directory changes.

Review effort: Max (adaptive)


after, err := os.Getwd()
require.NoError(t, err)
require.Equal(t, before, after)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@copilot fix ci failures

Fixed the stale taint-summary hash and added coverage in 2a1b054. The failing source-identity test passes locally; native parser tests could not run because the configured npm feed was unreachable.

Copilot AI requested a review from pelikhan November 21, 2026 16:33
@pelikhan
pelikhan merged commit 86a8c8e into main Nov 21, 2026
64 of 65 checks passed
@pelikhan
pelikhan deleted the copilot/graft-intelligence-daily-update-2026-11-19 branch November 21, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[graft-intelligence] Daily Graft Intelligence: 2026-11-19

4 participants