feat(assessment): keep real attempts in fullscreen and protect the task text
This commit is contained in:
1 parent
56dcf32f8c
commit
efa41d5967
46 files changed
+1940
-72
No files matched your search
@@ -4495,13 +4495,20 @@ func (s *Server) handleGetMyAssessmentResultRequest(args [1]string, argsEscaped
|
||||
// address during the attempt, parallel sessions, and the comparison of answers to variants of the same
|
||||
// task by candidates. The server stores for these only one-way keyed digests: it stores no network
|
||||
// address, no session token, and no answer text. Client signals are stored only while the C3 consent
|
||||
// is current. The client shows it before a real attempt starts and does not start the attempt until
|
||||
// the notice is acknowledged.
|
||||
// is current. The notice also lists the measures that the page applies during a real attempt:
|
||||
// fullscreen mode, hiding the task when the candidate leaves fullscreen, the tab, or the window,
|
||||
// blocking copy, selection, the context menu, drag, and printing of the task text, and blocking paste
|
||||
// into answer fields (paste into the practice code editor is allowed and recorded as a signal with a
|
||||
// size only). A watermark on the task page is announced as planned. These measures are applied by the
|
||||
// client and never change a score, a category, or a quota. The client shows the notice before a real
|
||||
// attempt starts and does not start the attempt until the notice is acknowledged.
|
||||
//
|
||||
// The acknowledgement is stored on the server per account and notice version, so it survives a reload
|
||||
// and a new browser. It is not a consent and never changes C3: the signal operation still requires a
|
||||
// current C3 consent, and an unacknowledged notice does not make that operation fail. The demo_express
|
||||
// training mode collects no signals and needs no acknowledgement.
|
||||
// and a new browser. An acknowledgement of an earlier version never counts for the current one: when
|
||||
// the text gains a version, every candidate acknowledges it again. It is not a consent and never
|
||||
// changes C3: the signal operation still requires a current C3 consent, and an unacknowledged notice
|
||||
// does not make that operation fail. The demo_express training mode collects no signals and needs no
|
||||
// acknowledgement.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account or
|
||||
// an unconfirmed email answers 403 forbidden.
|
||||
|
||||
@@ -663,13 +663,20 @@ type Handler interface {
|
||||
// address during the attempt, parallel sessions, and the comparison of answers to variants of the same
|
||||
// task by candidates. The server stores for these only one-way keyed digests: it stores no network
|
||||
// address, no session token, and no answer text. Client signals are stored only while the C3 consent
|
||||
// is current. The client shows it before a real attempt starts and does not start the attempt until
|
||||
// the notice is acknowledged.
|
||||
// is current. The notice also lists the measures that the page applies during a real attempt:
|
||||
// fullscreen mode, hiding the task when the candidate leaves fullscreen, the tab, or the window,
|
||||
// blocking copy, selection, the context menu, drag, and printing of the task text, and blocking paste
|
||||
// into answer fields (paste into the practice code editor is allowed and recorded as a signal with a
|
||||
// size only). A watermark on the task page is announced as planned. These measures are applied by the
|
||||
// client and never change a score, a category, or a quota. The client shows the notice before a real
|
||||
// attempt starts and does not start the attempt until the notice is acknowledged.
|
||||
//
|
||||
// The acknowledgement is stored on the server per account and notice version, so it survives a reload
|
||||
// and a new browser. It is not a consent and never changes C3: the signal operation still requires a
|
||||
// current C3 consent, and an unacknowledged notice does not make that operation fail. The demo_express
|
||||
// training mode collects no signals and needs no acknowledgement.
|
||||
// and a new browser. An acknowledgement of an earlier version never counts for the current one: when
|
||||
// the text gains a version, every candidate acknowledges it again. It is not a consent and never
|
||||
// changes C3: the signal operation still requires a current C3 consent, and an unacknowledged notice
|
||||
// does not make that operation fail. The demo_express training mode collects no signals and needs no
|
||||
// acknowledgement.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account or
|
||||
// an unconfirmed email answers 403 forbidden.
|
||||
|
||||
@@ -725,13 +725,20 @@ func (UnimplementedHandler) GetMyAssessmentResult(ctx context.Context, params Ge
|
||||
// address during the attempt, parallel sessions, and the comparison of answers to variants of the same
|
||||
// task by candidates. The server stores for these only one-way keyed digests: it stores no network
|
||||
// address, no session token, and no answer text. Client signals are stored only while the C3 consent
|
||||
// is current. The client shows it before a real attempt starts and does not start the attempt until
|
||||
// the notice is acknowledged.
|
||||
// is current. The notice also lists the measures that the page applies during a real attempt:
|
||||
// fullscreen mode, hiding the task when the candidate leaves fullscreen, the tab, or the window,
|
||||
// blocking copy, selection, the context menu, drag, and printing of the task text, and blocking paste
|
||||
// into answer fields (paste into the practice code editor is allowed and recorded as a signal with a
|
||||
// size only). A watermark on the task page is announced as planned. These measures are applied by the
|
||||
// client and never change a score, a category, or a quota. The client shows the notice before a real
|
||||
// attempt starts and does not start the attempt until the notice is acknowledged.
|
||||
//
|
||||
// The acknowledgement is stored on the server per account and notice version, so it survives a reload
|
||||
// and a new browser. It is not a consent and never changes C3: the signal operation still requires a
|
||||
// current C3 consent, and an unacknowledged notice does not make that operation fail. The demo_express
|
||||
// training mode collects no signals and needs no acknowledgement.
|
||||
// and a new browser. An acknowledgement of an earlier version never counts for the current one: when
|
||||
// the text gains a version, every candidate acknowledges it again. It is not a consent and never
|
||||
// changes C3: the signal operation still requires a current C3 consent, and an unacknowledged notice
|
||||
// does not make that operation fail. The demo_express training mode collects no signals and needs no
|
||||
// acknowledgement.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account or
|
||||
// an unconfirmed email answers 403 forbidden.
|
||||
|
||||
@@ -12,9 +12,14 @@ import (
|
||||
)
|
||||
|
||||
// CurrentSignalNoticeVersion is the version of the notice text that lists the
|
||||
// collected assessment signals. Change it together with the client text so that
|
||||
// every candidate acknowledges the new wording.
|
||||
const CurrentSignalNoticeVersion int32 = 1
|
||||
// collected assessment signals and the measures the page applies during an
|
||||
// attempt (fullscreen, hiding the task when the candidate leaves, copy, print,
|
||||
// and paste restrictions). Change it together with the client text so that
|
||||
// every candidate acknowledges the new wording. Acknowledgements are stored per
|
||||
// version, so one given for an earlier version never counts for this one.
|
||||
//
|
||||
// Version 2 added the attempt measures to the text; version 1 listed signals only.
|
||||
const CurrentSignalNoticeVersion int32 = 2
|
||||
|
||||
// ErrSignalNoticeVersionMismatch reports an acknowledgement for a notice
|
||||
// version other than the one the server requires.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package assessment
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func TestAcknowledgeSignalNoticeRefusesEveryVersionButTheCurrentOne(t *testing.T) {
|
||||
// A refused version returns before the service touches storage, so an
|
||||
// acknowledgement of an earlier notice text can never count for this one.
|
||||
service := &SignalService{}
|
||||
for _, version := range []int32{CurrentSignalNoticeVersion - 1, CurrentSignalNoticeVersion + 1} {
|
||||
_, err := service.AcknowledgeSignalNotice(context.Background(), uuid.New(), version)
|
||||
if !errors.Is(err, ErrSignalNoticeVersionMismatch) {
|
||||
t.Fatalf("AcknowledgeSignalNotice(version %d) error = %v, want %v", version, err, ErrSignalNoticeVersionMismatch)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user