Skip to content

perf: speed up event-script form open (services_only fast path + 3 security commits)#57

Merged
thekevinm merged 6 commits intomasterfrom
develop
Apr 22, 2026
Merged

perf: speed up event-script form open (services_only fast path + 3 security commits)#57
thekevinm merged 6 commits intomasterfrom
develop

Conversation

@nicdavidson
Copy link
Copy Markdown
Contributor

Summary

Release sync of develop into master. Headline change: a fast path on the /api/v2/system/event resource that fixes the long-standing "spinning cog" hang when opening the Event Script create form in the admin UI.

perf: services_only=true on /api/v2/system/event

Problem. Unscoped GET /system/event loops over every active service and calls $service->getEventMap(), which for DB-type services walks tables/procedures/functions. On customer instances with many services (Triskele: ~11+), the admin UI's event-script create form would sit on a loading spinner waiting for this payload to come back.

Change. Added an optional services_only=true query param that returns just the list of active, access-allowed service names via the already-cached ServiceManager::getServiceNames(true). Skips the per-service getService() / getEventMap() pass entirely.

Measured on an 8-service dev instance:

Path Payload Time
Previously (unscoped, all events) ~40 KB ~244 ms
New ?services_only=true ~80 bytes ~30 ms

On instances with many DB services the old path is seconds, not milliseconds — this is the 10–20x-plus reduction that kills the hanging-form symptom.

Backward compatible. Bare, ?service=<name>, and ?as_list=true paths are byte-identical to before. Only a new optional param was added (and documented in the OpenAPI paths).

Pairs with the matching df-admin-interface PR that switches the event-script form resolver to use services_only=true, then fetches the scoped event map on service selection.

Also in this batch (already merged to develop via prior PRs)

Test plan

  • Verified ?services_only=true returns only service names (~80 bytes) in ~30 ms.
  • Verified ?service=<name>&scriptable=true still returns the scoped event map unchanged.
  • Verified the bare ?scriptable=true call still returns the full cross-service event map (no contract change).
  • Verified admin-interface event-script create form populates instantly with the new flow.
  • CI on master sync.

nicdavidson and others added 4 commits April 3, 2026 14:53
The password reset link included &admin=1 for system administrators,
disclosing admin status in emails, browser history, and URL logs.
The frontend can determine admin status after reset via session info.
Security: SSRF validation on import_url endpoints
Unscoped GET /api/v2/system/event loads every active service and calls
getEventMap() on each, enumerating tables/procedures/functions for DB
services. On customer instances with many services this takes seconds
and the event-script create form hangs waiting.

Add a services_only=true query param that short-circuits to return
just the list of active, access-allowed service names via cached
ServiceManager::getServiceNames(true). Pairs with the admin UI change
that cascades service-select -> scoped event fetch.

Existing paths (bare, ?service=, ?as_list=) are unchanged.
nicdavidson and others added 2 commits April 21, 2026 13:42
…ertions, stronger passwords)

- SystemServiceTest: explicitly authenticate as sysadmin in setUp so the
  list/get tests still pass once RBAC filtering is enforced. Replace
  position-based asserts (`services.0.name == 'system'`) with
  `assertContains` so additional services in the DB don't flake the test.
- AdminResourceTest: don't assert fixed admin counts — snapshot the count
  before the mutation and compare deltas. Match user rows by the `name`
  field instead of array index. Upgrade hardcoded passwords to ones that
  satisfy the new strength policy so the security fixes in df-core and
  df-user don't cascade-break these tests.
- UserResourceTestCase: matching password upgrade for shared fixture.
…rdening

test: harden system tests (admin auth, order-independent asserts, stronger passwords)
@thekevinm thekevinm self-requested a review April 22, 2026 20:05
@thekevinm thekevinm merged commit 5765fdc into master Apr 22, 2026
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.

2 participants