Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
c010939
Add primitive database
whitefusion Feb 22, 2018
9331f87
fill up team member
whitefusion Feb 22, 2018
e9e4cee
add token table
whitefusion Feb 22, 2018
f4e6fd7
First draft of REST api, further test required
whitefusion Feb 22, 2018
b1b6df2
update database file
whitefusion Feb 22, 2018
cf48b35
Remove redundant column
whitefusion Feb 23, 2018
af7d997
fix minor syntax error
whitefusion Feb 23, 2018
bbf6009
clear up databse
whitefusion Feb 23, 2018
8885825
remove old databse
whitefusion Feb 23, 2018
3e8190c
models.py
whitefusion Feb 23, 2018
45ead1d
optimize model
whitefusion Feb 23, 2018
18e0e86
fix typos and handle exceptions
whitefusion Feb 23, 2018
61448de
add username column in token table to realize no Auth
whitefusion Feb 23, 2018
59a20ae
basic tests finished on a token-domainted api server
whitefusion Feb 23, 2018
5684c6c
fix no diary id
whitefusion Feb 24, 2018
a2de0d7
add requirements file
whitefusion Feb 25, 2018
73733ee
app.py
whitefusion Feb 25, 2018
ca9f6a9
use bleach to santinize user input
whitefusion Feb 25, 2018
06c26f6
Update requirements.txt
luisliuchao Feb 27, 2018
15ebdad
Start react frontend
luisliuchao Feb 24, 2018
6e878a6
Add react-router and home page
luisliuchao Feb 24, 2018
030ff1a
Add Login page
luisliuchao Feb 25, 2018
f28466a
Add sign up page
luisliuchao Feb 25, 2018
b9303b1
Use bootstrap style
luisliuchao Feb 25, 2018
cf107b4
Render public diaries
luisliuchao Feb 25, 2018
a6f0536
Use react-redux
luisliuchao Feb 25, 2018
12924b7
Enable to login user
luisliuchao Feb 26, 2018
1041c82
Show account information
luisliuchao Feb 26, 2018
b3c2d20
Enalbe to log user out
luisliuchao Feb 26, 2018
0ef42f6
Enable to create new diary
luisliuchao Feb 27, 2018
17bed8d
Enable to delete diary
luisliuchao Feb 27, 2018
8219e39
Enable to toggle diary permission
luisliuchao Feb 27, 2018
6b04d38
Enable to set public when creating new diary
luisliuchao Feb 27, 2018
79b6c8b
Only author can toggle the diary's permission
luisliuchao Feb 27, 2018
cb142aa
add result field
whitefusion Feb 28, 2018
31fdc4f
fix delete diary that does not exist
whitefusion Feb 28, 2018
fd3da8d
logistics update
whitefusion Feb 28, 2018
55db4a7
Adjust the api change with result attribute
luisliuchao Mar 1, 2018
ea96507
Update the docker process
luisliuchao Mar 1, 2018
a1aab56
Add devTool dev dependency
luisliuchao Mar 3, 2018
7c86548
Add preview screenshots
whitefusion Mar 3, 2018
501e2f8
Update README.md
whitefusion Mar 3, 2018
8cfcb19
Delete home_login.png
whitefusion Mar 3, 2018
2dcdc23
Delete home.png
whitefusion Mar 3, 2018
6df99d3
Add files via upload
whitefusion Mar 3, 2018
08b7d9f
Map port 80 from host machine to port 3000 in frontend container
luisliuchao Mar 4, 2018
9569da0
Upate README.md with docker-compose installation instructions
luisliuchao Mar 4, 2018
2f9c5f5
Update README.md with new screenshots
luisliuchao Mar 4, 2018
c894b30
Fix the finally error in firefox in ubuntu
luisliuchao Mar 4, 2018
6b3815f
Update the README.md with answers to questions
luisliuchao Mar 4, 2018
315a949
Release v1.0
luisliuchao Mar 4, 2018
00e0724
Merge branch 'release/v1.0' into develop
luisliuchao Mar 4, 2018
5e98e5a
Merge branch 'release/v1.0'
luisliuchao Mar 4, 2018
22dd656
use debug=False when starting the server
May 12, 2018
20e9b91
Merge branch 'release/v1.1'
May 12, 2018
be7385a
fix multi-threading sharing error
whitefusion May 14, 2018
91c190b
add grader.py
whitefusion May 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

128 changes: 92 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rest-api-development
# rest-api-development - WLKB :boom:

CS5331 Assignment 1 Project Reference Repository

Expand All @@ -15,11 +15,11 @@ beaten path.

You may be required to modify the following files/directories:

- Dockerfile - contains the environment setup scripts to ensure a homogenous
* Dockerfile - contains the environment setup scripts to ensure a homogenous
development environment
- src/ - contains the front-end code in `html` and the skeleton Flask API code
* src/ - contains the front-end code in `html` and the skeleton Flask API code
in `service`
- img/ - contains images used for this README
* img/ - contains images used for this README

Assuming you're developing on an Ubuntu 16.04 machine, the quick instructions
to get up and running are:
Expand Down Expand Up @@ -50,6 +50,22 @@ sudo docker run hello-world
sudo ./run.sh
```

```
# Install Docker Compose

# Run this command to download the latest version of Docker Compose

sudo curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

# Apply executable permissions to the binary

sudo chmod +x /usr/local/bin/docker-compose

# Test the installation

docker-compose --version
```

(Docker CE installation instructions are from this
[link](https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-repository).)

Expand All @@ -63,8 +79,8 @@ running it. The grading script will interact with your API.

The following ports are expected to be accessible:

1. 80, on which static HTML content, including the front-end, is served.
2. 8080, on which the API is exposed.
1. 80, on which static HTML content, including the front-end, is served.
2. 8080, on which the API is exposed.

To verify this, please run the following commands:

Expand All @@ -83,61 +99,101 @@ If a response is received, you're good to go.

**Please replace the details below with information relevant to your team.**

## Screenshots
## Screenshots :facepunch:

* Register a User
![signup](./img/signup.png)

* Log In
![login](./img/login.png)

* Log Out
![logout](./img/logout.png)

* Display All Public Diaries
![public diaries](./img/home_public.png)

Please replace the example screenshots with screenshots of your completed
project. Feel free to include more than one.
* Display All Authenticated User's Diaries
![private diaries](./img/home_logged_in.png)

![Sample Screenshot](./img/samplescreenshot.png)
* Create a New Diary
![create new diary](./img/create_new_diary.png)

* Delete an Existing Diary
![delete diary](./img/delete_diary.png)

* Toggle a Diary's Permission
![toggle permission](./img/toggle_diary.png)

* User Profile
![user profile](./img/profile.png)

## Administration and Evaluation

Please fill out this section with details relevant to your team.

### Team Members

1. Member 1 Name
2. Member 2 Name
3. Member 3 Name
4. Member 4 Name
1. Wei Ran (A0174375X)
2. Liu Chao (A0174462A)
3. Kong Chao (A0174435A)
4. Bai Xin (A0163129H)

### Short Answer Questions
### Short Answer Questions :pray:

#### Question 1: Briefly describe the web technology stack used in your implementation.

Answer: Please replace this sentence with your answer.
Answer:

* frontend: react
* backend with api: flask
* database: sqlite

#### Question 2: Are there any security considerations your team thought about?

Answer: Please replace this sentence with your answer.
Answer:

#### Question 3: Are there any improvements you would make to the API specification to improve the security of the web application?
* user input sanitization both in frontend and backend to prevent XSS attack
* implement ORM on top of database layer to prevent SQL injection
* add secure cookie in reponse header to prevent XSRF attack
* implement HTTPs for secure request and apply for SSL Certificate for the server

Answer: Please replace this sentence with your answer.
#### Question 3: Are there any improvements you would make to the API specification to improve the security of the web application?

#### Question 4: Are there any additional features you would like to highlight?
Answer:

Answer: Please replace this sentence with your answer.
* Server side should expire token in a short period to prevent token leakage danger
* Backend can record the request's ip address and check for abnormal request from different locations.
* Server side should expire user's token when observing massive requests in a short period of time.

#### Question 5: Is your web application vulnerable? If yes, how and why? If not, what measures did you take to secure it?
#### Question 4: Are there any additional features you would like to highlight?

Answer: Please replace this sentence with your answer.
Answer:

#### Feedback: Is there any other feedback you would like to give?
* Reponsive and modern UI

Answer: Please replace this sentence with your answer.
#### Question 5: Is your web application vulnerable? If yes, how and why? If not, what measures did you take to secure it?

### Declaration
Answer: To some extend can be considered as secure

#### Please declare your individual contributions to the assignment:
* Both frontend and backend sanitize user input before processing the request
* Server side implments ORM on top of the database to prevent SQL injection.

1. Member 1 Name
- Integrated feature x into component y
- Implemented z
2. Member 2 Name
- Wrote the front-end code
3. Member 3 Name
- Designed the database schema
4. Member 4 Name
- Implemented x
#### Feedback: Is there any other feedback you would like to give?

Answer: No, the API docs looks good.

### Declaration :confetti_ball: :tada: :bell:

1. Wei Ran
* Test the API robustness with edge cases
* Test the web security with the possible XSS attack
2. Liu Chao
* Write the front-end code and test the API functionality
* Refine the docker build process
3. Kong Chao
* Test the API robustness with edge cases
* Test the web security with the possible SQL injection attack
4. Bai Xin
* Design the database schema
* Implement the rest API functions
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'
services:
frontend:
container_name: WLKB-frontend
build: ./src/webapp
ports:
- "3000:3000"
- "80:3000"
backend:
container_name: WLKB-backend
build: ./src/service
ports:
- "8080:8080"

Loading