Skip to content

fix(security): scope on-call override deletion to its schedule and org - #714

Merged
fclairamb merged 2 commits into
mainfrom
fix/on-call-override-ownership
Oct 30, 2026
Merged

fclairamb merged 2 commits into
mainfrom
fix/on-call-override-ownership

Conversation

@fclairamb

Copy link
Copy Markdown
Owner

Fixes GHSA-rh8v-28gv-2q57 (severity: high).

What changed

  • DELETE /api/v1/orgs/:org/on-call-schedules/:uid/overrides/:overrideUid now resolves the org, loads the schedule within that org, and deletes the override only if it belongs to that schedule. Otherwise it answers 404 and deletes nothing.
  • db.Service.DeleteOnCallScheduleOverride and GetOnCallScheduleOverride now take the schedule UID and filter on schedule_uid (SQLite and Postgres). Delete returns sql.ErrNoRows when no row matched.
  • POST .../overrides: the service now loads the schedule within the org itself, and the override's userUid must be a member of the org (400 VALIDATION_ERROR otherwise).
  • Schedule rosters (userUids on create and PATCH) must also list org members only. Before this, another org's user could be put on a roster or an override and then show up in currentlyOnCall.
  • Removed the unused Service.ReplaceUsers, which skipped the membership check.
  • No migration and no config change.

List, get, preview, iCal and the other schedule endpoints were already scoped to the org.

Tests

  • New oncallschedules/handler_test.go (HTTP, SQLite):
    • A delete through another org, another org's schedule, or an unknown UID answers 404, and the override is still there afterwards. This test fails on main.
    • Positive control: the owner deletes their own override (204), the other org's override is untouched, and a second delete answers 404.
    • List through a foreign org answers 404. Create on a foreign schedule answers 404, and create with a foreign user answers 400. A roster PATCH with a foreign user answers 400.
  • The DB contract (dbcontract.runOnCall, which runs on both SQLite and Postgres) now checks that reads and deletes through another schedule fail and leave the row in place.
  • go test passes for oncallschedules, db/sqlite, db/postgres (testcontainers) and notifications. golangci-lint run ./... reports 0 issues.

🤖 Generated with Claude Code

Deleting an override now resolves the organization, loads the schedule
within it and deletes the override only when it belongs to that schedule;
anything else answers 404. The database methods to read and delete an
override take the schedule UID (SQLite and Postgres).

Creating an override also loads its schedule within the organization, and
the users of an override or a schedule roster must be members of the
organization (400 otherwise).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fclairamb
fclairamb enabled auto-merge (squash) October 30, 2026 05:53
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.10526% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.78%. Comparing base (7d346c6) to head (919eeba).

Files with missing lines Patch % Lines
...erver/internal/handlers/oncallschedules/service.go 87.50% 4 Missing ⚠️
server/internal/db/postgres/on_call.go 87.50% 1 Missing ⚠️
server/internal/db/sqlite/on_call.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #714      +/-   ##
==========================================
+ Coverage   89.75%   89.78%   +0.02%     
==========================================
  Files        1297     1297              
  Lines      132215   132272      +57     
==========================================
+ Hits       118675   118755      +80     
+ Misses      13531    13508      -23     
  Partials        9        9              
Files with missing lines Coverage Δ
server/internal/db/dbcontract/escalation.go 100.00% <100.00%> (ø)
...erver/internal/handlers/oncallschedules/handler.go 89.27% <100.00%> (+1.42%) ⬆️
server/internal/db/postgres/on_call.go 96.57% <87.50%> (-0.55%) ⬇️
server/internal/db/sqlite/on_call.go 96.57% <87.50%> (-0.55%) ⬇️
...erver/internal/handlers/oncallschedules/service.go 88.48% <87.50%> (+1.20%) ⬆️

... and 18 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fclairamb
fclairamb merged commit 6708f03 into main Oct 30, 2026
33 checks passed
@fclairamb
fclairamb deleted the fix/on-call-override-ownership branch October 30, 2026 06:47
fclairamb added a commit that referenced this pull request Oct 30, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.42.1](v0.42.0...v0.42.1)
(2026-10-30)


### Bug Fixes

* **checkicmp:** socket-open failure is an infrastructure error
([#712](#712))
([208ff0a](208ff0a))
* **dash0:** explain chart Full range switch and status page visibility
hint ([#702](#702))
([9c6141b](9c6141b))
* **deps:** update github.com/dop251/goja digest to 5f913d1
([#697](#697))
([146cb22](146cb22))
* **deps:** update github.com/dop251/goja digest to 85be141
([#706](#706))
([c6abd8e](c6abd8e))
* **deps:** update github.com/dop251/goja digest to d535508
([#696](#696))
([7529c15](7529c15))
* **deps:** update github.com/dop251/goja digest to f818168
([#709](#709))
([7d03f42](7d03f42))
* **deps:** update go dependencies (non-major)
([#690](#690))
([6de8ac7](6de8ac7))
* **deps:** update go dependencies (non-major)
([#694](#694))
([0838916](0838916))
* **deps:** update go dependencies (non-major)
([#698](#698))
([ea540e8](ea540e8))
* **deps:** update go dependencies (non-major) to v0.37.2
([#704](#704))
([67da7f7](67da7f7))
* **deps:** update module github.com/posthog/posthog-go to v1.39.0
([#711](#711))
([b2a7f2c](b2a7f2c))
* **deps:** update module github.com/prometheus/common to v0.73.0
([#703](#703))
([1ac4dc8](1ac4dc8))
* **deps:** update module github.com/slack-go/slack to v0.32.0
([#707](#707))
([74db3d2](74db3d2))
* ICMP capability for workers, escalation targets on events, login bug
report and degraded incident fixes
([#701](#701))
([9613f98](9613f98))
* **security:** device consent phishing guard and 2FA disable throttle
([#693](#693))
([822186f](822186f))
* **security:** instance-wide budget and retention for anonymous
bug-report screenshots
([#708](#708))
([2be7787](2be7787))
* **security:** PAT org binding, subscribe throttle, invite lookup, SNMP
secret ([#699](#699))
([cdf59bb](cdf59bb))
* **security:** scope on-call override deletion to its schedule and org
([#714](#714))
([6708f03](6708f03))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
fclairamb added a commit that referenced this pull request Nov 9, 2026
Follow-up to GHSA-rh8v-28gv-2q57. The authorization part of that
advisory (deleting an override must stay within its org and schedule)
shipped in #714 and is in v0.42.1 and later. This PR closes the
remaining point: override changes left no audit trace.

## What changed
- Creating or deleting an on-call override now records an
`oncall_schedule.updated` audit event on the schedule. The event has
`changed_fields: ["overrides"]` plus `override_action` (`created` /
`deleted`), `override_uid`, `override_user_uid`, `override_start_at` and
`override_end_at`. This follows the pattern `maintenance_window.updated`
uses for its attached checks. The free-text reason is not recorded.
- `DeleteOverride` now loads the override within its schedule
(`GetOnCallScheduleOverride`) before deleting it, so the event can name
whose cover was removed. The delete itself stays scoped to the schedule.
- No new event type, no migration, no config change. dash0 already
renders `oncall_schedule.*` through the generic configuration-event
path.

## Docs
- `web/docs/docs/features/audit-log.md`: the on-call row now mentions
overrides.
- `web/docs/docs/features/on-call.md`: overrides section says changes
are audited.
- `wiki/api-specification/events-catalogue.md`: the payload keys are
documented.

## Tests
New `server/internal/handlers/oncallschedules/audit_test.go` (SQLite):
- Table-driven create/delete: each writes exactly one attributed row
with the expected target and payload, and without the reason.
- A refused cross-org delete records nothing in either org. Positive
control: the same caller deleting their own override is recorded.

Both tests fail on `main` and pass with this change. `go test -short` on
`oncallschedules`, `events`, `audit` and `db/...` passes, and
`golangci-lint run ./...` reports 0 issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant