Skip to content

About

Graceful E-mail Obfuscation for Plone

Resources

Stars

2 stars

Watchers

112 watching

Forks

Repository files navigation

collective.geotransform

Tests Meta

GEO stands for "Gracefully E-mail Obfuscation". This package implements the solution exposed in this post of A List Apart, authored by Roel Van Gils:

http://www.alistapart.com/articles/gracefulemailobfuscation/

collective.geotransform uses plone.transformchain to transform the response output from Zope before it reaches your browser. It searches for all "mailto:" occurrences inside the response and transforms them into encoded harmless links. It also searches for plain email addresses (without links) inside the response and transforms them into encrypted spans. This codification is done via a simple base64 encoding, but enough to fool a spam robot.

This is the form of the encoded mailto link:

<a rel="nofollow" href="geomailto:dmljdG9yLmZlcm5hbmRlejJAdXBjbmV0LmVz">Link text</a>

While this is the form of the encoded span for plain email address:

<span class="geomailaddress">dmljdG9yLmZlcm5hbmRlejJAdXBjbmV0LmVz</span>

On the browser side, the encoded links and spans are decoded to their original form by using a Javascript that restores them to normal "mailto:" links and decrypted plain text emails.

Authenticated responses are NOT affected by this transform. Only anonymous responses are modified.

Compatibility

Version 4.x supports Plone 6.1 on Python 3.10 to 3.13, and Plone 6.2 on Python 3.10 to 3.14.

Older versions support older Plone versions:

  • Plone 6.0: versions 3.x
  • Plone 5: versions 2.x
  • Plone 4: versions 1.x

Installation

Add collective.geotransform to the dependencies of your project (with pip, uv or buildout), restart Plone, then activate the add-on in the Add-ons control panel.

Development

Requires uv. This installs the package with Plone 6.2.3 in .venv (use PLONE_VERSION=6.1.6 make install for another version) and the prek git hook.

make install
make start          # Plone on http://localhost:8080 (admin / admin)
make console        # Python console with the Zope application as `app`

Create a Plone site, then activate collective.geotransform in the Add-ons control panel. The transform only applies to anonymous responses: log out (or use a private window) to see the obfuscated links.

Tests

Tests run through tox, as the CI does. The robot scenario checks that the browser decodes the links: it runs Selenium with headless Chrome.

make test                                   # Plone 6.2.3
uvx --with tox-uv tox -e py312-plone61      # one Plone / Python combination
make test-all                               # lint, every combination, dependencies

Without tox:

.venv/bin/zope-testrunner --all --test-path=src -s collective.geotransform

Lint

make check          # format then lint (pyupgrade, isort, black, flake8...)

.editorconfig, .flake8, .gitignore, .pre-commit-config.yaml, tox.ini, .github/ and the tool sections of pyproject.toml are generated by plone.meta: change .meta.toml, then run uvx --from plone.meta config-package --no-commit --branch current ..

Release

make release        # zest.releaser fullrelease, run through uvx

Contribute

License

The project is licensed under the GPLv2 or later.

TODO

  • Accessibility form and validators

About

Graceful E-mail Obfuscation for Plone

Resources

Stars

2 stars

Watchers

112 watching

Forks

Releases

Packages

Used by

Contributors

Languages