Change the filter in Ex:BypassSecurityWithTextSubstitution so that it is not vulnerable to this kind of manipulation. Continue using a macro – don't convert it to a procedure. (Of course, the user could still just edit the tiddler and remove the authentication altogether. TiddlyWiki is not a suitable environment when users need to have limited access.)
Go to answer: Ex:PreserveSecurityWithTextSubstitution/answer