Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

`LevelOne::giveReview()` allows reviews after the school session `sessionEnd`

Description:

The giveReview() function does not validate whether the school period has ended. This allows teachers to continue giving reviews even after the 4-week period.

According to the system's documentation, "A school period lasts 4 weeks," and students must receive their evaluations within this timeframe. This behavior is a functional invariant: all reviews must occur during the active school period.

Impact:

  • Reviews are conducted outside the school period.

  • Inconsistency with the system's official rules.

  • Students may be promoted with reviews conducted after the session ends.

Proof of Concept:

function test_CanReviewAfterSessionEnd() public {
// The principal starts the school period with a cutOffScore of 60
vm.prank(principal);
LevelOne(proxy).startSession(60);
// Advance time by 5 weeks (1 week after the session ends)
vm.warp(block.timestamp + 5 weeks);
// The teacher attempts to give a review after the session has ended
// This should revert if proper time control is applied (block.timestamp <= sessionEnd)
vm.prank(alice);
LevelOne(proxy).giveReview(dan, true);
}

Result:

Ran 1 test for test/GraduateTest.t.sol:GraduateTest
[PASS] test_reviewCount() (gas: 3850267)

Recommende Mitigation:

function giveReview(address _student, bool review) public onlyTeacher {
if (!isStudent[_student]) {
revert HH__StudentDoesNotExist();
}
require(reviewCount[_student] < 5, "Student review count exceeded!!!");
require(block.timestamp >= lastReviewTime[_student] + reviewTime, "Reviews can only be given once per week");
+ require(block.timestamp < sessionEnd, "Session has ended");
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

session state not updated

`inSession` not updated after during upgrade

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.