-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from basecamp/debug-errors
Fix flagging `String#constantize` invocations as suspicious
- Loading branch information
Showing
5 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Prevents loading forbidden classes dynamically. | ||
# | ||
# See extension to +Console1984::Ext::Core::Object#const_get+. | ||
module Console1984::Ext::Core::String | ||
extend ActiveSupport::Concern | ||
|
||
include Console1984::Freezeable | ||
self.prevent_instance_data_manipulation_after_freezing = false | ||
|
||
def constantize | ||
if Console1984.command_executor.from_irb?(caller) | ||
begin | ||
Console1984.command_executor.validate_command("class #{self}; end") | ||
super | ||
rescue Console1984::Errors::ForbiddenCommandAttempted | ||
raise | ||
rescue StandardError | ||
super | ||
end | ||
else | ||
super | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters