Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
98ab826
ci(#7555): notify users when agent launch is unauthorized
ifireball Oct 8, 2026
6d7ac36
fix(#7555): scope authorization denial notices
ifireball Oct 8, 2026
fd9eefd
ci(#7555): satisfy workflow output lint
ifireball Oct 8, 2026
e51d6c4
fix(#7555): preserve CEL dispatch for legacy commands
ifireball Oct 11, 2026
40cf55e
fix(#7555): preserve denial notices after partial auth failure
ifireball Oct 11, 2026
181cba3
fix(#7555): align workflow and event mapping cleanup
ifireball Oct 11, 2026
620ea41
ci(#7555): harden authorization denial notices
ifireball Oct 11, 2026
656d21f
ci(#7555): close authorization routing gaps
ifireball Oct 11, 2026
d7a71e4
ci(#7555): cover generic CEL commands
ifireball Oct 11, 2026
99186dd
ci(#7555): preserve CEL denial notices
ifireball Oct 11, 2026
27d33d0
ci(#7555): notify on kill-switch pauses
ifireball Oct 15, 2026
012db96
ci(#7555): make dispatch decision metadata explicit
ifireball Oct 18, 2026
95482e8
ci(#7555): sync latest main
ifireball Oct 18, 2026
ae21cec
Merge remote-tracking branch 'origin/main' into codex/7555-authorizat…
ifireball Oct 18, 2026
f0cea58
ci(#7555): suppress denials for unavailable stages
ifireball Oct 18, 2026
4ba768d
test(#7555): classify authorization notice as non-agent job
ifireball Oct 18, 2026
9b444fa
Merge origin/main into codex/7555-authorization-denial-notice
ifireball Oct 22, 2026
ee95fda
fix(#7555): gate pause notices on matching launches
ifireball Oct 22, 2026
62af794
fix(#7555): remove obsolete existing PR gate
ifireball Oct 22, 2026
4a271d7
Merge origin/main into codex/7555-authorization-denial-notice
ifireball Oct 22, 2026
6060bd0
fix(#7555): gate denial notices on authorization and CEL matches
ifireball Oct 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
335 changes: 305 additions & 30 deletions .github/workflows/reusable-dispatch.yml

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions docs/contributing/ci-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,39 @@ When refactoring between action types, audit every `job.*` and `github.*` refere
- Never use `permissions: write-all` or omit permissions (which defaults to the repo's broad default token permissions).
- Separate jobs that need elevated permissions (e.g., `pull-requests: write`) from jobs that check out untrusted code.

### Serialized authorization notices

When multiple dispatch paths can detect the same authorization denial, route their
metadata to one notification job. The job should use the existing
`fullsend issues post-comment` command, backed by `forge.Client`, for marker
deduplication and comment creation. This may cost an additional runner, but it
keeps the check-and-create operation serialized and prevents legacy and CEL
dispatch paths from racing to create duplicate notices. The dispatch binary
should emit only the metadata needed by that job; it should not introduce a
second comment-posting implementation.

The CEL path requires both sides of the denial signal: the pre-CEL
authorization gate must reject the actor, and at least one harness trigger
must match the event. A role failure by itself is not a launch attempt, and a
CEL non-match is not an authorization failure; for example, an ordinary
comment without the harness's slash command remains silent. The execution
path still filters unauthorized harnesses before projecting refs. Dispatch
uses a separate non-dispatching trigger evaluation only to decide whether
denial metadata is warranted, and never emits refs from that probe.

### Kill-switch pause notices

An engaged `kill_switch` is an intentional repository-wide pause, not a
permission failure by the person who requested an agent. The reusable workflow
therefore keeps routing successful with an empty stage output, so an operator
does not create a red CI run for every event during the pause. Explicit human
launch commands still emit metadata to the serialized notification job. That
job uses the same `fullsend issues post-comment` path and work-item
concurrency, but a distinct `kill_switch` reason and marker, so the comment
explains that dispatch is temporarily disabled rather than claiming the actor
is unauthorized. Non-launch events do not produce comments, and callers must
use the stage output—not route-job success alone—to decide whether an agent ran.

## Secrets in pull_request_target jobs

Jobs triggered by `pull_request_target` that check out and execute PR-head code can expose secrets to untrusted authors. This is the well-documented "pwn request" vulnerability class. Five components form the attack chain:
Expand Down
8 changes: 7 additions & 1 deletion docs/contributing/config-source-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ enroll every repository. Base file: no.

## File fields a workflow reads too narrowly

The Go accessor layers these. The bash steps in `.github/workflows/reusable-dispatch.yml` read `.fullsend/config.yaml` and skip `config.base.yaml`. A baseline that exists only in the base file does not affect those steps. If `config.yaml` is missing, the role check exits without applying a base-file role list.
The Go accessor layers these. The bash steps in
`.github/workflows/reusable-dispatch.yml` still read only
`.fullsend/config.yaml` for the fields below and skip `config.base.yaml`. A
baseline that exists only in the base file does not affect those steps. The
kill switch is intentionally excluded from this gap: both GitHub and GitLab
now layer its direct read, and the GitHub workflow reports an explicit launch
attempt as a paused-dispatch notice rather than an authorization denial.

| Setting | Controls | Set from | Wins today | Read by | Decision | Base file? |
|---|---|---|---|---|---|---|
Expand Down
6 changes: 6 additions & 0 deletions docs/contributing/harness-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ a single-key map of that source to file overrides; a `plugins[]` entry can be
a path string or a `{path, env, pi}` map. Scalar security leaf values retain
their own validation and defaults; this type table does not override them.

Normalized-event actor metadata is separate from harness composition. The
optional `actor.numeric_id` is a stable forge-native identifier populated by
event adapters when available; it is suitable for identity-stable bookkeeping
but is not a harness field, a CEL authorization input, or a replacement for
the human-readable `actor.id`.

The planned `schema_version` field (absent = `1` once implemented) will declare
this contract; an incompatible field-type change will require a version bump
and an update to this table in the same change. Backward-compatible field
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/user/cel-triggers-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ When you register a custom agent and give it a `trigger` expression, fullsend ha

2. **Normalize.** The `gha-event` input driver converts the raw GitHub event into a [`NormalizedEvent`](../../normative/normalized-event/v1/) — a forge-neutral struct with fields like `event.entity.kind`, `event.transition.kind`, and `event.actor.role`.

3. **Authorize.** `fullsend dispatch` enforces the platform authorization gate before any agent is considered. Authorization is a platform-level decision — your CEL trigger does not need to implement permission checks (though you can add guards like `event.actor.role` if your agent has stricter requirements).
3. **Authorize.** `fullsend dispatch` enforces the platform authorization gate before any agent is considered. Authorization is a platform-level decision — your CEL trigger does not need to implement permission checks (though you can add guards like `event.actor.role` if your agent has stricter requirements). When a human launch is denied, Fullsend posts one explanatory comment for that user and work item; repeated denied attempts do not add duplicate comments.

4. **Enumerate.** Dispatch loads all registered agents from the merged repository-local config (the `agents:` list in `.fullsend/config.yaml`, optionally layered over `.fullsend/config.base.yaml`, plus scaffold discovery). Each harness with a non-empty `trigger` field is a candidate. If a registered agent's harness cannot be resolved or loaded, dispatch logs a GitHub Actions `::error::` annotation and skips that agent so other agents can still run. If every registered agent fails to load, `fullsend dispatch` exits non-zero instead of emitting an empty matrix — a fully unreadable harness set is a configuration error, not a "no trigger matched" result.

Expand Down
10 changes: 10 additions & 0 deletions docs/normative/normalized-event/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ remains the normative stricter check.
Adding a new `transition.kind` is **non-breaking** — CEL triggers use boolean
expressions, not exhaustive enum matching.

The optional `actor.numeric_id` field is an additive v1.x change under this
policy. Existing payloads without it remain valid; consumers with pinned strict
schema copies must update those copies before accepting payloads that include
the field.

Normalized-event and entity-context-snapshot v1 carry independently versioned
copies of the actor-role vocabulary. The entity-context-snapshot `bot` marker
is a non-authority kind marker, not a normalized-event repository permission,
Expand Down Expand Up @@ -238,6 +243,11 @@ gate denies a bot with `role_verified` set but no recognized `bot_role` on
non-label paths. The production adapters do not emit the fields yet, so
triggers that read them must guard with `has()`.

GitHub adapters also populate the optional `actor.numeric_id` from the event
sender's stable numeric account ID when it is present. This field is intended
for identity-stable bookkeeping such as notification deduplication; it is not
an authorization input and must not replace the login in user-facing mentions.

### Fork security (`state.change_proposal.is_fork`)

`is_fork` is `true` when `head_repo` differs from `base_repo` (fork-based
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@
"maxLength": 255,
Comment thread
ifireball marked this conversation as resolved.
Resolved
Comment thread
ifireball marked this conversation as resolved.
Resolved
"description": "Forge login or service account identifier."
},
"numeric_id": {
Comment thread
ifireball marked this conversation as resolved.
Resolved
Comment thread
ifireball marked this conversation as resolved.
Resolved
Comment thread
ifireball marked this conversation as resolved.
Resolved
Comment thread
ifireball marked this conversation as resolved.
Resolved
Comment thread
ifireball marked this conversation as resolved.
Resolved
Comment thread
ifireball marked this conversation as resolved.
Resolved
Comment thread
ifireball marked this conversation as resolved.
Resolved

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-schema

The new optional actor.numeric_id is additive (not in required), but the actor object sets additionalProperties: false, so consumers validating against a pinned copy of the v1 schema will reject events that carry the field. The README documents it as an additive v1.x change and warns pinned-copy consumers; the schema $id and version are unchanged.

Suggested fix: Keep the README note; consider a schema changelog entry.

"type": "integer",
"minimum": 1,
"description": "Optional stable forge-native numeric actor identifier. GitHub adapters populate this from the event sender; it is metadata for identity-stable external bookkeeping, not an authorization input."
},
"kind": {
"type": "string",
"enum": ["human", "bot"]
Expand Down
11 changes: 10 additions & 1 deletion docs/reference/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,16 @@ setup.
Emergency stop. When set to `true`, all agent dispatch is disabled for the
repository. Uses pointer semantics in the layered config system — `nil`
(omitted) falls through to parent; an explicit `false` is a local decision
that does not fall through.
that does not fall through. In the reusable GitHub dispatch workflow, an active
kill switch records a successful skip with an empty stage output rather than
failing the routing job; callers must use the stage output to determine whether
an agent ran. When a human explicitly requests an agent while the switch is
active, the workflow uses the shared notification job to post one explanatory
comment for that actor and work item. The comment says that dispatch is
temporarily paused, rather than incorrectly saying that the actor is
unauthorized. Ordinary events do not create pause comments. This keeps an
intentional emergency stop quiet at the CI level while still giving a person
who requested work an actionable explanation.

### `keep_history`

Expand Down
1 change: 1 addition & 0 deletions e2e/behaviour/features/dispatch/owners-auth.feature
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Feature: OWNERS file authorization for bash routing
And an issue
When the outsider posts "/fs-code" on the issue
Then the dispatch run does not authorize via OWNERS
And the issue has a comment containing "not authorized to launch Fullsend agents on this work item"

Scenario: Unlisted collaborator falls through to API authorization
Given an OWNERS file listing the outsider as a reviewer only
Expand Down
63 changes: 60 additions & 3 deletions internal/cli/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strconv"
"strings"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -103,17 +104,24 @@ func runDispatch(ctx context.Context, opts dispatchOpts) error {
return err
}

refs, err := harnessdispatch.Dispatch(ctx, harnessdispatch.Options{
result, err := harnessdispatch.DispatchResult(ctx, harnessdispatch.Options{
ConfigDir: opts.configDir,
Event: event,
})
if err != nil {
return err
}
Comment thread
ifireball marked this conversation as resolved.
Resolved
// Only gha-event has live GitHub authorization context. JSON evaluation
// remains read-only and never writes workflow notification metadata.
if inDriver == "gha-event" {
if err := writeDispatchOutput(event, result.AuthorizationDenied, result.DispatchBlockedReason); err != nil {
return err
}
}

switch strings.ToLower(opts.outputDriver) {
case "gha-matrix", "":
data, err := output.WriteGHAMatrix(refs)
data, err := output.WriteGHAMatrix(result.Refs)
if err != nil {
return err
}
Expand All @@ -124,11 +132,60 @@ func runDispatch(ctx context.Context, opts dispatchOpts) error {
fmt.Println()
}
case "json":
if err := output.WriteJSON(os.Stdout, refs); err != nil {
if err := output.WriteJSON(os.Stdout, result.Refs); err != nil {
return err
}
default:
return fmt.Errorf("unknown output driver %q", opts.outputDriver)
}
return nil
}

func writeDispatchOutput(event *normevent.Event, denied bool, blockedReason string) error {
Comment thread
ifireball marked this conversation as resolved.
Resolved
if !isExplicitHumanSlashCommand(event) || (!denied && blockedReason != "kill_switch") {
return nil
}
path := os.Getenv("GITHUB_OUTPUT")
if path == "" || event.Entity.ID < 1 || event.Actor.NumericID < 1 || !validGitHubLogin(event.Actor.ID) {
return nil
}

outputs := [][2]string{
{"authorization_actor", event.Actor.ID},
{"authorization_actor_id", strconv.FormatInt(event.Actor.NumericID, 10)},
{"authorization_number", strconv.Itoa(event.Entity.ID)},
}
if blockedReason == "kill_switch" {
outputs = append([][2]string{{"dispatch_blocked_reason", blockedReason}}, outputs...)
} else {
outputs = append([][2]string{{"authorization_denied", "true"}}, outputs...)
}
for _, output := range outputs {
if err := writeGitHubOutput(path, output[0], output[1]); err != nil {
return fmt.Errorf("write authorization output %s: %w", output[0], err)
}
}
return nil
}

func isExplicitHumanSlashCommand(event *normevent.Event) bool {
if event == nil || event.Source.RawType != "issue_comment" ||
event.Transition.Kind != normevent.TransitionCommentAdded ||
event.Actor.Kind != normevent.ActorHuman || event.Transition.Comment == nil {
return false
}
command := strings.TrimSpace(event.Transition.Comment.Command)
return strings.HasPrefix(command, "/") && len(command) > 1
}

func validGitHubLogin(login string) bool {
if login == "" {
return false
}
for _, r := range login {
if (r < 'A' || r > 'Z') && (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '_' && r != '-' {
return false
}
}
return true
}
134 changes: 134 additions & 0 deletions internal/cli/dispatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,142 @@ import (
"gopkg.in/yaml.v3"

"github.com/fullsend-ai/fullsend/internal/config"
"github.com/fullsend-ai/fullsend/internal/normevent"
)

func TestWriteDispatchOutput_AuthorizationDenied(t *testing.T) {
path := filepath.Join(t.TempDir(), "github-output")
t.Setenv("GITHUB_OUTPUT", path)
require.NoError(t, os.WriteFile(path, nil, 0o600))
event := &normevent.Event{
Entity: normevent.Entity{ID: 42},
Actor: normevent.Actor{ID: "alice", NumericID: 1234, Kind: normevent.ActorHuman},
Transition: normevent.Transition{
Kind: normevent.TransitionCommentAdded,
Comment: &normevent.Comment{Command: "/fs-code"},
},
Source: normevent.Source{RawType: "issue_comment"},
}

require.NoError(t, writeDispatchOutput(event, true, ""))
data, err := os.ReadFile(path)
require.NoError(t, err)
assert.Equal(t, "authorization_denied=true\nauthorization_actor=alice\nauthorization_actor_id=1234\nauthorization_number=42\n", string(data))
}

func TestWriteDispatchOutput_AuthorizationDeniedSupportsCustomSlashCommand(t *testing.T) {
path := filepath.Join(t.TempDir(), "github-output")
t.Setenv("GITHUB_OUTPUT", path)
require.NoError(t, os.WriteFile(path, nil, 0o600))
event := &normevent.Event{
Entity: normevent.Entity{ID: 42},
Actor: normevent.Actor{ID: "alice", NumericID: 1234, Kind: normevent.ActorHuman},
Transition: normevent.Transition{
Kind: normevent.TransitionCommentAdded,
Comment: &normevent.Comment{Command: "/analyze"},
},
Source: normevent.Source{RawType: "issue_comment"},
}

require.NoError(t, writeDispatchOutput(event, true, ""))
data, err := os.ReadFile(path)
require.NoError(t, err)
assert.Contains(t, string(data), "authorization_actor_id=1234")
}

func TestWriteDispatchOutput_KillSwitch(t *testing.T) {
path := filepath.Join(t.TempDir(), "github-output")
t.Setenv("GITHUB_OUTPUT", path)
require.NoError(t, os.WriteFile(path, nil, 0o600))
event := &normevent.Event{
Entity: normevent.Entity{ID: 42},
Actor: normevent.Actor{ID: "alice", NumericID: 1234, Kind: normevent.ActorHuman},
Transition: normevent.Transition{
Kind: normevent.TransitionCommentAdded,
Comment: &normevent.Comment{Command: "/fs-code"},
},
Source: normevent.Source{RawType: "issue_comment"},
}

require.NoError(t, writeDispatchOutput(event, false, "kill_switch"))
data, err := os.ReadFile(path)
require.NoError(t, err)
assert.Equal(t, "dispatch_blocked_reason=kill_switch\nauthorization_actor=alice\nauthorization_actor_id=1234\nauthorization_number=42\n", string(data))
}

func TestWriteDispatchOutput_SkipsNonDeniedOrNonHuman(t *testing.T) {
path := filepath.Join(t.TempDir(), "github-output")
t.Setenv("GITHUB_OUTPUT", path)
for _, event := range []*normevent.Event{
{Entity: normevent.Entity{ID: 42}, Actor: normevent.Actor{ID: "alice", NumericID: 1234, Kind: normevent.ActorHuman}},
{Entity: normevent.Entity{ID: 42}, Actor: normevent.Actor{ID: "agent[bot]", Kind: normevent.ActorBot}},
} {
require.NoError(t, writeDispatchOutput(event, false, ""))
}
_, err := os.Stat(path)
assert.ErrorIs(t, err, os.ErrNotExist)
}

func TestWriteDispatchOutput_SkipsInvalidLogin(t *testing.T) {
path := filepath.Join(t.TempDir(), "github-output")
t.Setenv("GITHUB_OUTPUT", path)
event := &normevent.Event{
Entity: normevent.Entity{ID: 42},
Actor: normevent.Actor{ID: "alice\nforged", NumericID: 1234, Kind: normevent.ActorHuman},
Transition: normevent.Transition{Kind: normevent.TransitionCommentAdded, Comment: &normevent.Comment{Command: "/fs-code"}},
Source: normevent.Source{RawType: "issue_comment"},
}

require.NoError(t, writeDispatchOutput(event, true, ""))
_, err := os.Stat(path)
assert.ErrorIs(t, err, os.ErrNotExist)
}

func TestWriteDispatchOutput_SkipsAutomaticTrigger(t *testing.T) {
path := filepath.Join(t.TempDir(), "github-output")
t.Setenv("GITHUB_OUTPUT", path)
event := &normevent.Event{
Entity: normevent.Entity{ID: 42},
Actor: normevent.Actor{ID: "alice", NumericID: 1234, Kind: normevent.ActorHuman},
Transition: normevent.Transition{Kind: normevent.TransitionOpened},
Source: normevent.Source{RawType: "issues"},
}

require.NoError(t, writeDispatchOutput(event, true, ""))
_, err := os.Stat(path)
assert.ErrorIs(t, err, os.ErrNotExist)
}

func TestWriteDispatchOutput_SkipsMissingNumericID(t *testing.T) {
path := filepath.Join(t.TempDir(), "github-output")
t.Setenv("GITHUB_OUTPUT", path)
event := &normevent.Event{
Entity: normevent.Entity{ID: 42},
Actor: normevent.Actor{ID: "alice", Kind: normevent.ActorHuman},
Transition: normevent.Transition{Kind: normevent.TransitionCommentAdded, Comment: &normevent.Comment{Command: "/fs-code"}},
Source: normevent.Source{RawType: "issue_comment"},
}

require.NoError(t, writeDispatchOutput(event, true, ""))
_, err := os.Stat(path)
assert.ErrorIs(t, err, os.ErrNotExist)
}

func TestWriteDispatchOutput_ReportsOutputError(t *testing.T) {
outputPath := t.TempDir()
t.Setenv("GITHUB_OUTPUT", outputPath)
event := &normevent.Event{
Entity: normevent.Entity{ID: 42},
Actor: normevent.Actor{ID: "alice", NumericID: 1234, Kind: normevent.ActorHuman},
Transition: normevent.Transition{Kind: normevent.TransitionCommentAdded, Comment: &normevent.Comment{Command: "/fs-code"}},
Source: normevent.Source{RawType: "issue_comment"},
}

err := writeDispatchOutput(event, true, "")
require.Error(t, err)
assert.Contains(t, err.Error(), "write authorization output")
}

func TestRunDispatch_JSONDriver(t *testing.T) {
dir := t.TempDir()
writeDispatchFixture(t, dir)
Expand Down
6 changes: 4 additions & 2 deletions internal/harnessdispatch/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ func IsAuthorized(event *normevent.Event) bool {
}

// FilterAuthorizedHarnesses returns the subset of harnesses that event is
// authorized to dispatch, keyed on each harness role: field. Run it before
// MatchHarnesses so CEL only evaluates authorized harnesses.
// authorized to dispatch, keyed on each harness role: field. The execution
// path runs it before its normal MatchHarnesses call; a separate
// non-dispatching notice probe may evaluate denied candidates to establish
// whether a denied event actually matched a harness.
func FilterAuthorizedHarnesses(harnesses []TriggeredHarness, event *normevent.Event) []TriggeredHarness {
var out []TriggeredHarness
for _, m := range harnesses {
Expand Down
Loading
Loading