Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageSecurity.EnhanceClass is not thread safe #79

Open
joozek78 opened this issue Dec 12, 2018 · 1 comment
Open

PageSecurity.EnhanceClass is not thread safe #79

joozek78 opened this issue Dec 12, 2018 · 1 comment

Comments

@joozek78
Copy link
Contributor

PageSecurity.EnhanceClass is responsible for altering TypedJson schema of a view-model to include permission checking. Problems can now occur, because:

  1. Two threads access a view-model for the first time and they both enhance it at the same time, mangling their modifications
  2. Two threads access a view-model for the first time and one enhances it, while the other is using it
  3. There can be more problems

There should be locking in this method, but since it's on a path of every request a naive lock statement could hurt performance significantly.

@miyconst
Copy link
Member

... altering TypedJson schema of a view-model to include permission checking.

I think, that this operation shall happen inside a lock and during application startup. Adding more and more checks per request will contribute to the overall app latency, while doing it once on app start will only affect app startup time.

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

No branches or pull requests

4 participants