feat: add approved pool urls - #204
Conversation
paragmore
left a comment
There was a problem hiding this comment.
the approved-urls route side looks good, but I don't think the transform runs on real traffic — the action string and payload shape don't match what the UI/ork actually use. Details inline.
|
|
||
| const transformPushActionPayload = (payload) => { | ||
| switch (payload.action) { | ||
| case 'REGISTER_CONFIG': { |
There was a problem hiding this comment.
this case never matches real traffic — the UI sends registerConfig (ACTION_TYPES.REGISTER_POOL_CONFIG in app-ui resolves to that, same value the ork whitelists), not REGISTER_CONFIG. And the real payload nests the urls at params[0].data.poolUrls (ork's registerConfig destructures { type, data }), so even with the right string this reads one level too high and would throw ERR_INVALID_POOL_URLS — and the flat shape it writes back would then be rejected by ork with ERR_CONFIG_TYPE_INVALID. The tests pass because they send the same shape the transform expects rather than what AddPoolModal produces — worth adding one test with the exact UI payload.
| return payload | ||
| } | ||
|
|
||
| default: |
There was a problem hiding this comment.
updateConfig needs the same treatment — ork accepts data.poolUrls with any url string on update, so a config can be registered against an approved pool and then updated to an arbitrary url. Same for the batch route: pushActionsBatch forwards batchActionsPayload untouched and ork fans each entry into pushAction, so registerConfig can skip this transform entirely. Might be worth enforcing the allowlist in ork's _validatePoolConfigData instead — every path converges there.
| const transformPushActionPayload = (payload) => { | ||
| switch (payload.action) { | ||
| case 'REGISTER_CONFIG': { | ||
| const [poolConfig] = payload.params |
There was a problem hiding this comment.
if params is missing or not an array this throws a bare TypeError (→ 500). An Array.isArray guard with an ERR_ code would match the rest of the handler.
Ticket