feat(feedback): POST /v1/feedback files crash and bug reports as Gitea issues #147
Open
sharang
wants to merge 3 commits from
feat/feedback-endpoint into main
pull from: feat/feedback-endpoint
merge into: platform:main
platform:main
platform:feat/einstieg-plan
platform:feat/update-policy
platform:feat/telemetry-relay
platform:feat/onprem
platform:feat/onprem-mail
platform:feat/onprem-directory-users
platform:feat/onprem-mode
platform:feat/avv-autofill
platform:feat/release-avv-1.0.0
platform:fix/erpsetup-dunning-and-small
platform:feat/module-user-count
platform:feat/usage-summary
platform:feat/mahnung-ladder
platform:fix/toms-status-available
platform:feat/contractdocs-agb-tom
platform:feat/company-rules
platform:feat/staff-brand-slug
platform:fix/intake-outlives-purge
platform:fix/catalogue-labels
platform:feat/trial-offer-status
platform:feat/function-holders
platform:feat/assignable-bundles
platform:feat/contract-documents
platform:feat/erp-lb-versions
platform:feat/store-merges-unterlagen
platform:feat/product-hierarchy
platform:feat/preview-grants
platform:ci/platform-image-and-webhook
platform:ci/registry-meghsakha-orca-webhook
No Reviewers
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
cra:annex-i
cve
pruefwerk
risk:accepted
severity:critical
severity:high
severity:low
severity:medium
CRA Anhang I, wesentliche Cybersicherheitsanforderungen / CRA Annex I
Bekannte Schwachstelle in einer Abhängigkeit / known vulnerability in a dependency
Befund aus Prüfwerk / Prüfwerk finding
Risiko akzeptiert, nicht behoben / accepted risk, not fixed
Schweregrad kritisch / critical
Schweregrad hoch / high
Schweregrad niedrig / low
Schweregrad mittel / medium
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: platform/tenant-registry#147
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
POST /v1/feedback. A CLI user sends a crash report or/bugreport with their own Keycloak token. The registry files it as an issue in the private repoplatform/werkpilot-feedbackand answers201 {"id": <issue number>}, with no URL.internal/giteagainsCreateIssue, with the same error hygiene asListUsers: errors carry no response body, URL or token.FEEDBACK_GITEA_URL,FEEDBACK_GITEA_REPOandFEEDBACK_GITEA_TOKEN, plus their README rows and the OpenAPI entry.Why
Refs platform/werkpilot#86 (crash reports and
/bugfeedback). The Werkpilot CLI side is being built in parallel against this contract.Linked milestone: n/a (werkpilot#86)
How
Request:
{"product","kind","title","body","version","device"}kindiscrashorbug.titleis 1–200 characters (runes) after trimming.productis required, at most 100 characters.versionanddeviceare optional, at most 100 characters each.bodymust be non-empty and at most 200000 bytes, otherwise 413too_large. The request itself is capped at 2 MiB, also 413.---. Values that are too long are refused, not cut.Issue:
[<tenant slug>] <kind>: <title>.---, then the submitted body verbatim.tenant_idin the JSON is ignored.Errors (all use the existing
writeErrorenvelope):feedback_disableduser_token_requiredinvalid_inputtoo_largerate_limitedkeyRateLimiterCI licences use). Refused requests don't count.feedback_failedAuthz:
feedback. There is no org-role check, so any member may send;requireMemberstill stops blocked members.licencespasses too. That coverswerkpilot-cliandfirmwerk-cliwith the AUTHZ_RULES deployed today (licences,usage), so no orca rule change is needed.feedbackitself, or get 403FORBIDDEN_CLIENT. That includes the portal's sign-in client, and service tokens that holdlicences.Audit:
feedback.submitted(actor, product, kind, version, device, issue number; not the title or body).On-prem: with a token set,
FEEDBACK_GITEA_URLandFEEDBACK_GITEA_REPOmust be given explicitly. This mirrors the LiteLLM rule.Going live (orca, not in this PR)
After this is merged and deployed, the endpoint stays inert (503) until a Gitea bot account's token is put into the deployment secret (orca,
platform-stage/platform-prod) asFEEDBACK_GITEA_TOKEN. The bot needs write access to issues inplatform/werkpilot-feedback. No AUTHZ_RULES change is needed.No bot account or token was created for this PR. Read-only check:
platform/werkpilot-feedbackexists, is private and has issues enabled.Test plan
internal/server/feedback_test.go, run against an httptest fake Gitea:idandnumber, and the response must be{"id": number}. Also checks the token is in the header only, never in the URL, and the audit event.FEEDBACK_GITEA_REPO: 502.werkpilot-cliandfirmwerk-cli, with onlylicences,usageas deployed, reach the handler (201). So does a client grantedfeedback. These are refused:licences(FORBIDDEN_CLIENT);licences(FORBIDDEN_CLIENT);user_token_required);user_token_required).internal/gitea:CreateIssuepath escaping, the 201 check, errors without body or token, and repo validation.authz_test(route group),openapi_test(route in the spec), config defaults and the on-prem rule.gofmt -l .clean,go vet ./...clean,golangci-lint run(v2.12.2, as in CI): 0 issues,go test -race -count=1 ./...all green.GetTenant,AppendAudit) and adds no migration.audit_log.target_id/target_typeare plainTEXTwith no CHECK, so the issue number astarget_idis fine.POST /api/v1/repos/{owner}/{repo}/issues(201,number).Risk
Blast radius: one new route; nothing existing changes behaviour (
internal/gitea's request code was factored into a shareddo, and theListUserstests still pass).What could break:
Rollback plan: unset
FEEDBACK_GITEA_TOKEN(endpoint goes back to 503), or revert the PR and redeploy.Checklist
feedback.submitted)FEEDBACK_GITEA_TOKENis a deployment secret)featureFlags.evaluate()used for any toggleable behavior: n/a, the token's presence is the switch, as with other integrations hereScreenshots / recordings
n/a (no UI)
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q9inRayW7ztyk1uAtwMJPR
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.