nikhilc3 / csa

MIT License
0 stars 0 forks source link

CS Review Ticket Pop Quiz #2

Open nikhilc3 opened 5 months ago

nikhilc3 commented 5 months ago
Question Score
Question 1 0.95
Question 2 0.90 (not including in final score)
Question 3 0.92
Question 4 0.9
Question 6 0.9

Extra Key Indicators for questions shown below

1. JWT Signup and/or Login Process & Diagram Explanation (0.95)

IDK123

image

The diagram shows a web application security architecture where:

2. POJO and Changes to a POJO (0.9 although not including)

A POJO is a simple Java object no extending of class and cant implement anything and no outside annotation. It's primarily used to hold data and is easily manipulated due to its simplicity.

A class used on its own

When you change a POJO, remember it might affect other parts of my program, like database operations if the POJO is linked to a database table.

public class User {
    private String name;
    private String email;

    // Constructor, getters, and setters, although does not need to be a pojo, needs it to be a java bean though
    public User(String name, String email) {
        this.name = name;
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}

3. Security Configuration Rules for Access (0.92)

Image for proof of work: Screenshot 2024-01-30 at 11 08 42 PM Line 71, permit all

Extra(HTTPS on deployed backend): Screenshot 2024-01-30 at 11 10 22 PM

Security configuration rules are like the bouncers of an application; they control who gets in and to what parts. In a Spring application, these rules are set up in a security configuration class where you define patterns like:

These rules help ensure that users can only access what they're supposed to.

4. Docker and Update Process (0.9)

EC2 Console: Screenshot 2024-01-30 at 11 27 35 PM

steps (EC2 Console for deployed):

My deployed server link: https://ncloginback.stu.nighthawkcodingsociety.com/

I think of Docker as a virtual shipping container for your application. It packages up an application and all the parts it needs to run. This makes it easy to move around and run consistently in different environments.

This process minimizes downtime and ensures that everyone is using the same version of your application.

5. Route 53 and Domain Setup Process (Extra Indicator)

deployed backend with route 53: https://ncloginback.stu.nighthawkcodingsociety.com/

image of route 53: Screenshot 2024-01-30 at 11 14 36 PM

Amazon Route 53 is a service that manages domain names and routes users to where your application is hosted. Setting up a domain is like telling the internet where to find your house.

With Route 53, users can find your application using a friendly domain name instead of a complicated IP address.

6. API Access Code and Error Handling (0.9)

Implementation of error handling on frontend for my signup page:

Screenshot 2024-01-30 at 11 17 27 PM

Interacting with an API involves sending a request to a server and getting back a response. Your code should be prepared to handle both successful responses and errors.

Example of error handling format(extra)

// A simple AJAX request using jQuery to an API:
$.ajax({
    url: 'https://api.example.com/data',
    type: 'GET',
    success: function(response) {
        console.log('Data retrieved:', response);
    },
    error: function(xhr, status, error) {
        if (xhr.status === 403) {
            window.location.href = '/login'; // Redirect to login on a 403 error
        } else {
            console.error('An error occurred:', error);
        }
    }
});

7. Managing CORS Policies(extra)

nginx file for my deployed site: Screenshot 2024-01-30 at 11 21 46 PM

Securityconfig file: Screenshot 2024-01-30 at 11 22 29 PM

CORS is a security feature that lets you define how your web application can interact with other websites.

CORS ensures that your application only shares information with trusted sources.