> For the complete documentation index, see [llms.txt](https://help.codegrade.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.codegrade.com/setup-assignment/other-features/running-secure-exams.md).

# Running Secure Exams

Ensuring a secure and fair exam environment is essential. CodeGrade allows you to conduct exams with confidence by offering robust access controls. By setting up a dedicated exam course, you can manage all restrictions at the course level, ensuring every exam runs smoothly and securely.

<figure><img src="/files/GFkECFyvin1k4TdDPQbT" alt=""><figcaption><p><em>Student view of an active exam session with Session Lockdown enabled</em></p></figcaption></figure>

## Step 1: Set Up an Exam Course

Create a dedicated course specifically for exams. This provides a centralized place for all exam access controls.

## Step 2: Manage Course‑Level Access Restrictions

Navigate to ***Course Settings → Access***

{% hint style="warning" %}
**Missing the Access tab?**

* **Course Settings → Access** requires the **Edit access restrictions** permission.
* **Assignment Settings → Access** requires the **Edit assignment access restrictions** permission.

Permissions can be managed in **Course Settings → Permissions**.
{% endhint %}

Here, you can configure:

* **Password Protection**: A course-level password that students must enter to access the course.
* **IP Restriction**: Limit access to certain IPv4 addresses or ranges.
* **Session Lockdown**: When enabled, students are restricted to this course and cannot access other courses or platform features such as search or snippets. Any attempt to do so will result in token or access-related errors.
* **Idle Session Detection:** *(Enabled by default when Session Lockdown is turned on.)* Ends the exam session after 5 minutes of inactivity, even if the student's laptop stays unlocked. Each interaction extends the session by another 5 minutes, up to the cap set at entry. The setting is remembered if you toggle Session Lockdown off and on. Changing this setting mid-exam will not affect students who have already entered the exam.
* **Entry Limits**: Set how many times a student can enter the course (e.g., one entry). You can adjust per-student overrides in the entry log.
* **Entry Window**: Set the start and end date and time between which students are allowed to enter the exam. Entry attempts before the start time or after the end time are rejected. Changing the start time mid-exam will not affect students who have already entered. Changing the end time mid-exam will only affect students who have already entered if Idle Session Detection is also enabled for the exam.

Save your changes to apply them to the entire course.

<figure><img src="/files/kvTVvMfEIGHxu4TAAFfx" alt=""><figcaption><p>Course Settings → Access, showing Session Lockdown enabled and Idle Session Detection turned on for an exam course.</p></figcaption></figure>

**How the idle session detection works**\
\
Exam sessions stay alive automatically while students are active on the exam tab, and send an immediate heartbeat when a student returns from a locked laptop or a backgrounded tab. If the heartbeat fails, the student sees a clear session interrupted message and is asked to log back in. With Idle Session Detection enabled, 5 minutes of inactivity ends the session even if the device is still unlocked.

## Step 3: Monitor and Adjust Entries

In the same ***Access*** section, you’ll find the entry log. It shows:

* Each student’s name and username
* The number of successful entries
* The limit set for them

You can override or reset limits if needed.

## Step 4: Assignment-Level Access (Optional)

If necessary, you can also set access restrictions for individual assignments. Navigate to ***Assignment Settings → Access***

Here, you can add assignment-specific password or IP restrictions if required.

## Best Practices

* Use IP restrictions for on-site exams (e.g., campus networks).
* Share passwords securely, just before the exam.
* Use "Student View" to test the entire setup, including Session Lockdown, restrictions, and Heartbeat Enforcement if enabled.
* If Session Detection is turned on, let students know that stepping away from the exam for more than 5 minutes will end their session and require them to log back in.
* If both course-level and assignment-level restrictions are applied, course-level rules will apply broadly while assignment rules add further control.
* If a change to the entry window end time doesn't seem to affect students already taking the exam, check that Idle Session Detection is enabled — end time changes only apply to active sessions when it is on.

For students, once they start the exam course, their session is locked. Any attempt to switch courses or reuse a session will lead to access errors, ensuring a secure, focused exam environment.
