You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Security Concern: Exposure of Access Roles on the Client Side #29450
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.
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:
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.
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.
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.
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.
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.
Activity
thorwolpert commentedon Jul 9, 2025
Are you referring to roles in the JWT?
JWTs are cryptographically signed, so if they are tampered with the security check will fail.
severinbeauvais commentedon Jul 14, 2025
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:
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.
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.
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.
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.
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.
severinbeauvais commentedon Aug 13, 2025
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?
severinbeauvais commentedon Aug 13, 2025
@argush3 @vysakh-menon-aot @seeker25 @TVWerdal @bolyachevets @bobdev-94 - What do you guys think?
seeker25 commentedon Aug 13, 2025
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.
argush3 commentedon Aug 13, 2025
Yeah, as long as we have the API doing the check, the FE exposing permissions for the users role is a non-issue.
OlgaPotiagalova commentedon Aug 21, 2025
API checks will be implemented in the tickets under the parent epic
VarekBoettcher commentedon Aug 21, 2025
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.