Skip to content

Programming exercises: Send email notification if https authentication option is used - #13555

Open
Lyynnnx wants to merge 36 commits into
developfrom
chore/send-email-message-if-https-used
Open

Programming exercises: Send email notification if https authentication option is used#13555
Lyynnnx wants to merge 36 commits into
developfrom
chore/send-email-message-if-https-used

Conversation

@Lyynnnx

@Lyynnnx Lyynnnx commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a feature where user gets a notification with Artemis tip once in 24 hours if they use https authentication option by CLONE operation working with Git repositories

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines and the REST API guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I documented the Java code using JavaDoc style.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server configured with LocalVC and Jenkins.

Motivation and Context

As mentioned in Context section of another nudging PR, the HTTPS option has security risks and provides negative UX. However, it's still used by many users. Therefore, the nudging techniques are needed that will motivate users to use more secure and user-friendly authentication options (e.g., Token or SSH).
Such techniques would increase the UX and secure more users.

Description

This PR adds a change in LocalVCServletService where if Clone operation is used with Password authentication option (i.e., HTTPS) then user gets an email notification suggesting to user Token or SSH authentication option instead.
To avoid spamming, such notification are sent with at least 24 hour interval. For this, a DistributedDataProvider (i.e., cache) is used where for every user a flag is added for 24 hours if the Clone with Password are used.

Steps for Testing

Prerequisites:

  • 1 Student
  • 1 Programming Exercise

For this exercise an email service is needed. If you do not have one, just use the testing servers.
In case you are using the test servers: since the LDAP is disabled on test servers, there is no password for you TUM account in Artemis, so HTTPS clone method won't work for your account. For this, just use any test user account from here.
Be careful: in this PR you should test the fact that you receive notifications to your mail and by default test account have an arbitrary email, so in order to receive a notification to your mail address, please, change the email address of test account to yours in settings, while you are doing the testing steps.
Please, change the email back to default after you finish the testing steps. Thank you!

  1. Log in to Artemis
  2. Open the programming exercise
  3. Copy the Clone url using the Token
  4. Clone the project using the Token authentication method
  5. Verify that no notification was sent
  6. Copy the Clone url using the HTTPS
  7. Clone the project using the HTTPS authentication method
  8. Verify that you receive an email notification with a tip
  9. Clone any programming exercise using HTTPS method again.
  10. Verify that this time you do not receive any notification

Exam Mode Testing

Prerequisites:

  • 1 Student
  • 1 Exam with a Programming Exercise
  1. Log in to Artemis
  2. Participate in the exam as a student
  3. Open the programming exercise
  4. Copy the Clone url using the Token
  5. Clone the project using the Token authentication method
  6. Verify that no notification was sent
  7. Copy the Clone url using the HTTPS
  8. Clone the project using the HTTPS authentication method
  9. Verify that you receive an email notification with a tip
  10. Clone any programming exercise using HTTPS method again.
  11. Verify that this time you do not receive any notification

Thank you for testing!

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Performance Tests

  • Test 1
  • Test 2

Test Coverage

Server

Class/File Line Coverage Lines
LocalVCServletService.java 89.82% 821

Last updated: 2026-08-23 23:27:19 UTC

Screenshots

Summary by CodeRabbit

  • New Features

    • Added localized email tips after password-based HTTPS Git clones.
    • Emails recommend SSH keys or access tokens and link directly to SSH settings.
    • Notifications are limited to once every 24 hours.
  • Bug Fixes

    • Prevented notifications for token-authenticated clones, pull operations, users without email addresses, and recently notified users.
    • Added German and English translations with updated messaging.

Lyynnnx added 30 commits May 27, 2026 16:20
@github-actions github-actions Bot added server Pull requests that update Java code. (Added Automatically!) template programming Pull requests that affect the corresponding module labels Aug 23, 2026
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d77ca427-ccbd-45df-aace-aadc8e6362a4

📥 Commits

Reviewing files that changed from the base of the PR and between 4986086 and 98d57b5.

📒 Files selected for processing (3)
  • src/main/resources/i18n/messages_de.properties
  • src/main/resources/i18n/messages_en.properties
  • src/main/resources/templates/mail/httpsCloneTipEmail.html
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/resources/i18n/messages_en.properties
  • src/main/resources/i18n/messages_de.properties
  • src/main/resources/templates/mail/httpsCloneTipEmail.html

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


Walkthrough

LocalVCServletService sends a localized email after a password-authenticated HTTPS clone. A distributed expiring map limits notifications to once per user every 24 hours. Tests cover password, cached, token, and pull scenarios.

Changes

HTTPS clone guidance

Layer / File(s) Summary
Service dependencies and cache contract
src/main/java/de/tum/cit/aet/artemis/localvc/service/LocalVCServletService.java
The service receives mail and distributed-cache dependencies. It defines and initializes the HTTPS clone email cache key.
Clone notification flow
src/main/java/de/tum/cit/aet/artemis/localvc/service/LocalVCServletService.java, src/main/resources/i18n/messages_de.properties, src/main/resources/i18n/messages_en.properties, src/main/resources/templates/mail/httpsCloneTipEmail.html
HTTPS clone logging resolves the user and authentication mechanism. Password-authenticated clones trigger a localized email when the user has an email address and no active cache entry.
Notification behavior tests
src/test/java/de/tum/cit/aet/artemis/localvc/service/LocalVCServletServiceTest.java
Tests verify email delivery for the first password clone and no delivery for cached users, token-authenticated clones, or pulls.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 98d57

The PR adds a once-per-24-hour email tip for users cloning repositories over HTTPS and updates the related translations and template. No actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant LocalVCServletService
  participant DistributedDataProvider
  participant DistributedMap
  participant MailSendingService
  LocalVCServletService->>DistributedDataProvider: Get HTTPS_CLONE_EMAIL_CACHE
  DistributedDataProvider-->>LocalVCServletService: Return expiring map
  LocalVCServletService->>DistributedMap: Check user entry
  LocalVCServletService->>MailSendingService: Send localized clone tip email
  LocalVCServletService->>DistributedMap: Store user entry for 24 hours
Loading

Suggested reviewers: krusche

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (3 skipped: 3 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: sending an email after HTTPS authentication is used for programming exercises.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/send-email-message-if-https-used

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 23, 2026
@Lyynnnx
Lyynnnx temporarily deployed to playwright-e2e-tests August 23, 2026 12:40 — with GitHub Actions Inactive
@helios-aet
helios-aet Bot temporarily deployed to artemis-test5.artemis.cit.tum.de August 23, 2026 12:41 Inactive
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

End-to-End Test Results

Phase Status Details
Phase 1 (Relevant) ✅ Passed
TestsPassed ✅Skipped ⚠️FailedTime ⏱
Phase 1: E2E Test Report60 ran59 passed1 skipped0 failed15m 51s
Phase 2 (Remaining) ✅ Passed
TestsPassed ✅Skipped ⚠️FailedTime ⏱
Phase 2: E2E Test Report301 ran295 passed6 skipped0 failed23m 11s

Test Strategy: Two-phase execution

  • Phase 1: e2e/Login.spec.ts e2e/Logout.spec.ts e2e/SystemHealth.spec.ts e2e/exam/ExamParticipation.spec.ts e2e/exercise/programming/
  • Phase 2: e2e/Passkey.spec.ts e2e/PasskeyReminderPersistence.spec.ts e2e/admin/ e2e/atlas/ e2e/course/ e2e/exam/ExamAssessment.spec.ts e2e/exam/ExamChecklists.spec.ts e2e/exam/ExamCreationDeletion.spec.ts e2e/exam/ExamDateVerification.spec.ts e2e/exam/ExamManagement.spec.ts e2e/exam/ExamResults.spec.ts e2e/exam/ExamTestRun.spec.ts e2e/exam/test-exam/ e2e/exercise/ExerciseImport.spec.ts e2e/exercise/file-upload/ e2e/exercise/modeling/ e2e/exercise/quiz-exercise/ e2e/exercise/text/ e2e/iris/ e2e/lecture/ e2e/shared/

Overall: ✅ E2E tests passed

🔗 Workflow Run · 📊 Test Report Phase 1 · 📊 Test Report Phase 2

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 23, 2026
@helios-aet
helios-aet Bot temporarily deployed to artemis-test6.artemis.cit.tum.de August 23, 2026 13:20 Inactive
@Lyynnnx
Lyynnnx had a problem deploying to playwright-e2e-tests August 23, 2026 13:20 — with GitHub Actions Error
@helios-aet
helios-aet Bot temporarily deployed to artemis-test5.artemis.cit.tum.de August 23, 2026 13:22 Inactive
@Lyynnnx
Lyynnnx temporarily deployed to playwright-e2e-tests August 23, 2026 13:44 — with GitHub Actions Inactive
@helios-aet
helios-aet Bot temporarily deployed to artemis-test4.artemis.cit.tum.de August 23, 2026 15:34 Inactive
@helios-aet
helios-aet Bot temporarily deployed to artemis-test5.artemis.cit.tum.de August 23, 2026 15:40 Inactive
@Lyynnnx
Lyynnnx temporarily deployed to playwright-e2e-tests August 23, 2026 22:58 — with GitHub Actions Inactive
@Lyynnnx
Lyynnnx temporarily deployed to playwright-e2e-tests August 23, 2026 23:15 — with GitHub Actions Inactive
@helios-aet
helios-aet Bot temporarily deployed to artemis-test3.artemis.cit.tum.de August 24, 2026 13:47 Inactive
@helios-aet
helios-aet Bot temporarily deployed to artemis-test4.artemis.cit.tum.de August 24, 2026 14:58 Inactive
@helios-aet
helios-aet Bot temporarily deployed to artemis-test3.artemis.cit.tum.de August 24, 2026 15:19 Inactive
@Arnav92

Arnav92 commented Aug 24, 2026

Copy link
Copy Markdown

Tested on TS4 (artemis-test4) as a student (artemis_test_user_1), following the Steps for Testing:

  1. Cloned the TsPR exercise repo using the Token URL -> no email notification received, as expected.
  2. Temporarily changed the test account's email to a real inbox I control, then cloned via HTTPS with the account password -> received the "Artemis Tip: Use Token or SSH authentication for Git" email a few seconds later.
  3. Cloned via HTTPS again immediately after -> no second email, confirming the 24h throttle works.

One snag worth flagging for anyone else testing this: on Windows, Git Credential Manager silently reuses a cached token for subsequent HTTPS clones to the same host, which will not trigger the notification (since the server sees token auth, not password auth) even though the URL scheme is "https". Had to clone with the password embedded directly in the URL (bypassing GCM) to get a genuine password-authenticated clone. Not a bug in this PR, but easy to get a false negative if you don't notice it.

Reverted the test account's email back to default afterward. Didn't need instructor/admin for this -- the prerequisites (1 student, 1 programming exercise) were enough.

@Arnav92 Arnav92 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually tested the HTTPS-clone email notification flow end to end on TS4 as a student -- see my comment above for the full walkthrough. All three steps behaved as described: no email on Token clone, one email on the first genuine password/HTTPS clone, no duplicate on the immediate follow-up clone. Approving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

programming Pull requests that affect the corresponding module server Pull requests that update Java code. (Added Automatically!) template tests

Projects

Status: Work In Progress

Development

Successfully merging this pull request may close these issues.

2 participants