Skip to content

Fix forbidden file detection to check all commits#34

Open
markpolyak wants to merge 3 commits intomainfrom
claude/fix-file-detection-01T8tfQPGPrUE6jz59yneG4V
Open

Fix forbidden file detection to check all commits#34
markpolyak wants to merge 3 commits intomainfrom
claude/fix-file-detection-01T8tfQPGPrUE6jz59yneG4V

Conversation

@markpolyak
Copy link
Owner

Previously, only the latest commit was checked for forbidden file modifications, allowing students to bypass detection by making changes in earlier commits.

Changes:

  • Add get_all_modified_files() to check all commits in repo
  • Change forbidden-modifications to forbidden-files config key
  • Make forbidden file check a warning instead of blocking error
  • Add yellow cell highlighting and note for violations
  • Show warning on frontend with list of violated files
  • Update tests and documentation

This allows teachers to see suspicious activity while still grading.

Previously, only the latest commit was checked for forbidden file
modifications, allowing students to bypass detection by making changes
in earlier commits.

Changes:
- Add get_all_modified_files() to check all commits in repo
- Change forbidden-modifications to forbidden-files config key
- Make forbidden file check a warning instead of blocking error
- Add yellow cell highlighting and note for violations
- Show warning on frontend with list of violated files
- Update tests and documentation

This allows teachers to see suspicious activity while still grading.
This implementation distinguishes between instructor and student commits
using GitHub Organization Membership API to prevent false positives when
checking forbidden file modifications.

Key changes:
- Added `is_org_admin()` to check if commit author is org admin
- Added `get_commits_with_authors()` to fetch commits with author info
- Updated `check_forbidden_files()` to filter by commit author
- Instructor commits are excluded from forbidden file checks
- Students cannot forge this check (GitHub API protected)

This solves the issue where:
- Initial template commits would trigger false positives
- Instructor bug fixes would trigger false positives
- Different fork points for different students
- Students could bypass detection by modifying files in early commits

Tests:
- All 98 unit tests passing
- Added tests for instructor commit filtering
- Fixed conftest.py to avoid unnecessary main.py imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants