INNER CODE UNIT · Python

sieve_string

Mailu/Mailu · core/admin/mailu/__init__.py:101

    def sieve_string(value):
        # Escape a value for safe inclusion inside a Sieve quoted-string.
        # RFC 5228 requires escaping '\' and '"'; we also escape '$' so a
        # user-controlled value cannot inject Sieve variable expansion
        # ('${...}', RFC 5229) once the "variables" extension is required.
        # Backslash must be escaped first so the escapes we add aren't re-escaped.
        return str(value).replace('\\', '\\\\').replace('"', '\\"').replace('$', '\\$')

    def ping():
        return ''
    app.route('/ping')(ping)

    # Import views
    from mailu import ui, internal, sso, api
    app.register_blueprint(ui.ui, url_prefix=app.config['WEB_ADMIN'])
    app.register_blueprint(internal.internal, url_prefix='/internal')
    app.register_blueprint(sso.sso, url_prefix='/sso')
    api.register(app, web_api_root=app.config.get('WEB_API'))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…