|
| 1 | +# Code Security Challenge by the GitHub Security Lab |
| 2 | + |
| 3 | +## 👋 Welcome |
| 4 | + |
| 5 | +The mission of the GitHub Security Lab is to inspire and enable the community to secure the open source software we all depend on. Today, we are excited to present you a code security challenge inspired from real-world code, with which you can feel part of us through the thrill of finding and fixing a security issue! |
| 6 | + |
| 7 | +## 🎮 Time to PLAY! |
| 8 | + |
| 9 | +#### 🛠️ Clone the repository |
| 10 | + |
| 11 | +1. Click **Use this template** followed by **Create a new repository**. |
| 12 | +2. In the new tab, most of the prompts will automatically fill in for you. For the rest: |
| 13 | +- For owner, choose your personal account. |
| 14 | +- For repository name, choose a name of your preference. |
| 15 | +- For description, you can leave it blank. |
| 16 | +- For visibility, choose **Public** if you wish to use code scanning for free, with the downside of others being able to see your code. Choose **Private** if you wish to keep your code private, with the downside of not being able to use code scanning as you will need a paid plan. |
| 17 | +1. Click the **Create repository** button at the bottom of the form. |
| 18 | +1. You can now proceed to the following section. |
| 19 | + |
| 20 | +#### 💻 Run it in seconds via Codespaces (Recommended) |
| 21 | + |
| 22 | +The challenge is configured to run instantly with Codespaces, a fully configured dev environment in the cloud with up to 60 hours a month free. For more information, checkout [Codespaces](https://docs.github.com/en/codespaces/overview). If you prefer to work locally, please follow the local installation guide in the next section. |
| 23 | + |
| 24 | +To create a codespace: |
| 25 | +1. Click the **Code** drop down button in the upper-right of your repository navigation bar. |
| 26 | +1. Click **Create codespace on main**. |
| 27 | +1. After creating a codespace, wait for around a minute for the background installations to complete. |
| 28 | +1. Upon completion, ignore any files that may have changed such as `node_modules` and `package-lock.json`. There's no need to commit these changes. |
| 29 | +1. You can now scroll to the 🚀 PLAY section! |
| 30 | + |
| 31 | +#### 💻️ OR Run it locally |
| 32 | + |
| 33 | +Please note: You don't need this step if you are using Codespaces, skip to the next section! |
| 34 | + |
| 35 | +1. Install [Nodejs](https://nodejs.org/en/download). |
| 36 | +1. Install express, body-parser and express-rate-limit using npm by running the following command in your terminal: |
| 37 | + |
| 38 | +```bash |
| 39 | +npm install express body-parser express-rate-limit |
| 40 | +``` |
| 41 | + |
| 42 | +Once installation has completed, clone your repository to your local machine and install required dependencies. |
| 43 | + |
| 44 | +1. From your repository, click the **Code** drop down button in the upper-right of your repository navigation bar. |
| 45 | +1. Select the `Local` tab from the menu. |
| 46 | +1. Copy the repository's URL. |
| 47 | +1. In your terminal, change the working directory to the location where you want the cloned directory. |
| 48 | +1. Type `git clone` and paste the copied URL. |
| 49 | +1. Press **Enter** to create your local clone. |
| 50 | +1. Change the working directory to the cloned directory. |
| 51 | + |
| 52 | +#### 🚀 PLAY! |
| 53 | + |
| 54 | +1. Open a terminal and run: |
| 55 | +`node server.js` |
| 56 | +1. If you're inside a Codespace, you will notice a prompt appearing on the bottom right corner. Click **Open in browser**. If you're running the challenge locally, open a web browser and navigate to `http://localhost:3000/`. |
| 57 | +1. Spot the security issue by reviewing the code in `script.js`, `server.js`, `index.html` and `styles.css`. |
| 58 | +1. If you enjoy this challenge, we have 10 more challenges for you in the [Secure Code Game](https://gh.io/securecodegame)! |
0 commit comments