Ensures that the input is marked as a safe string (i.e. Script.String(safe=True)).
(inp)
| 64 | |
| 65 | |
| 66 | def ensure_safe(inp): |
| 67 | """ |
| 68 | Ensures that the input is marked as a safe string (i.e. Script.String(safe=True)). |
| 69 | """ |
| 70 | if not isinstance(inp, Script.String): |
| 71 | G_LOGGER.internal_error(f"Input to ensure_safe must be of type Script.String, but was: {inp}") |
| 72 | elif not inp.safe: |
| 73 | G_LOGGER.internal_error(f"Input string: {inp} was not checked for safety. This is a potential security risk!") |
| 74 | return inp |
| 75 | |
| 76 | |
| 77 | @mod.export() |
no test coverage detected