# Strange safe level change

**URL:** <https://www.ruby-forum.com/t/strange-safe-level-change/81475>\
**Category:** Ruby\
**Created:** [January 9, 2007, 7:29am UTC](https://www.ruby-forum.com/t/strange-safe-level-change/81475 "2007-01-09T07:29:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@tom](https://www.ruby-forum.com/u/tom)\
**Post date:** [January 9, 2007, 7:29am UTC](https://www.ruby-forum.com/t/strange-safe-level-change/81475/1 "2007-01-09T07:29:33Z")

</div>

hello,

Well I’m mailing about a problem I’m having while using the rails  
framework, since it does seem to be a ruby problem I thought I might  
as well post here

I have a security level problem, for unknown reasons it switches from  
level 0 to level 4 and then provoke some error related to the  
security level…

I have a plugin we developed I that uses a lot of method.call and  
apparently according to a post at technoweeny rails forum, this could  
be the problem ( [RailsNotes — The Ruby on Rails guides you wished you had.](http://www.railsweenie.com/forums/1/topics/659) ) …

Is there any way to resolve this problem without having to stop using  
method.call (we don’t really want a major rewrite) ? What exactly is  
the problem and why does it happen?

I would be very grateful for your help…

---

<div class="post-metadata">

**Author:** ![tom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@tom](https://www.ruby-forum.com/u/tom)\
**Post date:** [January 9, 2007, 5:43pm UTC](https://www.ruby-forum.com/t/strange-safe-level-change/81475/2 "2007-01-09T17:43:11Z")

</div>

On Jan 8, 2007, at 22:29, Tom wrote:

> Well I’m mailing about a problem I’m having while using the rails  
> framework, since it does seem to be a ruby problem I thought I  
> might as well post here
> 
> I have a security level problem, for unknown reasons it switches  
> from level 0 to level 4 and then provoke some error related to the  
> security level…

$SAFE is switched when you assign to it, never at any other time.

> I have a plugin we developed I that uses a lot of method.call and  
> apparently according to a post at technoweeny rails forum, this  
> could be the problem ( [http://www.railsweenie.com/forums/1/topics/](http://www.railsweenie.com/forums/1/topics/)  
> 659 ) …
> 
> Is there any way to resolve this problem without having to stop  
> using method.call (we don’t really want a major rewrite) ? What  
> exactly is the problem and why does it happen?

You have code like $SAFE = 4 in your program somwhere. Use grep to  
find it.

Typically $SAFE = 4 is only set in a spawned thread since its so  
strict its rarely useful outside of sandboxing dangerous code.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)

I LIT YOUR GEM ON FIRE!
