unc-csxl / csxl.unc.edu

CS Experience Labs' web application.
https://csxl.unc.edu
MIT License
9 stars 7 forks source link

Add Browser Push Notification Support #188

Open ajaygandecha opened 9 months ago

ajaygandecha commented 9 months ago

This ticket focuses on implementing the client side concern of leveling push notifications to the user through the browser. Safari and Chrome have push notification support.

Stories and Use Cases

Some immediate use cases of implementing push notification support would be:

Some future use cases of implementing push notification support would be:

KrisJordan commented 9 months ago

I was just reading about Web push trying to get an understanding of what it takes. It looks reasonably involved, but would be great to figure out how to bring into the stack!

krohan03 commented 6 months ago

XSS/CSRF Protections

As far as I am aware, we should already be protected against both XSS and CSRF attacks, which we need to be protected against according to the MDN Push Notifications API. There may be things that I missed that indicate that additional work is necessary for CSRF/XSS protection, so please take this with a grain of salt.

Cross-Site Request Forgery (CSRF)

Because the CSXL uses a bearer token system through local storage instead of Cookies, we should be protected from CSRF attacks. "Local Storage is vulnerable to XSS attacks, but not CSRF attacks. Local Storage is only accessible on the same domain" (Local Storage vs Cookies).

Cross-Site Scripting (XSS)

"There are no easy ways to prevent local storage data from being stolen using XSS attacks. Unlike cookies, there is no attribute that can prevent local storage from being accessible via javascript (and if there was, it would defeat the entire purpose of local storage)" (Local Storage vs Cookies).

While local storage methods are susceptible to XSS attacks, Angular has some built-in protections against script injection in inputs. Just to be careful, all inputs for the CSXL should ensure that user inputs are validated and/or are not directly displayed in a way that causes them to be run as code.

Resources