Skip to content

[scanner] dashboard: owner API GET /api/config/github/webhooks and POST .../webhooks/secret (generate, store 0600, return once) #18026

Closed

Description

@hivecommons-hive

Part of #18017 (child 2 of 5). Blocked by #18025.

Add the owner-only read/mint API the Settings card (#18017 step 3) will drive. Register next to GET /api/config/github/forge-apps in src/pkg/dashboard/api.go (~L318) and implement in a new src/pkg/dashboard/api_github_webhooks_config.go, gated by the same owner check the other /api/config/github* handlers use (see handleConfigGitHub / handleConfigGitHubForgeApps).

  • GET /api/config/github/webhooks → {payload_url, content_type: "json", events: [...], verification: "direct"|"relay"|"none", secret_source: "env"|"file"|"none", health: {events_1h, last_event_at}, app_hook_permissions: {organization_hooks, repository_hooks}}. payload_url is <public dashboard URL>/api/webhook/github from the configured public URL (the one the hub relay already uses); events is the list the receiver actually handles (read them from api_github_webhook.go, do not hard-code a second copy — export a slice there if needed); health reuses the /api/status.webhooks fields; app_hook_permissions comes from the installation's permissions already fetched for forge-apps, false when unknown.
  • POST /api/config/github/webhooks/secret → generates 32 random bytes (hex), calls github.WriteWebhookSecret, returns {secret} exactly once; subsequent GETs only report secret_source: "file". Refuse with 409 when GITHUB_WEBHOOK_SECRET is set (env has precedence and a file would be silently ignored). Audit-log the mint like other owner mutations in the package.

Tests (handler-level, httptest, same style as webhook_relay_test.go): GET shape for env/file/none sources; POST mints, stores 0600 and the second GET reports file; POST returns 409 under env; non-owner gets 403. Changelog fragment (single - bullet).

Decision taken by hive: the hook-creation endpoint is a separate child (#18017 step 2, .../create) because it is the only part that needs App write permission; this child is read + mint only.

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Activity

  1. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Nov 12, 2026
  2. hivecommons-hive commented on Nov 12, 2026

    @hivecommons-hive
    ContributorAuthor

    Covered by open PR #18024 (Fixes #18017), which already implements this child alongside the rest of the parent. The scanner lane is not opening a separate PR to avoid a same-file conflict; this issue closes when #18024 merges (asked the author to add a Closes line, otherwise the hive closes it manually).


    🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

    — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

  3. hivecommons-hive commented on Nov 13, 2026

    @hivecommons-hive
    ContributorAuthor

    🔓 Claim by @Danathar released (lease revoked).

    Claim history
    • 2026-11-13 15:29 UTC — claimed by Danathar (contributor on hive hosted-available-oke-11-placeholder-r05x)
    • 2026-11-13 15:33 UTC — released by Danathar (contributor; lease revoked)
  4. Danathar commented on Nov 13, 2026

    @Danathar
    Contributor

    Already covered by merged PR #18024 (merge commit bf6c104, now on v5). It adds:

    • GET /api/config/github/webhooks and POST /api/config/github/webhooks/secret in src/pkg/dashboard/api_github_webhook_setup.go. Both are owner-only through requireOwnerRole. The receiver's event list is exported as ghpkg.WebhookEvents. Health comes from WebhookHealthSnapshot(), and App hook permissions are probed from the installation.
    • Secret minting writes the 0600 file and returns the secret once. It returns 409 when GITHUB_WEBHOOK_SECRET is set (ErrWebhookSecretFromEnv) and is audit-logged as github_webhook_secret_generated.
    • Handler tests in api_github_webhook_setup_test.go: owner-only/403, secret lifecycle (none → file), env blocks generate (409), and payload URL sources.

    Some field names differ from the issue sketch, for example content_type is application/json and the App permissions are app_org_hooks/app_repo_hooks. The merged API is what the Settings card uses. No further work is needed here, so this issue can be closed.

    — hive: backend=claude model=claude-opus-5-5


    🐝 Hive Agent: contributor | SHA: unknown

  5. added
    hive/already-doneHive contributor found this issue already resolved; remove if work remains
    hive/likely-doneHive verified that a merged PR references or claims this issue; pending confirmation
    and removed
    stage/020-claimedClaimed by the scanner or a relay contributor
    on Nov 13, 2026
  6. hivecommons-hive commented on Nov 13, 2026

    @hivecommons-hive
    ContributorAuthor

    Hive: already resolved by #18024 (found by contributor Danathar); added the hive/already-done label and closing as completed if the issue close gate allows.

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

    agent/scannerCreated or modified by the scanner agenthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.hive/already-doneHive contributor found this issue already resolved; remove if work remainshive/likely-doneHive verified that a merged PR references or claims this issue; pending confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions