[SecurityBundle] avoid unneeded work

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13018
| License       | MIT
| Doc PR        | n/a