Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more issues with show me another. #2405

Merged

Conversation

drgrice1
Copy link
Sponsor Member

There is a security vulnerability that allows a student to bypass the limit on the number of times that show me another can be used ($pg{options}{showMeAnotherMaxReps}) or to open a show me another problem before the required number of attempts at the original problem have been made. The ShowMeAnother package adds a hidden showMeAnotherCheckAnswers field, and if this parameter is set it is assumed that the user is allowed to use ShowMeAnother. That can easily be hacked. To do so construct the url https?://server.edu/webwork2/course_id/set_id/problem_id/show_me_another?showMeAnotherCheckAnswers=1&checkAnswers=1&problemSeed=6543 where problem_id is a valid problem number for the set set_id. Change the seed at will, and you will get a new version of the problem. If that happens to generate the same problem as the seed for the assigned problem, it will not render a problem, but in no case will the showMeAnotherCount in the database be incremented, nor will the number of attempts at the original problem be checked. You can preview answers and check answers and do anything except click the "Show Me Another" page with this.

That issue was fixed by saving the problem seed found that generates a new problem variant in the session as well as the set id and problem id. Thus it is not possible for a user to change these things. One advantage to this is that it is no longer necessary to verify that the problem is not the same as the assigned problem when checking or previewing answers. The seed saved in the session can safely be used.

Another issue that was seen is that when the "Show Me Another" button is used on the show me another page until all uses are exhausted (assuming that $pg{options}{showMeAnotherMaxReps} is set to limit uses), the last time that it is used the tooltip on the button says "You can use this feature as many times as you want on this problem." If the button is then clicked a new problem is not given and it says the uses are exhausted as it should, but the button shouldn't say that.

@drgrice1
Copy link
Sponsor Member Author

After fixing the issues in #2403 I kept seeing other issues with the implementation which led to this pull request.

@drgrice1
Copy link
Sponsor Member Author

Also note that this is on top of #2403.

Copy link
Sponsor Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. It seems that adding problemSeed to the query string will update the problem in showMeAnother mode, but will also update the database.

@drgrice1
Copy link
Sponsor Member Author

If you use the url with the parameters I gave it will not even update the database with the develop branch. With this pull request none of that added to the query will have any effect.

@drgrice1 drgrice1 force-pushed the show-me-another-more-bug-fixes branch 2 times, most recently from 2c85601 to 2a4b8da Compare April 23, 2024 11:06
There is a security vulnerability that allows a student to bypass the
limit on the number of times that show me another can be used
($pg{options}{showMeAnotherMaxReps}) or to open a show me another
problem before the required number of attempts at the original problem
have been made.  The ShowMeAnother package adds a hidden
showMeAnotherCheckAnswers field, and if this parameter is set it is
assumed that the user is allowed to use ShowMeAnother. That can easily
be hacked.  To do so construct the url `https?://server.edu/webwork2/course_id/set_id/problem_id/show_me_another?showMeAnotherCheckAnswers=1&checkAnswers=1&problemSeed=6543`
where `problem_id` is a valid problem number for the set `set_id`.
Change the seed at will, and you will get a new version of the problem.
If that happens to generate the same problem as the seed for the
assigned problem, it will not render a problem, but in no case will the
showMeAnotherCount in the database be incremented, nor will the number
of attempts at the original problem be checked. You can preview answers
and check answers and do anything except click the "Show Me Another"
page with this.

That issue was fixed by saving the problem seed found that generates a
new problem variant in the session as well as the set id and problem id.
Thus it is not possible for a user to change these things. One advantage
to this is that it is no longer necessary to verify that the problem is
not the same as the assigned problem when checking or previewing
answers.  The seed saved in the session can safely be used.

Another issue that was seen is that when the "Show Me Another" button is
used on the show me another page until all uses are exhausted (assuming
that `$pg{options}{showMeAnotherMaxReps}` is set to limit uses), the
last time that it is used the tooltip on the button says "You can use
this feature as many times as you want on this problem."  If the button
is then clicked a new problem is not given and it says the uses are
exhausted as it should, but the button shouldn't say that.

There is an issue with opening the show me another page in a new window
that I have seen that is not fixed by this pull request in the case that
`$pg{options}{showMeAnotherMaxReps}` is set to limit usage. That is that
when the "Show Me Another" button is clicked, the show me another page
opens in a new window, but the tooltip on the button still says the
feautre can be used same number of times.  The page must be reloaded to
update the count.  There is only one way that I know of that can
possibly definitively fix this.  That is stop opening the show me
another page in a new window.  It is possible to fix this by posting
messages from the opened window, but that is complicated to implement
(javascript for both the problem page and show me another page is
needed). In any case you can't stop the user from opening the problem
itself in another window, and then opening two different show me another
pages.  In which case one window or the other will have the incorrect
count.  So this is an issue that can never be completely fixed.
@drgrice1 drgrice1 force-pushed the show-me-another-more-bug-fixes branch from 2a4b8da to efe6e6f Compare April 26, 2024 13:07
@Alex-Jordan Alex-Jordan merged commit bfd21cb into openwebwork:develop Apr 30, 2024
2 checks passed
drgrice1 added a commit to drgrice1/webwork2 that referenced this pull request Apr 30, 2024
When I made the "Show Me Another" button an actual submit button
in openwebwork#2405, and unintended consequence is that the answers from the
original problem or previous show me another problem persist when show
me another is initialized with a new problem. I don't know why I thought
that would work.  So that will need to be a link again.
@drgrice1 drgrice1 deleted the show-me-another-more-bug-fixes branch May 8, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants