Assignment 0 is a simple, ungraded (but required) task designed to help you get comfortable with essential tools like Docker, GitHub, and signing your GitHub commits. The goal is to ensure you're ready to tackle future assignments smoothly.
Grading: This assignment is ungraded and allows unlimited attempts. However, completing it with full marks is necessary to qualify for participation credit in the course. Deadline: All students must complete Assignment 0 before the due date set in gradescope Estimated Time: Most students can finish this assignment in under 10 minutes. If you need to set up a GitHub profile, setup secure access, and/or enable commit signing, it may take you a bit longer.
The purpose of this assignment is to ensure you have the foundational skills required for this course. These include basic familiarity with version control, programming, and containerization. Please make sure that you complete this assignment before the add/drop date or you might struggle to keep up with the class.
In this assignment, you will:
- Clone a repository to your local machine.
- Install and set up Docker (which is required for all subsequent assignments).
- Edit a simple C program.
- Use a Docker container to compile and run the C program.
- Push a signed commit with your updates to GitHub.
-
Clone the homework repository to your local machine:
git clone <repository-url> cd <repository-name>
-
Navigate to the
HW0directory:cd HW0
-
Install Docker by following the instructions for your operating system:
-
Verify the installation:
docker --version
You should see the Docker version printed to the terminal.
-
Open
homework0.cin your preferred text editor. -
Replace the placeholder email address in the program with your actual email:
const char EMAIL_ADDRESS[] = "your_email@nyu.edu";
-
Save your changes.
-
Build the Docker image:
docker build -t hw0_image .This will compile your program inside a Docker container.
If you get the following error "failed to read dockerfile": Make sure you are in your repository root directory, not '/HW0'!
-
Run the Docker container to execute your program:
docker run --rm hw0_image
You should see the output displaying your email address and a "flag" generated by hashing your email with a salt.
-
If you need to rebuild or destroy a Docker image (for example, after making significant code changes), use the following commands:
-
To remove the Docker image:
docker rmi hw0_image
-
To rebuild the image:
docker build -t hw0_image .
-
You should configure this within your Docker to avoid complications with your operating system. This sets you up to have a container that you know works for future assignments
-
Configure Git to sign commits if you haven’t already:
-
Generate a GPG key if you don’t have one, follow the guide:
gpg --full-generate-key
-
Add the key to your GitHub account by following the GitHub GPG guide.
-
Configure Git to use your key:
git config --global user.signingkey <your-gpg-key-id> git config --global commit.gpgsign true
-
-
Stage and commit your changes:
git add HW0/homework0.c git commit -S -m "Updated email address for Homework 0" -
Push your changes to GitHub:
git push origin main
- Salt File (
assignment_salt.txt):- For testing locally, a
assignment_salt.txtfile is provided with a dummy salt value. You do not need to modify or worry about this file. - During grading, a separate salt file will be used to ensure your program works correctly in a different environment.
- For testing locally, a
- Verify that your repository on GitHub reflects the updated
homework0.cfile. - Confirm that your commit is signed and verified on GitHub (look for the "Verified" badge next to your commit).
-
Docker Installation Issues: Refer to the official Docker documentation for troubleshooting installation problems.
-
GPG Signing Issues: Ensure your GPG key is correctly configured and added to GitHub.
-
Compilation Errors: Double-check your syntax in
homework0.c. Ensure you’ve replaced the placeholder email with your actual email address. -
Rebuilding Docker Images: If your code changes are not reflected, rebuild the Docker image using:
docker build -t hw0_image .
To submit your code, please only submit a file called git_link.txt that contains the name of your repository to Gradescope.
For example, if your repo is located at 'https://github.com/NYUAppSec__/assignment-1-module1-exampleaccount', you would submit a text file named git_link.txt with only one line that reads with only the following:
assignment-1-module1-exampleaccount
Remember that Gradescope is not instant. Especially if we have to look into past GitHub action runs. We have a timeout set for 10 minutes, almost all well running code will complete within 5 minutes. Wait for it to complete or timeout before trying to re-run.
Your repository should contain:
- The updated
homework0.cfile completed with your official NYU email address. - A signed commit pushed to GitHub.
Make sure everything is correct before the due date.
- To avoid having to type in your password all the time, you may also want to set up SSH key access to your GitHub account. This will help make your work on the graded assignments a bit easier!
- We want to heavily stress it is best to setup your GPG keys within Docker and keep that instance as a snapshot for upcoming assignments. Take some time to understand why this is recommended.