# Re: Strange safe level change

**URL:** <https://www.ruby-forum.com/t/re-strange-safe-level-change/81570>\
**Category:** Ruby\
**Created:** [January 10, 2007, 12:33am UTC](https://www.ruby-forum.com/t/re-strange-safe-level-change/81570 "2007-01-10T00:33:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gennady\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c57346/32.png) [@Gennady\_B](https://www.ruby-forum.com/u/Gennady_B)\
**Post date:** [January 10, 2007, 12:33am UTC](https://www.ruby-forum.com/t/re-strange-safe-level-change/81570/1 "2007-01-10T00:33:04Z")

</div>

Eric H. wrote:

> > > > security level…  
> > > > 1.8.4  
> > > > if (OBJ\_TAINTED(method)) {  
> > > > safe = NOEX\_WITH(data-\>safe\_level, 4)|NOEX\_TAINTED; }

Yes, I got the idea for the example from looking at this particular spot  
;-). Interesting, that if your current $SAFE level is 1, such method  
invocation switches it to 5.

> $SAFE is only changed for the method invocation, it does not leak  
> into the surrounding process. puts $SAFE afterward shows the  
> original safe level.

You are absolutely right. However, what if a method invoked in such a  
way is a starting point for your entire subsystem? 😉

I wonder, what is the reason for such a behavior? I am sure there’s a  
very good one.

Gennady.
