Skip to content

Commit 7af4b42

Browse files
Merge pull request #96 from ls1intum/fix/hidden-test-leakage
fix(security): suppress hidden test details from student-visible feedback
2 parents dd4854f + 4e09479 commit 7af4b42

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/java/de/tum/cit/ase/ares/api/internal/ReportingUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.slf4j.*;
1111

1212
import de.tum.cit.ase.ares.api.context.TestContext;
13+
import de.tum.cit.ase.ares.api.context.TestType;
1314
import de.tum.cit.ase.ares.api.internal.sanitization.*;
1415
//REMOVED: Import of ArtemisSecurityManager
1516

@@ -40,6 +41,9 @@ public static <T> T doProceedAndPostProcess(Invocation<T> invocation, TestContex
4041
}
4142

4243
public static Throwable processThrowable(Throwable t, TestContext context) {
44+
if (context.findTestType().orElse(null) == TestType.HIDDEN) {
45+
return new AssertionError(localized("test_guard.hidden_test_failed"));
46+
}
4347
Optional<String> nonprivilegedFailureMessage = ConfigurationUtils.getNonprivilegedFailureMessage(context);
4448
if (nonprivilegedFailureMessage.isPresent())
4549
return processThrowablePrivilegedOnly(t, nonprivilegedFailureMessage.get());

src/main/resources/de/tum/cit/ase/ares/api/localization/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ security.policy.within.path.invalid=The following path is invalid for withinPath
182182
# test guard and deadline handling
183183
test_guard.extended_deadline_zero_or_negative=deadline extension must not be ZERO or negative: %s
184184
test_guard.hidden_test_before_deadline_message=hidden tests will be executed after the deadline.
185+
test_guard.hidden_test_failed=Hidden test failed.
185186
test_guard.hidden_test_missing_deadline=cannot find a deadline for hidden test %s
186187
test_guard.invalid_deadline_format=invalid deadline string: %s
187188
test_guard.invalid_extended_deadline_format=invalid deadline extension format: %s

src/main/resources/de/tum/cit/ase/ares/api/localization/messages_de.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ security.policy.within.path.invalid=Der folgende Pfad ist f\u0308r withinPath un
175175
# test guard and deadline handling
176176
test_guard.extended_deadline_zero_or_negative=Deadline Verl\u00e4ngerung muss positiv sein: %s
177177
test_guard.hidden_test_before_deadline_message=Versteckte Tests werden nach der Deadline ausgef\u0308hrt.
178+
test_guard.hidden_test_failed=Versteckter Test fehlgeschlagen.
178179
test_guard.hidden_test_missing_deadline=F\u0308r den versteckten Test %s konnte keine Deadline gefunden werden
179180
test_guard.invalid_deadline_format=Ung\u0308ltiges ExtendedDeadline Format: %s
180181
test_guard.invalid_extended_deadline_format=Ung\u0308ltiges ExtendedDeadline Format: %s

0 commit comments

Comments
 (0)