-
Notifications
You must be signed in to change notification settings - Fork 55
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
Discord slash command code to grant AWS access #276
Conversation
Grant aws access - test cases
Grant aws access
src/utils/awsAccess.ts
Outdated
channelId: number | ||
) { | ||
const authToken = await jwt.sign( | ||
{ name: "Cloudflare Worker", exp: Math.floor(Date.now() / 1000) + 2 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the name here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the website backend, we check if the auth token has the name "cloudfare workers" to validate the token coming from right source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is a string helping in validating the right source?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we create a token in the discord slash commands with name present in payload, this is signed by using the private key and in website backend we validate if the same text is being received post validating the token.
@prakashchoudhary07
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to discuss on this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure @prakashchoudhary07
src/utils/awsAccess.ts
Outdated
TraceId: string, | ||
channelId: number | ||
) { | ||
const authToken = await jwt.sign( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we already have this? why write it again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't get this comment, we are using this in similar manner in one of the other API too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So at every place we are manually signing, So don't already have a common thing to do this, if not then please create one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have created a common utility for this.
src/utils/awsAccess.ts
Outdated
userId: discordUserId, | ||
}; | ||
|
||
const url = `${base_url}/aws-access/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create the URL in constant it self?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And please share the doc for using it herE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we mean it like
const url = ${base_url}/aws-access
this way we have it stored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't get this which doc?
And please share the doc for using it herE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please share the AWS API docs like, of what they are doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is our website backend API, will add the comments there.
Grant aws access
correcting package.json file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this command is not under feature flag?
When I discussed with Tejas about feature flag he suggested to have the backend route under ff and since this command can be only used by super user didn't add the ff @vinit717 |
Have added the feature flag, and also fixed the register command which was failing, the reason is mentioned here https://discord.com/channels/673083527624916993/688816539775926272/1306095480836591626 |
e04b977
…ed as undefined, due to recent change
Please update the description and screenshots first |
Date: 19th Oct
Developer Name: Vikhyat
Issue Ticket Number
Real-Dev-Squad/todo-action-items#253
Description
This change is for the discord command to grant AWS access to the developers, we can tag the developer and the group we wanted to add the user in.
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Test Coverage