From 58f02cd20c130f265ff8d546713166fa93f6582a Mon Sep 17 00:00:00 2001 From: Gagan Tunuguntla Date: Tue, 7 Jan 2020 23:01:40 -0500 Subject: [PATCH 1/7] [Bug] Handle Sheet Names --- .aws-infrastructure/README.md | 2 ++ .utils/README.md | 3 +++ CHANGELOG.md | 25 +++++++++++++++++++++++++ api/README.md | 5 +++-- api/requirements.txt | 2 -- api/src/sheet/__init__.py | 9 ++++++--- client-ui/README.md | 2 ++ 7 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 .utils/README.md create mode 100644 CHANGELOG.md delete mode 100644 api/requirements.txt diff --git a/.aws-infrastructure/README.md b/.aws-infrastructure/README.md index 3247665..0a330dc 100644 --- a/.aws-infrastructure/README.md +++ b/.aws-infrastructure/README.md @@ -1,3 +1,5 @@ +**This README was auto generated by AWS CDK. It is not official Documentation for the project, but it is helpful to read to understand the Infrastructure service and how to modify/improve it.** + # Welcome to your CDK TypeScript project! This is a blank project for TypeScript development with CDK. diff --git a/.utils/README.md b/.utils/README.md new file mode 100644 index 0000000..85cce32 --- /dev/null +++ b/.utils/README.md @@ -0,0 +1,3 @@ +# Utilities + +This folder contains the utilities cli. In here are a collection of scripts to assist this project. You can install the cli with `npm install` and run it with `node main.js`. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7672679 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# CHANGELOG.md + +## (unreleased) + +Bug Fixes: + - Prevent Sheet names from unsafe characters (based on safe characters of S3 keys) + +## v1.0 + +Features: +- First Major Release +- Functional UI +- Functional Api +- Authentication +- Functional Personal and Team Workspaces +- Software to create Infrastructure Stack +- Software to create Code Stack +- Software to create Network Stack +- Local Development +- Continuous Deployment of Code Stack +- Continuous Deployment of UI +- Working Production Environment +- Utility scripts with: + - Create env files + - Encode env file as Base64 diff --git a/api/README.md b/api/README.md index a42c803..175b972 100644 --- a/api/README.md +++ b/api/README.md @@ -1,3 +1,5 @@ +**This README was auto generated by AWS SAM. It is not official Documentation for the project, but it is helpful to read to understand the Api service and how to modify/improve it.** + # sam-app This is a sample template for sam-app - Below is a brief explanation of what we have generated for you: @@ -98,7 +100,7 @@ aws cloudformation describe-stacks \ --stack-name sam-app \ --query 'Stacks[].Outputs[?OutputKey==`HelloWorldApi`]' \ --output table -``` +``` ## Fetch, tail, and filter Lambda function logs @@ -207,4 +209,3 @@ aws cloudformation describe-stacks \ # Tail Lambda function Logs using Logical name defined in SAM Template sam logs -n HelloWorldFunction --stack-name sam-app --tail ``` - diff --git a/api/requirements.txt b/api/requirements.txt deleted file mode 100644 index 66f55b2..0000000 --- a/api/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -pyjwt==1.7.1 -cryptography==2.8 diff --git a/api/src/sheet/__init__.py b/api/src/sheet/__init__.py index 7c6e4e6..5c2aaa4 100644 --- a/api/src/sheet/__init__.py +++ b/api/src/sheet/__init__.py @@ -1,9 +1,7 @@ """ API methods for /sheet """ -import boto3 -import json -import datetime +import boto3, json, datetime, re from boto3 import client s3_client = client('s3') from __core__.settings import AVAILABLE_FILE_TYPES, SHEET_DATA_S3_BUCKET @@ -41,6 +39,11 @@ def post(event, context): # Error if sheet name exists return get_error_response(f'Sheet with name {event["body"]["sheetName"]} already exists') + valid_name_pattern = re.compile("[a-zA-Z0-9!\-_*]+") + if valid_name_pattern.fullmatch(event['body']['sheetName']) is None: + # Error if sheet name has invalid characters + return get_error_response(f'Sheet name must be alphanumeric and may contain the following characters: -, !, _, *') + if 'defaultFileType' not in event['body'] or event['body']['sheetName'] is None: # Error if Default File type was not provided return get_error_response('No Default File Type was provided') diff --git a/client-ui/README.md b/client-ui/README.md index 3e396d2..a7ab6c5 100644 --- a/client-ui/README.md +++ b/client-ui/README.md @@ -1,3 +1,5 @@ +**This README was auto generated by Angular. It is not official Documentation for the project, but it is helpful to read to understand the Client UI service and how to modify/improve it.** + # CheatSheet This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.0. From f7ae6cb6bfc2a683f9705a4a82c801ab110f2484 Mon Sep 17 00:00:00 2001 From: Gagan Tunuguntla Date: Tue, 7 Jan 2020 23:30:44 -0500 Subject: [PATCH 2/7] rel links attempt --- README.md | 8 ++++---- docs/architecture-overview.md | 12 ++++++------ docs/getting-started.md | 12 ++++++------ docs/setting-up-ci-cd.md | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index a7a3900..b9f4c80 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ If you use the app and like it please leave a star. If you find bugs feel free t

Public View

@@ -31,7 +31,7 @@ Cheet Sheet is fairly simple to understand. Code snippets are are organized as s

Personal View

@@ -41,7 +41,7 @@ If you sign up for an account and log in, you will have access to your own Perso

Personal View Edit Mode

@@ -52,7 +52,7 @@ You can enter Edit mode by manually toggling it on and off. When on, you can add

Personal View Edit Mode

diff --git a/docs/architecture-overview.md b/docs/architecture-overview.md index 7020bc0..fc8e96c 100644 --- a/docs/architecture-overview.md +++ b/docs/architecture-overview.md @@ -4,7 +4,7 @@

Remote Environment

@@ -21,7 +21,7 @@ The Api Deployment bucket does not play an active role in the Infrastructure. Bu

Deployment Process

@@ -45,7 +45,7 @@ Other things to note:

Infrastructure Stack

@@ -54,7 +54,7 @@ Other things to note:

Code Stack

@@ -63,7 +63,7 @@ Other things to note:

Network Stack

@@ -73,7 +73,7 @@ Other things to note:

Local Environment

diff --git a/docs/getting-started.md b/docs/getting-started.md index 902cf05..176537f 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -3,21 +3,21 @@ This document and the following ones will help you set up Cheet Sheet. ### Preliminary Setup -Click [here](/docs/setting-up-preliminary-tools.md) to read the necessary prep to run the app locally and/or deploy it to AWS. +Click [here](setting-up-preliminary-tools.md) to read the necessary prep to run the app locally and/or deploy it to AWS. ### Set Up and Run Locally -Click [here](/docs/setting-up-locally.md) to learn how to setup and run the app on your local machine. This is good for development and testing. +Click [here](setting-up-locally.md) to learn how to setup and run the app on your local machine. This is good for development and testing. ### Set Up and Deploy to AWS -Click [here](/docs/setting-up-remote.md) to learn how to setup and deploy the app to the cloud so that you and others can use it in real life. +Click [here](setting-up-remote.md) to learn how to setup and deploy the app to the cloud so that you and others can use it in real life. ### Set Up Continuous Deployment -Click [here](/docs/setting-up-ci-cd.md) to learn how to setup continuous deployment through CircleCI. This will automate deployment of changes to the API and UI, so that effort can be focused on designing new features rather than launching them. +Click [here](setting-up-ci-cd.md) to learn how to setup continuous deployment through CircleCI. This will automate deployment of changes to the API and UI, so that effort can be focused on designing new features rather than launching them. # Other Useful Documents ### Architecture Diagrams and Overview -Click [here](/docs/architecture-overview.md) to understand how Cheet Sheet is built, and designed. +Click [here](architecture-overview.md) to understand how Cheet Sheet is built, and designed. ### Environment Variable Glossary -Click [here](/docs/environment-variable-glossary.md) to learn what the different Environment variables in the app are. +Click [here](environment-variable-glossary.md) to learn what the different Environment variables in the app are. diff --git a/docs/setting-up-ci-cd.md b/docs/setting-up-ci-cd.md index 3a5145a..0e8e1ed 100644 --- a/docs/setting-up-ci-cd.md +++ b/docs/setting-up-ci-cd.md @@ -9,7 +9,7 @@ Continuous Deployment automates the updating of new code in our Api and UI so th ## STEP 2: Create the ENVIRONMENT variable out of your remote.env -1. In [Setting Up And Launching The App On AWS](/docs/setting-up-remote.md) find the `remote.env` file you made for code deploys +1. In [Setting Up And Launching The App On AWS](setting-up-remote.md) find the `remote.env` file you made for code deploys 1. From the `.utils` folder run `node main.js create-infra-env` generate-base64-env. This will encode all contents of the `.env` file as base64 and spit it out. 1. The way we do continuous deployment is by mapping a branch in your repo to an environment variable that has the contents of `remote.env` (base 64 encoded). Out of the box, the following deployment strategies are provided. If you want to change the branch name, environment variable name, or add a new strategy, follow **STEP 3**. From c9225eef8f406ad8997134b500ad17e674ca2755 Mon Sep 17 00:00:00 2001 From: Gagan Tunuguntla Date: Tue, 7 Jan 2020 23:35:54 -0500 Subject: [PATCH 3/7] change log update --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7672679..af105c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,11 @@ ## (unreleased) +Features: +- Working Github Pages Link https://gugzkumar.github.io/cheet-sheet/ + Bug Fixes: - - Prevent Sheet names from unsafe characters (based on safe characters of S3 keys) +- Prevent Sheet names from unsafe characters (based on safe characters of S3 keys) ## v1.0 From 3e5548a917d3829a239432454cfd9917578bc1fe Mon Sep 17 00:00:00 2001 From: Gagan Tunuguntla Date: Tue, 7 Jan 2020 23:44:39 -0500 Subject: [PATCH 4/7] hot fix update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9f4c80..297e162 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Cheet Sheet

From d7c4b9284e2161860f880d11123684777f850e24 Mon Sep 17 00:00:00 2001 From: Gagan Tunuguntla Date: Tue, 7 Jan 2020 23:53:25 -0500 Subject: [PATCH 5/7] Set theme jekyll-theme-slate --- _config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 _config.yml diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c741881 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file From d20d6b7e324d0f9cea1fd88e2fe7cce94ec2c866 Mon Sep 17 00:00:00 2001 From: Gagan Tunuguntla Date: Tue, 7 Jan 2020 23:55:40 -0500 Subject: [PATCH 6/7] Set theme jekyll-theme-hacker --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index c741881..fc24e7a 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-slate \ No newline at end of file +theme: jekyll-theme-hacker \ No newline at end of file From 021928a2ad1c58f736eb6359f801313412f560b9 Mon Sep 17 00:00:00 2001 From: Gagan Tunuguntla Date: Tue, 7 Jan 2020 23:57:30 -0500 Subject: [PATCH 7/7] Set theme jekyll-theme-architect --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index fc24e7a..3397c9a 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-hacker \ No newline at end of file +theme: jekyll-theme-architect \ No newline at end of file