Protect forbidden reopenings of classes/modules #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#26 and #27 introduced several mechanisms based on detecting tampering attempts statically before commands were executed. This PR adds a new check against reopening forbidden classes. If a forbidden reopening materializes, it will log the command and force exiting from IRB.
Take this example:
This code would skip our static analysis. We can detect it now because we let the code run and we validate that no new methods were added to the class. Because the code executes, the damage is done, so we log the attempt (which could be prevented by the command) and, in any case, we exit from IRB.