Page MenuHomePhorge

Do not expose Contact Numbers settings panel when no SMS support configured
ClosedPublic

Authored by aklapper on Oct 27 2023, 09:23.

Details

Summary

It's useless without SMS support and only exposed to the user themselves.

Closes T15486

Test Plan

Before and after applying this patch,

  • Try to access the list of your contact numbers at /settings/panel/contact/
  • Try to access an existing, previously created contact number at /auth/contact/1/
  • Try to add a contact number at /auth/contact/edit/
  • Go to e.g. /settings/panel/datetime and check the "Authentication" section in the left sidebar for Contact Numbers

Diff Detail

Repository
rP Phorge
Branch
T15486contactNr (branched from master)
Lint
Lint Warnings
Unit
Tests Passed
Build Status
Buildable 870
Build 870: arc lint + arc unit

Event Timeline

Changing policy based on sms being configured seems a little off to me. Having the setting only conditionally show based on it being configured seems fine, however what happens in this scenario:

  1. Turn on sms
  2. Add number
  3. Turn off sms

I’m guessing the user would be unable to remove their contact number (or even see it), unless turning off sms deletes their contact number. In this case I think the user would still want to know it’s saved somewhere and could remove it.

It might be better for now to include some explanation text on those pages saying it’s only used for MFA if enabled, and leave the display of these as-is

In D25452#12901, @speck wrote:

I’m guessing the user would be unable to remove their contact number (or even see it), unless turning off sms deletes their contact number. In this case I think the user would still want to know it’s saved somewhere and could remove it.

@speck: Currently (without my patch), users can only disable a contact number of them; users could not and cannot remove or delete a contact number which they entered into Phorge. Thus my patch does not make the situation worse: users still will not be able to remove the contact number themselves (SMS enabled or not) but at least users cannot enter more contact numbers while SMS is not enabled in their Phorge installation.

Thanks for clarifying this behavior, it sounds like contact numbers in general need fleshed out quite a bit.

What do you think about not modifying policy based on the sms MFA turned on? Would it be possible to have that endpoint return 404 or similar without dynamically modifying policy? Or is there another example in the codebase for similar dynamic policy definition that can be referenced?

I am sorry, thanks for your last comment, I now understand your point. Yes, I guess we'd better return new Aphront404Response() instead of some permission based message. Like we'd do trying to access the URL of an uninstalled application. Now just need to find out how to do that :)

Show 404 error instead of policy based message

This revision is now accepted and ready to land.Nov 5 2023, 15:06