Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-72188

Add Javascript API in Safe Exam Browser (SEB) integration to query the keys (BEK/CK)

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MDL-72188-master_seb_js_integration-no-message
    • Hide

      Setup

      The following tests should be run on at least the Mac OS and the Windows platforms.

      Note acronym, SEB == Safe Exam Browser, going forward.

      Note, by default SEB requires the application to be run on a computer with a single built-in screen. This is configurable, but there is currently a bug in the Windows version that does not allow a computer with external screens only (i.e. a Tower), so it's recommended to test on a laptop without any other screens plugged in.

      Install SEB Mac

      If SEB Mac 3.1 is released, download this version from https://safeexambrowser.org/download_en.html

      Or, download the pre-release version from: https://github.com/SafeExamBrowser/seb-mac/releases/tag/3.2pre4

      Install SEB Windows

      Install SEB Windows

      If SEB Windows 3.3.2 is released, download this version from https://safeexambrowser.org/download_en.html

      Or, download the pre-release version from: https://sebdev-let.ethz.ch/api/buildjobs/t4047847xq50t0v5/artifacts/SEB_3.3.2.397_SetupBundle.exe

      Scenarios

      Test quiz access with 'Configure manually' SEB settings

      1. Log in as an admin.
      2. Create a test user.
      3. Create a test course.
      4. Enrol test user in test course in the 'student' role.
      5. In test course, create a quiz.
      6. Give the quiz a name (E.g. 'Test quiz').
      7. In quiz settings, go to Safe Exam Browser section.
      8. Set 'Require the use of Safe Exam Browser' to 'Configure manually'.
      9. Save the quiz settings.
      10. Add a question to the quiz.
      11. Log out.
      12. Open Moodle in a regular web browser (E.g. Firefox, Chrome)
      13. Log in as test user.
      14. Go to test course
      15. Go to test quiz
      16. You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      17. You should see button with label: "Launch Safe Exam Browser"
      18. Click on "Launch Safe Exam Browser"
      19. Select compatible Safe Exam Browser application
      20. Log in as test user.
      21. You should see the quiz landing page
      22. You should see an alert with message:
      23. After a short delay, the page should reload.
      24. You should no longer see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      25. You should see button with label: 'Start attempt'
      26. Click on 'Start attempt'
      27. You should see the first question of the quiz.

      Test quiz access with 'Use an existing template' SEB settings

      1. Log in as an admin.
      2. Navigate to Site administration -> Plugins -> Activity modules -> Safe Exam Browser templates
      3. Click 'Add new template'
      4. Set new template name to 'Test template'
      5. Upload an unencrypted seb config file. Either use the one attached to tracker or generate one using the Safe Exam Browser config tool.
      6. Set Enabled to 'Yes'.
      7. Click 'Save changes'.
      8. Create a test user.
      9. Create a test course.
      10. Enrol test user in test course in the 'student' role.
      11. In test course, create a quiz.
      12. Give the quiz a name (E.g. 'Test quiz').
      13. In quiz settings, go to Safe Exam Browser section.
      14. Set 'Require the use of Safe Exam Browser' to 'Yes - Use an existing template'.
      15. For setting 'Safe Exam Browser config template', select the template 'Test template'
      16. Save the quiz settings.
      17. Add a question to the quiz.
      18. Log out.

       

      1. Open Moodle in a regular web browser (E.g. Firefox, Chrome)
      2. Log in as test user.
      3. Go to test course
      4. Go to test quiz
      5. You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with
      6. correct configuration file."
      7. You should see button with label: "Launch Safe Exam Browser"
      8. Click on "Launch Safe Exam Browser"
      9. Select compatible Safe Exam Browser application
      10. Log in as test user.
      11. You should see the quiz landing page
      12. You should see an alert with message: "Checking access to Safe Exam Browser..."
      13. After a short delay, the page should reload.
      14. You should no longer see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam
      15. Browser with correct configuration file."
      16. You should see button with label: 'Start attempt'
      17. Click on 'Start attempt'
      18. You should see the first question of the quiz.

      Test quiz access with 'Upload my own config' SEB settings

      1. Log in as an admin.
      2. Create a test user.
      3. Create a test course.
      4. Enrol test user in test course in the 'student' role.
      5. In test course, create a quiz.
      6. Give the quiz a name (E.g. 'Test quiz').
      7. In quiz settings, go to Safe Exam Browser section.
      8. Set 'Require the use of Safe Exam Browser' to 'Yes - Upload my own config'.
      9. Upload an unencrypted seb config file. Either use the one attached to tracker or generate one using the Safe Exam Browser config tool.
      10. Save the quiz settings.
      11. Add a question to the quiz.
      12. Log out.

       

      1. Open Moodle in a regular web browser (E.g. Firefox, Chrome)
      2. Log in as test user.
      3. Go to test course
      4. Go to test quiz
      5. You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with
      6. correct configuration file."
      7. You should see button with label: "Launch Safe Exam Browser"
      8. Click on "Launch Safe Exam Browser"
      9. Select compatible Safe Exam Browser application
      10. Log in as test user.
      11. You should see the quiz landing page
      12. You should see an alert with message: "Checking access to Safe Exam Browser..."
      13. After a short delay, the page should reload.
      14. You should no longer see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam
      15. Browser with correct configuration file."
      16. You should see button with label: 'Start attempt'
      17. Click on 'Start attempt'
      18. You should see the first question of the quiz.

      Test quiz access with 'Use SEB client config' SEB settings

      1. Log in as an admin.
      2. Create a test user.
      3. Create a test course.
      4. Enrol test user in test course in the 'student' role.
      5. In test course, create a quiz.
      6. Give the quiz a name (E.g. 'Test quiz').
      7. In quiz settings, go to Safe Exam Browser section.
      8. Set 'Require the use of Safe Exam Browser' to 'Yes - Use client config'.
      9. Save the quiz settings.
      10. Add a question to the quiz.
      11. Log out.

       

      1. Open Moodle in a regular web browser (E.g. Firefox, Chrome)
      2. Log in as test user.
      3. Go to test course
      4. Go to test quiz
      5. You should see message: "This quiz has been configured to use the Safe Exam Browser with client configuration."
      6. You should see button with label: "Launch Safe Exam Browser"
      7. Click on "Launch Safe Exam Browser"
      8. Select compatible Safe Exam Browser application
      9. Log in as test user.
      10. You should see the quiz landing page
      11. You should see an alert with message: "Checking access to Safe Exam Browser..."
      12. After a short delay, the page should reload.
      13. You should no longer see message: "This quiz has been configured to use the Safe Exam Browser with client configuration."
      14. You should see button with label: 'Start attempt'
      15. Click on 'Start attempt'
      16. You should see the first question of the quiz.

      Test quiz access denied with 'Upload my own config'

      1. Log in as an admin.
      2. Create a test user.
      3. Create a test course.
      4. Enrol test user in test course in the 'student' role.
      5. In test course, create a quiz.
      6. Give the quiz a name (E.g. 'Test quiz').
      7. In quiz settings, go to Safe Exam Browser section.
      8. Set 'Require the use of Safe Exam Browser' to 'Yes - Upload my own config'.
      9. Upload an unencrypted seb config file. Either use the one attached to tracker or generate one using the Safe Exam Browser config tool.
      10. Save the quiz settings.
      11. Add a question to the quiz.
      12. Log out.

       

      1. Open Moodle in a regular web browser (E.g. Firefox, Chrome)
      2. Log in as test user.
      3. Go to test course
      4. Go to test quiz
      5. You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with
      6. correct configuration file."
      7. You should see button with label: "Launch Safe Exam Browser"
      8. Click on "Launch Safe Exam Browser"
      9. Select compatible Safe Exam Browser application
      10. Log in as test user.
      11. You should see the quiz landing page
      12. You should see an alert with message: "Checking access to Safe Exam Browser..."
      13. After a short delay, the page should reload.
      14. You should no longer see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam
      15. Browser with correct configuration file."
      16. You should see button with label: 'Start attempt'
      17. Click on 'Start attempt'
      18. You should see the first question of the quiz.

      Test with old version of SEB that doesn't support JS API

      1. Log in as an admin.
      2. Create a test user.
      3. Create a test course.
      4. Enrol test user in test course in the 'student' role.
      5. In test course, create a quiz.
      6. Give the quiz a name (E.g. 'Test quiz').
      7. In quiz settings, go to Safe Exam Browser section.
      8. Set 'Require the use of Safe Exam Browser' to 'Yes - Upload my own config'.
      9. Upload an unencrypted seb config file. Either use the one attached to tracker or generate one using the Safe Exam Browser config tool.
      10. Save the quiz settings.
      11. Add a question to the quiz.
      12. Log out.

       

      1. Open Moodle in a regular web browser (E.g. Firefox, Chrome)
      2. Log in as test user.
      3. Go to test course
      4. Go to test quiz
      5. You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with
      6. correct configuration file."
      7. You should see button with label: "Launch Safe Exam Browser"
      8. Click on "Launch Safe Exam Browser"
      9. Select a Safe Exam Browser application that supports config key but not the JS API. E.g. SEB mac 2.2.3 or SEB windows 3.3.1
      10. Log in as test user.
      11. You should see the quiz landing page
      12. You should not see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser
      13. with correct configuration file."
      14. You should see button with label: 'Start attempt'
      15. Click on 'Start attempt'
      16. You should see the first question of the quiz.
      Show
      Setup The following tests should be run on at least the Mac OS and the Windows platforms. Note acronym, SEB == Safe Exam Browser, going forward. Note, by default SEB requires the application to be run on a computer with a single built-in screen. This is configurable, but there is currently a bug in the Windows version that does not allow a computer with external screens only (i.e. a Tower), so it's recommended to test on a laptop without any other screens plugged in. Install SEB Mac If SEB Mac 3.1 is released, download this version from https://safeexambrowser.org/download_en.html Or, download the pre-release version from:  https://github.com/SafeExamBrowser/seb-mac/releases/tag/3.2pre4 Install SEB Windows Install SEB Windows If SEB Windows 3.3.2 is released, download this version from https://safeexambrowser.org/download_en.html Or, download the pre-release version from:  https://sebdev-let.ethz.ch/api/buildjobs/t4047847xq50t0v5/artifacts/SEB_3.3.2.397_SetupBundle.exe Scenarios Test quiz access with 'Configure manually' SEB settings Log in as an admin. Create a test user. Create a test course. Enrol test user in test course in the 'student' role. In test course, create a quiz. Give the quiz a name (E.g. 'Test quiz'). In quiz settings, go to Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Configure manually'. Save the quiz settings. Add a question to the quiz. Log out. Open Moodle in a regular web browser (E.g. Firefox, Chrome) Log in as test user. Go to test course Go to test quiz You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Select compatible Safe Exam Browser application Log in as test user. You should see the quiz landing page You should see an alert with message: After a short delay, the page should reload. You should no longer see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: 'Start attempt' Click on 'Start attempt' You should see the first question of the quiz. Test quiz access with 'Use an existing template' SEB settings Log in as an admin. Navigate to Site administration -> Plugins -> Activity modules -> Safe Exam Browser templates Click 'Add new template' Set new template name to 'Test template' Upload an unencrypted seb config file. Either use the one attached to tracker or generate one using the Safe Exam Browser config tool. Set Enabled to 'Yes'. Click 'Save changes'. Create a test user. Create a test course. Enrol test user in test course in the 'student' role. In test course, create a quiz. Give the quiz a name (E.g. 'Test quiz'). In quiz settings, go to Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Yes - Use an existing template'. For setting 'Safe Exam Browser config template', select the template 'Test template' Save the quiz settings. Add a question to the quiz. Log out.   Open Moodle in a regular web browser (E.g. Firefox, Chrome) Log in as test user. Go to test course Go to test quiz You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Select compatible Safe Exam Browser application Log in as test user. You should see the quiz landing page You should see an alert with message: "Checking access to Safe Exam Browser..." After a short delay, the page should reload. You should no longer see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: 'Start attempt' Click on 'Start attempt' You should see the first question of the quiz. Test quiz access with 'Upload my own config' SEB settings Log in as an admin. Create a test user. Create a test course. Enrol test user in test course in the 'student' role. In test course, create a quiz. Give the quiz a name (E.g. 'Test quiz'). In quiz settings, go to Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Yes - Upload my own config'. Upload an unencrypted seb config file. Either use the one attached to tracker or generate one using the Safe Exam Browser config tool. Save the quiz settings. Add a question to the quiz. Log out.   Open Moodle in a regular web browser (E.g. Firefox, Chrome) Log in as test user. Go to test course Go to test quiz You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Select compatible Safe Exam Browser application Log in as test user. You should see the quiz landing page You should see an alert with message: "Checking access to Safe Exam Browser..." After a short delay, the page should reload. You should no longer see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: 'Start attempt' Click on 'Start attempt' You should see the first question of the quiz. Test quiz access with 'Use SEB client config' SEB settings Log in as an admin. Create a test user. Create a test course. Enrol test user in test course in the 'student' role. In test course, create a quiz. Give the quiz a name (E.g. 'Test quiz'). In quiz settings, go to Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Yes - Use client config'. Save the quiz settings. Add a question to the quiz. Log out.   Open Moodle in a regular web browser (E.g. Firefox, Chrome) Log in as test user. Go to test course Go to test quiz You should see message: "This quiz has been configured to use the Safe Exam Browser with client configuration." You should see button with label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Select compatible Safe Exam Browser application Log in as test user. You should see the quiz landing page You should see an alert with message: "Checking access to Safe Exam Browser..." After a short delay, the page should reload. You should no longer see message: "This quiz has been configured to use the Safe Exam Browser with client configuration." You should see button with label: 'Start attempt' Click on 'Start attempt' You should see the first question of the quiz. Test quiz access denied with 'Upload my own config' Log in as an admin. Create a test user. Create a test course. Enrol test user in test course in the 'student' role. In test course, create a quiz. Give the quiz a name (E.g. 'Test quiz'). In quiz settings, go to Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Yes - Upload my own config'. Upload an unencrypted seb config file. Either use the one attached to tracker or generate one using the Safe Exam Browser config tool. Save the quiz settings. Add a question to the quiz. Log out.   Open Moodle in a regular web browser (E.g. Firefox, Chrome) Log in as test user. Go to test course Go to test quiz You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Select compatible Safe Exam Browser application Log in as test user. You should see the quiz landing page You should see an alert with message: "Checking access to Safe Exam Browser..." After a short delay, the page should reload. You should no longer see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: 'Start attempt' Click on 'Start attempt' You should see the first question of the quiz. Test with old version of SEB that doesn't support JS API Log in as an admin. Create a test user. Create a test course. Enrol test user in test course in the 'student' role. In test course, create a quiz. Give the quiz a name (E.g. 'Test quiz'). In quiz settings, go to Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Yes - Upload my own config'. Upload an unencrypted seb config file. Either use the one attached to tracker or generate one using the Safe Exam Browser config tool. Save the quiz settings. Add a question to the quiz. Log out.   Open Moodle in a regular web browser (E.g. Firefox, Chrome) Log in as test user. Go to test course Go to test quiz You should see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Select a Safe Exam Browser application that supports config key but not the JS API. E.g. SEB mac 2.2.3 or SEB windows 3.3.1 Log in as test user. You should see the quiz landing page You should not see message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see button with label: 'Start attempt' Click on 'Start attempt' You should see the first question of the quiz.

    Description

      This tracker created based on danschlet message in in a Telegram channel.

      In new macOS and iOS versions of SEB. There are/will support the modern WebKit browser engine (the WKWebView API), which has many advantages. It increases performance, stability and compatibility with web applications. Very important: Is supports access to camera/microphone via WebRTC (getUserMedia etc.). Unfortunately Apple decided to not allow to add custom headers to HTTP request. Therefore we need another way how to transmit the ConfigKey and BrowserExamKey hashes to the assessment web application.

      From version 3.0 for IOS SEB supports JavaScript API which allows to query app version details, and the ConfigKey and BrowserExamKey security elements. It is inspired by the Smarter Balanced Assessment Consortium Secure Browser API Specification (https://github.com/SmarterApp/SB_BIRT/blob/master/irp/doc/req/SecureBrowserAPIspecification.md )

      Currently the current request header transmission of the CK/BEK is still supported, if sending the CK/BEK is enabled, then the classic WebView is used. But to profit from the benefits of the modern WKWebView in the main browser tab where Moodle is displayed, it would be necessary to support the new SEB JS API for querying the CK/BEK as well.

      There are some discussions

       

      Thoughts about the steps to support the SEB JS API in Moodle (on an abstract level):

      1. Support both the HTTP header check and the JavaScript API for the ConfigKey (and if required for the BrowserExamKey BEK). As mentioned, the keys will be same for the same web page (URL). So the web application can check for the availability of the SafeExamBrowser.security.updateKeys() function (or the SafeExamBrowser.version variable). If it‘s available, then the JavaScript API is supported and you can get the ConfigKey/BEK from it. Otherwise get the ConfigKey/BEK from the HTTP headers.
      2. In the SEB configuration generated by Moodle, set the SEB settings key browserWindowWebView to the policy "Prefer Modern" (integer value 3), which will force the use of the modern WebView and the Javascript API in SEB versions where it is available. 

      Attachments

        Issue Links

          Activity

            People

              andrewmadden Andrew Madden
              dmitriim Dmitrii Metelkin
              Dmitrii Metelkin Dmitrii Metelkin
              Jun Pataleta Jun Pataleta
              Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              3 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated: