Create a filter in the framework. Call it, for example, securityFilter.
Create a parameter map called securityMap. Set the default value to [ns].[securityFilter]. In Key put the unsecured package name, in value put in 1=1.
Now in the filter on the business layer put in #$securityMap('test')#
Since test doesn't match any of the keys, it should be filtered by the securityFilter.
Next, it seems to be harder than it should be to get the package name inside a macro. This is what I've come up with:
#sq( substitute(''']','',substitute('package\[\@name=''','',join('',grep ( 'package' , split('/',$modelPath)) ) )))#
replace the test with that macro
#$securityMap(sq( substitute(''']','',substitute('package\[\@name=''','',join('',grep ( 'package' , split('/',$modelPath)) ) ))))#
Now public the secured package and test this. It should be using the normal filter.
Now publish the unsecured package and test. It should filtering on 1=1.
Note that this will not work in FM, since it looks at the modelPath.