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

refactor: convert remaining res.send to res.json #455

Merged
merged 3 commits into from
Oct 15, 2020

Conversation

mantariksh
Copy link
Contributor

Problem

Usage of res.send creates the risk of HTML injection attacks if not used with care. Using res.json is better practice.

Solution

This PR covers all remaining cases in the codebase where res.send is used. All these cases pass strings into res.send, hence these changes are backwards-compatible. The client sees the same response except with the Content-Type header changed from text/html to application/json.

Copy link
Contributor

@karrui karrui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

src/app/modules/auth/__tests__/auth.routes.spec.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@tshuli tshuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@mantariksh mantariksh merged commit 10fe178 into develop Oct 15, 2020
@tshuli tshuli mentioned this pull request Oct 20, 2020
@mantariksh mantariksh deleted the refactor/res-json-3 branch November 10, 2020 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants