Skip to content

Fix the _clean_stash handling for the WeBWorK::WWSafe package. - #3256

Open
drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:safe-better-clean-stash
Open

drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:safe-better-clean-stash

Conversation

@drgrice1

Copy link
Copy Markdown
Member

This uses the same shared-package defense from the pg pull request openwebwork/pg#1565.

The snapshot_hooks method can be called to record the hooks in the shared packages once the compartment is fully set up but before the user provided code runs, and _clean_stash then uses that to restore any shared hook the user supplied code overwrites in place and strip all hooks the user provided code adds (so a hook in a new Mojo::Exception::Evil package is stripped, but Mojo::Exception's overloads are left alone). snapshot_hooks is called from the AchievementNotification task, which is the only consumer that shares whole package stashes into a compartment.

@drgrice1
drgrice1 force-pushed the safe-better-clean-stash branch 2 times, most recently from 702e0b5 to 4ed8ac7 Compare October 27, 2026 21:08
@drgrice1
drgrice1 force-pushed the safe-better-clean-stash branch 4 times, most recently from 576f4cf to 7809627 Compare November 4, 2026 11:45
@drgrice1
drgrice1 force-pushed the safe-better-clean-stash branch from 7809627 to 7476c10 Compare November 9, 2026 17:40

@somiaj somiaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested with achievements and they seem to still work fine. Didn't test achievement email notifications. Anything in particular we should test to try to break things (I only tested stuff still worked).

@drgrice1

Copy link
Copy Markdown
Member Author

Test achievement evaluators and that the course environment works. Test achievement notifications if you can test emails.

@drgrice1
drgrice1 force-pushed the safe-better-clean-stash branch 2 times, most recently from a62f675 to 72141fe Compare November 10, 2026 22:32
This uses the same shared-package defense from the pg pull request
openwebwork/pg#1565.

The `snapshot_hooks` method can be called to record the hooks in the
shared packages once the compartment is fully set up but before the user
provided code runs, and `_clean_stash` then uses that to restore any
shared hook the user supplied code overwrites in place and strip all
hooks the user provided code adds (so a hook in a new `Mojo::Exception::Evil`
package is stripped, but `Mojo::Exception`'s overloads are left alone).
`snapshot_hooks` is called from the `AchievementNotification` task,
which is the only consumer that shares whole package stashes into a
compartment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@drgrice1
drgrice1 force-pushed the safe-better-clean-stash branch from 72141fe to a51786b Compare November 12, 2026 21:50
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.

2 participants