Skip to content

Security Concern: Exposure of Access Roles on the Client Side #29450

Closed

Description

@OlgaPotiagalova

During the sprint demo on Jul 8, 2025 a concern was raised (by Varek Boettcher) regarding how access roles are being handled in the implementation. Specifically, it was observed that the list of access roles is transmitted to the client side, allowing it to be visible through client-side debugging tools.

The concern is that exposing internal role names in the browser could allow a malicious actor to manipulate or explore unauthorized paths, particularly if role names are predictable or sensitive. Best security practices imply that you don’t give the presentation layer anything you don’t absolutely have to.

Questions to address:
• Is the list of roles required on the client side for any critical functionality?
• Can we avoid sending this data, or obfuscate it if strictly needed?
• What mechanisms are in place to ensure role injection or spoofing attempts are not exploitable?
• Are there alternative approaches that align more closely with security best practices?

Please review and provide input on whether adjustments are needed to limit client-side exposure of this data.

Activity

  1. added
    Entities Team
    on Jul 9, 2025
  2. thorwolpert commented on Jul 9, 2025

    @thorwolpert
    Collaborator

    Are you referring to roles in the JWT?
    JWTs are cryptographically signed, so if they are tampered with the security check will fail.

  3. severinbeauvais commented on Jul 14, 2025

    @severinbeauvais
    Collaborator

    I believe the question is about the list of authorized actions (permissions) that the Legal API provides to the UI (not the JWT roles) ie:

    image.png

    I understand the concern about exposing these (and the possibility of a malicious actor spoofing these, especially with our source code public). However, we have plans to mitigate these concerns.

    Is the list of roles required on the client side for any critical functionality?

    Yes. This is the list of actions that the user is authorized to perform and includes things like which filings are allowed to whether staff payment (and its payment bypass mechanism) is allowed.

    Can we avoid sending this data, or obfuscate it if strictly needed?

    I don't think we can avoid sending this data, since it's beneficial to have it stored in the db for all UIs to use. I think obfuscating this data won't help (esp since our source code is public) but we could sign the response (similar to JWT) to prevent unauthorized changes -- see #29529.

    What mechanisms are in place to ensure role injection or spoofing attempts are not exploitable?

    Again, we are talking about permissions, not JWT roles.

    A sufficiently skilled actor could inject permissions and provide greater access to UI functionality. The call and response are somewhat protected from external viewing as the connection is HTTPS. Signing the permissions response would prevent it from being tampered with. Even so, the UI code could be modified in situ to enable different conditions and bypass the regular code checks.

    Our main protection will be for the Legal API to verify that requested actions are authorized for the user -- see #29528.

    Are there alternative approaches that align more closely with security best practices?

    Yes. Having the API protect itself from unauthorized actions is a best practice, and is really the only thing we can control since the UIs run on an external computer and its source code is public and its runtime code can be debugged and modified.

  4. severinbeauvais commented on Aug 13, 2025

    @severinbeauvais
    Collaborator

    To mitigate security concerns, we are implementing permission checking in the Legal/Business API. This will ensure that someone trying to spoof their permissions in the UI still won't be able to change what they're not permitted to in the API/database.

    Refs:
    https://app.zenhub.com/workspaces/entities---olga-65af15f59e89f5043c2911f7/issues/gh/bcgov/entity/27211
    https://app.zenhub.com/workspaces/entities---olga-65af15f59e89f5043c2911f7/issues/gh/bcgov/entity/29967

    As for encrypting the list of permissions so they are not in clear-text, I think that's overkill, given that all other data is passed between UI and API in clear text (albeit over a secure HTTP channel). Also, since the UI code itself can be viewed on a user's brower (and in Github!), someone with enough knowledge would be able to decode and reroute/bypass whatever we would implement.

    The other option would be to "sign" the list of permissions, ensure that a malicious actor could not modify it -- though, again, our UI code is public. (Also, this doesn't address the "visibility" issue, if that's a concern.)

    To really prevent a malicious actor from exploring unauthorized paths, we'd have to not serve code containing those paths to unauthorized users. I have lightly explored this in the latest framework that our new (and refactored) UIs (web apps) are written in -- Nuxt 3. Lazy-loading (aka dynamic imports) is the only thing that caught my attention, but we are not making much use of that yet. It might be worth exploring this more in a separate "investigation" ticket.

    Ref: https://www.google.com/search?q=nuxt+lazy+load

    Does this adequately satisfy the security concerns?

  5. severinbeauvais commented on Aug 13, 2025

    @severinbeauvais
    Collaborator
  6. seeker25 commented on Aug 13, 2025

    @seeker25
    Contributor

    There is nothing wrong with exposing permissions on the client side, the UI has to know which actions to allow and not.
    We're not using server side rendering here (thus why it has to get it from the API). We already do this for auth-web.
    The issue is if these aren't implemented on the API side it causes a huge security hole.

  7. argush3 commented on Aug 13, 2025

    @argush3
    Contributor

    Yeah, as long as we have the API doing the check, the FE exposing permissions for the users role is a non-issue.

  8. OlgaPotiagalova commented on Aug 21, 2025

    @OlgaPotiagalova
    CollaboratorAuthor

    API checks will be implemented in the tickets under the parent epic

  9. VarekBoettcher commented on Aug 21, 2025

    @VarekBoettcher
    Collaborator

    Hello. Olga asked that I have a look and comment as I was the one that raised the concern.

    I don't work in your codebase so I recognize that my observations are more general than specific. I was taught that any UI we offer that runs on the client-side is an attack surface because the client owns the runtime environment. It was in that context that the plain-text security roles got my attention.

    That said, after reading the comments I agree with @severinbeauvais that, if the roles have to be exposed, having the API protect itself from unauthorized requests is the best mitigation for that exposure. This is also a best practice.

    I appreciate the time you all took to address my concern. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Entities Team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions