Skip to content

fix(repos): onboard writes no webhook from a default URL #7308

Done

Description

@dan-petty

Problem or Motivation

devops repos onboard plans the webhook of the Service from service.webhook_url and service.webhook_secrets of the local configuration. On a workstation that does not hold the values of the cluster, the plan is wrong, and --confirm would write it.

Read on 2026-11-26 in the devcontainer, where service.webhook_url is not set:

  • The setting has the default https://hooks.example.com/webhooks/github (src/devops_cli/config/settings.py:1859).
  • devops repos onboard --all --plan gave this row for each of the 9 repositories, although each repository has a hook that works: 12. Webhook: pending, create the hook of https://hooks.example.com/webhooks/github, secret in service.webhook_secrets.
  • src/devops_cli/github/onboard/service_rows.py:247 reads the URL with no check that a person set it.

A run with --confirm would thus create a hook to the example host in each repository. The row also gives a hook whose secret the local service.webhook_secrets lacks a new secret. From a workstation with no secret map, that changes the secret of the live hook, and the Service then refuses each delivery until push-secrets and deploy-stack (row 13) put the new secret in the cluster.

The owner ran the command on 2026-11-26 with --only 0,1,2,3,4,5,6,7,8,9,10,11 to keep row 12 out. The command must be safe with no such option.

Proposed Solution

Disposition: change the code.

  • When service.webhook_url has its default value, row 12 has the state person with one step that names the setting. It plans no hook and writes none.
  • Row 12 writes a new secret to an existing hook only in the same run that does row 13, so the cluster gets the secret that GitHub got. With --no-deploy or with row 13 out of --only, the row reports the difference and writes nothing.
  • feat(service): verify GitHub App webhooks with one secret #4417 deletes the row. Until then these two rules hold.

Proof: a test over the fake GitHub API with the default URL gives the state person and sends no request to the hooks routes. A second test with a set URL and no row 13 sends no PATCH to an existing hook.

Existing Tool Considered

The GitHub REST API for repository webhooks, which the command already uses. No new tool.

Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: Three searches found no relevant tool, only unrelated browser-extension settings pages. The need is an internal guard in the repository's own onboard rows over the GitHub API it already uses, so no external tool covers it.

Lacks:

  • Check that service.webhook_url was set by a person, not its default
  • Row 12 state person naming the setting, planning no hook
  • No secret write to a live hook without row 13 in the same run
  • No PATCH to an existing hook with --no-deploy or row 13 excluded

Proposed design

Problem statement

Add a guard to row 12 of devops repos onboard. When service.webhook_url has its default value, row 12 must report the state person and plan no hook. Row 12 must write a new secret to an existing hook only in the run that does row 13. Today the command plans a hook to the example host on a workstation that does not hold the cluster values. A run with --confirm would create that hook and change the secret of a live hook.

Acceptance criteria

Requirement: Default URL gives a person step

The onboard row 12 SHALL report the state person and name the setting service.webhook_url when the setting has its default value.

Scenario: Default webhook URL in the plan

  • WHEN A test in tests/commands/test_repos_onboard.py runs devops repos onboard --all --plan over the fake GitHub API with the default service.webhook_url.
  • THEN Row 12 has the state person, its step names service.webhook_url, and the plan holds no hook step.

Requirement: Confirm writes no hook from the default URL

The command MUST send no request to a repository hooks route when service.webhook_url has its default value, even with --confirm.

Scenario: Confirm with the default URL

  • WHEN A test runs devops repos onboard --all --confirm over the fake GitHub API with the default service.webhook_url.
  • THEN The fake records no POST or PATCH to a hooks route and row 12 keeps the state person.

Requirement: Secret write needs row 13

Row 12 SHALL write a new secret to an existing hook only when the same run includes row 13.

Scenario: Existing hook with row 13 out of the run

  • WHEN A test runs the command with a set URL, an existing hook whose secret differs, and row 13 out of --only or --no-deploy.
  • THEN The fake records no PATCH to the hook and row 12 reports the secret difference.

Requirement: Secret write in the run with row 13

Row 12 SHALL PATCH the new secret to the existing hook when the same run includes row 13.

Scenario: Existing hook with row 13 in the run

  • WHEN A test runs the command with a set URL, an existing hook whose secret differs, and row 13 in --only.
  • THEN The fake records one PATCH to the hook that carries the new secret.

Existing Tool Considered

The alternatives check of 2026-11-26 in the issue body gives the verdict none and names no tool. No open, maintained tool covers a guard on a configuration default inside the onboard rows. The block lists in Lacks: what the need requires. The change adds those four guards in src/devops_cli/github/onboard/service_rows.py and src/devops_cli/github/onboard/run.py. It uses the GitHub REST API for repository webhooks that the command already uses. Cost to build and keep this code: about 40,000 tokens to build, about 10,000 tokens to keep and fix, and about 4 hours elapsed.

Key questions

  • How does row 12 detect that service.webhook_url has its default value?: Row 12 compares the resolved service.webhook_url with the default value of the setting. The guard runs before the row reads the hook state. (best practice) [sources: src/devops_cli/config/settings.py:1859, src/devops_cli/github/onboard/service_rows.py:247, src/devops_cli/config/env.py, src/devops_cli/config/os_keyring.py]
    • Chosen: Compare the value with the default. It reads the same resolved setting that row 12 uses now. It needs no change to the config loader.
    • Rejected: Check the pydantic-settings model_fields_set. It records the fields that the constructor got. A merged config that passes the default makes the field look set.
    • Rejected: Read the raw config file for the key. It ignores the environment and the keyring. The setting can come from either.
  • How does row 12 know that the run includes row 13?: The run builds the selected rows from --only and --no-deploy. It passes the selected set to the row-12 builder. Row 12 writes no secret when the set has no row 13. (best practice) [sources: src/devops_cli/github/onboard/run.py, src/devops_cli/github/onboard/service_rows.py:247]
    • Chosen: Pass the selected row set into the builder. The input is explicit. A test sets it with no command line.
    • Rejected: Read the command line again in row 12. It hides the input. It couples the row to the CLI parser.
  • What does row 12 report when it writes no secret?: Row 12 reports the secret difference and writes nothing. The step names the setting service.webhook_secrets and the hook, so a person can run row 13. (best practice) [sources: src/devops_cli/github/onboard/service_rows.py:247]
    • Chosen: Report the difference in the row. The plan shows the drift with no write. The person sees the cause.
    • Rejected: Report the state person with a step. The URL is set in this case. The row is no person step; it shows the difference that row 13 fixes.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    status/new
    effort/low
    value/high
    on Nov 26, 2026
  2. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor
    • Priority: A single --confirm run would change live hook secrets on 9 repositories and cause the Service to refuse deliveries until a follow-up deploy, a one-command-away service disruption.
    • Related: feat(roadmap): check the repository webhook in the onboard row #7274, which asks for a different change. Both concern the webhook row in an onboard command, but the candidate fixes a bug in devops repos onboard (repos command) while #7274 adds an event-check to devops roadmap onboard (roadmap command).
  3. added
    scope/repos
    priority/p1-high
    on Nov 26, 2026
  4. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (4)

    Searches run:

    • open source tool validates webhook configuration before writing GitHub repository hooks, results: 5
    • detect whether a config value was explicitly set by user vs default pydantic settings, results: 5
    • pydantic-settings model_fields_set tell if field was set explicitly or default, results: 5
    • github webhook management CLI open source rotate secret, results: 5
  5. added
    status/ready
    and removed
    status/new
    on Nov 26, 2026
  6. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. added
    owner/service
    and removed
    owner/service
    on Nov 26, 2026
  8. 6 remaining items

  9. added 2 commits that reference this issue on Nov 27, 2026
  10. added
    status/planned
    owner/service
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/planned
    status/in-progress
    on Nov 27, 2026
  11. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    The draft pull request #7391 holds the final title and body. In mode on of roadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.

    Spend: 174 model requests, 22932865 input tokens, 53578 output tokens.

  12. removed
    owner/service
    on Nov 27, 2026
  13. removed
    status/in-review
    on Nov 27, 2026
  14. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-27 13:20 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p1-highscope/repossource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions