Certain functions in the LevelOne contract, such as giveReview(), are callable at any time—even outside active teaching sessions. This omission of the onlyInSession modifier (or an equivalent check) permits misuse or logically inconsistent actions that should only occur during a valid teaching session.
The giveReview() function is defined as:
This function can be called at any time, regardless of whether the session has started or ended. Since reviews logically belong to an active course phase:
Teachers might add reviews after the course ends or before it starts.
Reviews could be given to students who are technically not in a valid session anymore (e.g., right after being expelled or after session ends).
Similar logic flaws may affect other session-bound operations like:
graduateAndUpgrade()
expel()
withdrawTeacherWages() (if allowed after session ends)
Logical Inconsistency: Reviews can be added outside the teaching timeline, misrepresenting student progress.
Unintended Access: Functions dependent on session state can be misused or triggered when not appropriate.
Security Risk: Allows interactions that were likely assumed to be time-bound, opening up possibilities for unexpected behavior or state manipulation.
Manual source code review
Contextual reasoning based on intended lifecycle of a teaching session
Introduce onlyInSession Modifier:
Define a modifier like:
Apply to Time-Bound Functions:
Apply onlyInSession to any function that should only execute while the session is ongoing. This includes:
giveReview()
expel()
Any grading or interaction with students
Add Tests:
Add test cases to ensure these functions revert when called before startSession() or after the session has ended.
Audit All Entry Points:
Review all public/external functions to ensure correct access control and session validation is applied as needed.
`inSession` not updated after during upgrade
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.