Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Conversation

@torss
Copy link
Collaborator

@torss torss commented Dec 19, 2018

Description:

Closes #1072

Fixes the data leaks (full course & user leakage due to toObject) and access vulnerabilities of the three NotificationSettingsController routes. It simultaneously refactors the routes "severely", see below.

Improvements

  • To address the toObject-based data leaks a new INotificationSettingsView interface is introduced. It only contains the course ID besides the actual settings (notificationType & emailNotification). I.e. notification settings aren't even identified via their own internal IDs anymore, since a @CurrentUser & course pair is sufficient.
  • POST route was completely removed since it is obviated by the upgraded PUT route, which now has upsert enabled (among other refactoring and changes relating to INotificationSettingsView).
  • Arbitrary IDs are no longer allowed as route input in general (except for the PUT course), minimizing the attack surface. Instead the @CurrentUser is utilized etc. (This together with INotificationSettingsView responses secures GET completely.)
  • PUT route now handles 404 errors, i.e. when the course can't be found (+ new unit test).
  • PUT route also checks that the @CurrentUser is authorized to at least view the course (+ new unit test), although this is no longer strictly necessary from a security viewpoint due to the reduced attack surface.
  • Front-end parts are adjusted & refactored accordingly.
  • NotificationSettingsController unit test refactoring in general.
  • Unused NotificationSettings.ts front-end class file is removed.
  • (Other minor stuff like removing some unused imports, see the commits.)

Known Issues:

NONE

torss added 20 commits December 13, 2018 12:53
…-NotificationSettingsController-vulnerabilities

# Conflicts (resolved):
#	api/test/controllers/TestNotificationController.ts
This fixes the arbitrary id request vulnerability that
enabled anyone to read everyone else's notification settings.
Merely minor front-end changes were required, since the route is
only used to get the current user's settings anyway.
This is primarily meant to close the vulnerabilities that the unfiltered
toObject responses caused (i.e. full data leakage of course (& user) data),
but it also changes the PutNotificationSettings route to use the @currentuser
instead of an arbitrary user, since INotificationSettingsView doesn't contain
the user field any longer (but this alone does not yet fully secure the request
side of that route).
- It now uses clearly defined `@BodyParam`s.
- Instead of requiring an explicit ID, it now simply utilizes the
  given `course` & `@CurrentUser` to identify the settings.
- `upsert` is now enabled, so that the route should be capable of
  completely replacing the functionality of createNotificationSettings
  too (but for that further code changes are necessary).
This simplification is possible because there can only be one
NotificationSettings document per user/course pair anyway.
Because the front-end no longer needs the response info.
notificationSettingsService.updateItem(settings) didn't work because it
automatically appends the updateItem._id to the this.apiPath, while the
notification settings routes currently don't need any IDs at all.
…-NotificationSettingsController-vulnerabilities
@torss torss added bug This Issue describes a unwanted behavior api All Backend related Issues web-frontend All frontend related issues refactoring 🔒 security This directly pertains to geli's security! labels Dec 19, 2018
@torss torss merged commit 871f203 into develop Dec 20, 2018
@kesselb kesselb deleted the bugfix/#1072-NotificationSettingsController-vulnerabilities branch December 20, 2018 10:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api All Backend related Issues bug This Issue describes a unwanted behavior refactoring 🔒 security This directly pertains to geli's security! web-frontend All frontend related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 BUG: NotificationSettingsController vulnerabilities

3 participants