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

Dev to main sync #1841

Merged
merged 12 commits into from
Jan 19, 2024
Merged

Dev to main sync #1841

merged 12 commits into from
Jan 19, 2024

Conversation

prakashchoudhary07
Copy link
Contributor

@prakashchoudhary07 prakashchoudhary07 commented Jan 8, 2024

Date: 09-1-24

Developer Name: @prakashchoudhary07


PR's going in

(Developer)s Name

Is Under Feature Flag

  • Yes
  • No

Database changes

  • Yes
  • No

Breaking changes (If your feature is breaking/missing something please mention pending tickets)

  • Yes
  • No

Is Development Tested?

  • Yes
  • No

Is it tested in staging?

  • Yes
  • No

Add relevant Screenshot below ( e.g test coverage etc. )

#1841 (comment)

Ajeyakrishna-k and others added 3 commits January 8, 2024 12:27
* doc: added doc for user status flow diagram

* flow diagram updated
* fix: add condition to skip discordId check

* fix: add superuser check

* test: add test for super user check

* fix: remove unused code
return res.json({ message: "pong" });
};

router.get("/for-super-user", authorization([ROLES.SUPERUSER], [Services.CRON_JOB_HANDLER]), pongHandler);

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.

describe("Service Authorization", function () {
it("should return unauthorized for invalid authorization header format", async function () {
req.headers.authorization = "InvalidHeader";

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "InvalidHeader" is used as
authorization header
.
});

it("should return unauthorized for invalid JWT token", async function () {
req.headers.authorization = "Bearer invalid_token";

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "Bearer invalid_token" is used as
authorization header
.
@satyam73
Copy link
Member

satyam73 commented Jan 8, 2024

Staging proof of #1839

image

get request to get invite for user

image

post request if user invite is already present

image

post request for invitation code

router.post("/", answerValidators.createAnswer, answers.createAnswer);
router.patch(
"/:answerId",
authenticate,

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
* API for applications

* authorizeown or super user middleware in get request

* validator changes

* config changes

* log for update application

* test for get application API

* completed get application tests

* application API test completed

* changed according to the discord link generate api changes

* few changes based on new requirement and few changes after self review

* controller message changed

* removed unwanted code and updated types for controller methods

* fix for failing tests

* removed console log

* made changes suggested

* logger string change

* fix issues in comments, logger error, and types

* fix for logtype import issue

* application import fix

* updated validator according to model change and removed unwanted imports

* fix for faling build

* filtering based on status

* updated getAllApplication tests

* removed only from tests

* added new route to get application by id

* validation for status sent in payload

* logic change for sending all user applications

* made userId optional

* completed suggested changes on PR

* created at field in applications

* tests for application details API

* updated test for updating applications

* pagination for applications API

* logic change for pending application for user

* completed model tests for application

* removed .only from applications model tests

* updated integration test

* change in application get API test with status

* removed only from tests

* added try catch

* script for updating applications

* application model test for batch update

* integration test for batch update API

* unit test for model for batch updating applications

* fix failing unit test

* removed console logs

---------

Co-authored-by: Prakash Choudhary <[email protected]>
Co-authored-by: Sunny Sahsi <[email protected]>
Co-authored-by: Vikhyat Bhatnagar <[email protected]>
@@ -24,5 +24,6 @@
applicationValidator.validateApplicationUpdateData,
applications.updateApplication
);
router.patch("/batch/update", authenticate, authorizeRoles([SUPERUSER]), applications.batchUpdateApplications);

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
@satyam73
Copy link
Member

Staging working proof of #1742

image

Get request with status query param initial connection with data: null

image

Get request with questionId and status query param initial connection with data: null

image

Post API /answers

image

Get api triiger when post api triggers

image

Unauthorized if user is not super user or member

image

Succesful patch request when member is true

image

Succesful patch request when super_user is true

image

status query with APPROVED value (get request) triggers when there is any update happens with PATCH request /answers

Ajeyakrishna-k and others added 2 commits January 12, 2024 05:17
)

* added types and middleware for ooo status request

* added test and fixtures data ooo request

* added more test and fix middleware ooo get request

* refactor test and data

* Update test/unit/middlewares/request.test.ts

* remove unused import

* added more validation to validate create ooo request

* refactor middleware and fix test

* fix error and improve test coverage

* change processedBy to lastUpdatedBy
@Ajeyakrishna-k
Copy link
Contributor

Ajeyakrishna-k commented Jan 15, 2024

My changes Look good 👍. Can't verify as its only a middleware

satyam73
satyam73 previously approved these changes Jan 15, 2024
// WARNING!! - One time Script/Route to do migration
router.post(
"/migrations",
authenticate,

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
This route handler performs
authorization
, but is not rate-limited.
@joyguptaa
Copy link
Contributor

Date: 22-Jan-2023

Developer Name: @ardourApeX


PR's going in

(Developer)s Name

  • @ardourApeX

Is Under the Feature Flag

  • Yes
  • No

Database changes

  • Yes
  • No

Breaking changes (If your feature is breaking/missing something please mention pending tickets)

  • Yes
  • No

Is Development Tested?

  • Yes
  • No

Is it tested in staging?

  • Yes
  • No

Add relevant Screenshot below ( e.g test coverage etc. )

github_user_id being added after login

Screen.Recording.2024-01-18.at.10.08.46.PM.mov

Status before triggering the API

Screen.Recording.2024-01-18.at.11.54.03.PM.mov

API Response

Screen.Recording.2024-01-18.at.11.59.14.PM.mov

Status after executing the API

WhatsApp Image 2024-01-19 at 11 15 50 AM (1)

WhatsApp Image 2024-01-19 at 11 15 50 AM

* chore : added middleware for invite API and type package for sinon

* test: added test for middaleware with data

* refactor: change field reason to purpose

* feat: added new api for discord invites

* refactor: change file and added inviteLink to type

* fix import

* added config for external service authintication

* test: fix failing test

* change field name uniqueUserId to userId

* refactor: fix error message

* refactor: using existing model or collection for storing invite data in db

* fix test and used global custom respone type

* refactor: create seprate middleware for authinticate external service
import { createInviteLink,getInviteLink } from "../controllers/invites";
import authinticateServiceRequest from "../middlewares/authinticateServiceRequest";

router.post("/",authinticateServiceRequest, createInviteValidator, createInviteLink);

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
import authinticateServiceRequest from "../middlewares/authinticateServiceRequest";

router.post("/",authinticateServiceRequest, createInviteValidator, createInviteLink);
router.get("/:userId" ,authinticateServiceRequest, getInviteLink);

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
@sahsisunny
Copy link
Member

sahsisunny commented Jan 19, 2024

@iamitprakash iamitprakash merged commit 1deeedb into main Jan 19, 2024
4 of 5 checks passed
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

7 participants