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

feat: validate that id is number or we throw our our source code #6860

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

sjaanus
Copy link
Contributor

@sjaanus sjaanus commented Apr 15, 2024

Previously, we were not validating that the ID was a number, which sometimes resulted in returning our database queries (source code) to the frontend. Now, we have validation middleware.

Copy link

vercel bot commented Apr 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Apr 16, 2024 0:39am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Apr 16, 2024 0:39am

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 2 findings(s) 🚩

View detailed results in CodeScene

@@ -354,6 +355,7 @@ export default class UserAdminController extends Controller {
...getStandardResponses(400, 401, 404),
},
}),
idNumberMiddleware(),

Choose a reason for hiding this comment

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

❌ Getting worse: Large Method
UserAdminController.constructor increases from 303 to 306 lines of code, threshold = 70

Suppress

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 3 findings(s) 🚩

View detailed results in CodeScene

@@ -159,6 +160,7 @@ export class SegmentsController extends Controller {
200: createResponseSchema('segmentStrategiesSchema'),
},
}),
idNumberMiddleware(),

Choose a reason for hiding this comment

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

❌ Getting worse: Large Method
SegmentsController.constructor increases from 196 to 200 lines of code, threshold = 70

Suppress

@@ -109,6 +110,7 @@ export default class PatController extends Controller {
...getStandardResponses(401, 403, 404),
},
}),
idNumberMiddleware(),

Choose a reason for hiding this comment

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

❌ Getting worse: Large Method
PatController.constructor increases from 75 to 76 lines of code, threshold = 70

Suppress

Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

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

LGTM. The refactoring looks simple enough. Were there tests testing this functionality in the places we changed from the controller level validation to the middleware?

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 3 findings(s) 🚩

View detailed results in CodeScene

@sjaanus sjaanus merged commit 023e159 into main Apr 16, 2024
6 of 7 checks passed
@sjaanus sjaanus deleted the id-number branch April 16, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants