Skip to content

NYUAppSec/assignment-0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Assignment 0

Introduction

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.

Purpose

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.

Overview

In this assignment, you will:

  1. Clone a repository to your local machine.
  2. Install and set up Docker (which is required for all subsequent assignments).
  3. Edit a simple C program.
  4. Use a Docker container to compile and run the C program.
  5. Push a signed commit with your updates to GitHub.

Instructions

Step 1: Clone the Repository

  1. Clone the homework repository to your local machine:

    git clone <repository-url>
    cd <repository-name>
  2. Navigate to the HW0 directory:

    cd HW0

Step 2: Install Docker

  1. Install Docker by following the instructions for your operating system:

  2. Verify the installation:

    docker --version

    You should see the Docker version printed to the terminal.

Step 3: Edit the C Program

  1. Open homework0.c in your preferred text editor.

  2. Replace the placeholder email address in the program with your actual email:

    const char EMAIL_ADDRESS[] = "your_email@nyu.edu";
  3. Save your changes.


Step 4: Run the Program in Docker

  1. 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'!

  2. 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.

  3. 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 .

Step 5: Push a Signed Commit to GitHub

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

  1. 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
  2. Stage and commit your changes:

    git add HW0/homework0.c
    git commit -S -m "Updated email address for Homework 0"
  3. Push your changes to GitHub:

    git push origin main

Salt File and Grading

  • Salt File (assignment_salt.txt):
    • For testing locally, a assignment_salt.txt file 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.

Validation

  1. Verify that your repository on GitHub reflects the updated homework0.c file.
  2. Confirm that your commit is signed and verified on GitHub (look for the "Verified" badge next to your commit).

Troubleshooting

  • 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 .

What to Submit

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:

  1. The updated homework0.c file completed with your official NYU email address.
  2. A signed commit pushed to GitHub.

Make sure everything is correct before the due date.

Tips

  1. 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!
  2. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •