Skip to content

Add db check to generateToken function #886

Description

@ignatiusm

Currently application/backend/src/authentication.ts does not check the provided UserID exists in the DB (as it is only called after a user is inserted or queried). I think it probably should - the cost of an extra db query may be probably worth the extra security. I see there is a risk that someone would assume the generateToken function to do this check.

Changing this behaviour will break some tests (e.g. application/backend/tests/integration/Survey.test.ts but that is easily fixed.

Please discuss any concerns below!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions