-
Notifications
You must be signed in to change notification settings - Fork 11
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
[Central_v2] - User Sign Up - Teacher IDs #1366
Comments
Here's a basic output from gpt-o1-mini as a starting point: Overview Step 2: Set Up API Gateway with Lambda Integration Step 3: Create the Lambda Function Assumptions
Explanation of the Lambda Function AWS SDK: Used to interact with S3. HTTP Method & Parameters: Determines the operation based on the HTTP method (GET, PUT, DELETE) and retrieves necessary parameters. Object Key Validation: Ensures that the requested object key starts with the user's ID (userId/), thereby restricting access to only their objects. GET: Catches and logs errors, returning a 500 Internal Server Error status code if something goes wrong. Navigate to API Gateway in the AWS Console. Lambda Execution Role: Navigate to the IAM console.
Replace your-bucket-name with your actual bucket name. Amplify typically handles this automatically, but ensure that API Gateway can invoke your Lambda function. |
The final piece of the
User
puzzle is handling the upload of Teacher IDs, in this part of the Sign Up page:Security:
Short of student data, this represents the most sensitive data that we will be handling at RightOn and therefore, security is paramount. We definitely want to be making sure that we offload all the authorization of this information to AWS and aren't trying to handle anything ourselves.
In terms of the actual authorization required, we can follow the same properties as the User table. We want to restrict access only to individuals that actually own the data. In this case, that means that users should only ever be able to access their own IDs. They should never have access to other teachers ids.
Amplify:
Amplify provides out-of-the-box integration with S3 via
amplify add storage
. However, we are on amplify gen1 there is no way to add multiple storage buckets and we are already using amplify add storage to handle game and question template images (which has a lot higher frequency of use). Additionally, updating to amplify gen 2 will break our backend and AWS advises to wait until they have automigration tools released.All this is to say we can't use
amplify add storage
for this.Lambda:
The alternative then is to set up an S3 bucket on our backend, and then write Lambda functions to securely manage the access of the images. We can integrate as many Lambda functions as we want seamlessly in amplify via
amplify add function
and because all the code in a Lambda function is run in AWS we can be confident that it will be secure. Ideally, we'll be looking to set up some API functions innetworking
that will send our auth credentials to the Lambda function and send an either putS3Object or getS3Object response.We can use
gpt-o1-mini
to give us a starting point for how to write the lambda function and hook up the S3 integration and our auth credentials. First, we're going to runamplify add function
to create a new Node.js lambda function. We're also (I think) going to need to create an S3 bucket on the console (because we can't use amplify for this)The text was updated successfully, but these errors were encountered: