Skip to content

Block access to sensitive field data for unauthorized users #50

Closed

Description

@seanthepottingshed
  • Winter CMS Build: Latest
  • PHP Version: 7.2
  • Database Engine: mysql
  • Plugins Installed: N/A

Description

Setting a sensitive form field to readOnly doesn't stop the display of the password when clicking the view button.

Steps To Reproduce:

And the following to fields.yaml:

test_api_key:
    label: Test API key
    placeholder: Enter key
    type: sensitive
    readOnly: true

Activity

  1. added
    needs review
    on Mar 18, 2021
  2. LukeTowers commented on Mar 18, 2021

    @LukeTowers
    Member

    I'm curious as to why you think readOnly should prevent that, technically they're not editing the field, only reading it. What's the use case you're trying to achieve?

  3. seanthepottingshed commented on Mar 18, 2021

    @seanthepottingshed
    Author

    Good point, maybe it's just me but it seems counterintuitive to be able to interact with a field that is set to readOnly, I assumed it would just display as a password field type instead.

  4. LukeTowers commented on Mar 18, 2021

    @LukeTowers
    Member

    I'm not really sure what the point of that happening would be tbh, are you trying to hide the sensitive data from unprivileged users?

  5. seanthepottingshed commented on Mar 18, 2021

    @seanthepottingshed
    Author

    Sorry yes, I worked around it by serving different fields based upon user permission. So user with privileges gets field as sensitive otherwise as readOnly password

  6. LukeTowers commented on Mar 18, 2021

    @LukeTowers
    Member

    There are other ways you can achieve similar results too, for example you could hook into the backend.ajax.beforeRunHandler event and throw an ApplicationException if you detect someone is trying to onShowValue() without the correct level of access to the data.

    Is there anything actionable left in this issue or are you fine with your current solution?

  7. seanthepottingshed commented on Mar 18, 2021

    @seanthepottingshed
    Author

    There are other ways you can achieve similar results too, for example you could hook into the backend.ajax.beforeRunHandler event and throw an ApplicationException if you detect someone is trying to onShowValue() without the correct level of access to the data.

    Good to know!

  8. removed
    needs review
    on Mar 18, 2021
  9. changed the title [-]ReadOnly Sensitive Form Field[/-] [+]Block access to sensitive field data for unauthorized users[/+] on Mar 18, 2021
  10. locked and limited conversation to collaborators on Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions