{"id":17726548,"url":"https://github.com/andreas-brunner/astro-mail-obfuscation","last_synced_at":"2025-03-14T06:32:24.846Z","repository":{"id":259313435,"uuid":"876982156","full_name":"andreas-brunner/astro-mail-obfuscation","owner":"andreas-brunner","description":"Protect email addresses, phone numbers and other sensitive data from bots scraping the source code of your Astro app.","archived":false,"fork":false,"pushed_at":"2024-11-01T00:48:51.000Z","size":26,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T22:12:09.597Z","etag":null,"topics":["astro","astro-component","astro-integration","bot-protection","email-obfuscation","email-protection","email-security","encoding","obfuscation","security","spam-protection","utility","utils","withastro"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/astro-mail-obfuscation","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreas-brunner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-22T22:07:22.000Z","updated_at":"2025-02-09T01:11:52.000Z","dependencies_parsed_at":"2024-11-15T16:52:54.341Z","dependency_job_id":null,"html_url":"https://github.com/andreas-brunner/astro-mail-obfuscation","commit_stats":null,"previous_names":["andreas-brunner/astro-mail-obfuscation"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreas-brunner%2Fastro-mail-obfuscation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreas-brunner%2Fastro-mail-obfuscation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreas-brunner%2Fastro-mail-obfuscation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreas-brunner%2Fastro-mail-obfuscation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreas-brunner","download_url":"https://codeload.github.com/andreas-brunner/astro-mail-obfuscation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243538060,"owners_count":20307100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astro","astro-component","astro-integration","bot-protection","email-obfuscation","email-protection","email-security","encoding","obfuscation","security","spam-protection","utility","utils","withastro"],"created_at":"2024-10-25T17:05:48.275Z","updated_at":"2025-03-14T06:32:24.840Z","avatar_url":"https://github.com/andreas-brunner.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Astro Mail Obfuscation\n\n[![CodeFactor](https://www.codefactor.io/repository/github/andreas-brunner/astro-mail-obfuscation/badge)](https://www.codefactor.io/repository/github/andreas-brunner/astro-mail-obfuscation)\n\n**Supported HTML tags:** `h1`-`h6`, `p`, `span`, `a`, `label`, `ul`, `ol`, `li`, `strong`, `b`, `em`, `i`.\n\nThis Astro integration effectively prevents spam bots from extracting email addresses, phone numbers or other sensitive data from the source code of your website. You can manually select one of three methods or activate random mode to increase variation and make it harder for bots to extract data. The integration has been designed with a focus on stability, reliability, performance and seamless support for `\u003cViewTransitions /\u003e`.\n\n\u003e **Important:** Server-side rendering is currently not supported.\n\n## Installation\n\nInstall (recommended via Astro CLI):\n\n```bash\nnpx astro add astro-mail-obfuscation\n```\n\n## Usage\n\nAdd the `data-obfuscation` attribute to any HTML tag containing sensitive content to obfuscate it during the build process. You can use the values `\"1\"`, `\"2\"` or `\"3\"` to manually select the method for the respective tag. Alternatively, you can use `\"0\"` to specify that the integration automatically selects one of the three methods at random during the build, which increases variability and makes interpretation by simple bots even more difficult.\n\n**Examples:**\n\n```html\n\u003c!-- Manually select obfuscation method: --\u003e\n\u003ca href=\"mailto:info@...\" data-obfuscation=\"1\"\u003einfo@...\u003c/a\u003e\n\u003ca href=\"tel:0123...\" data-obfuscation=\"2\"\u003e0123...\u003c/a\u003e\n\u003cp\u003e...\u003cspan data-obfuscation=\"3\"\u003einfo@...\u003c/span\u003e...\u003c/p\u003e\n\u003c!-- Automatically select a random obfuscation method: --\u003e\n\u003cul data-obfuscation=\"0\"\u003e\n  \u003cli\u003eJohn Doe\u003c/li\u003e\n  \u003cli\u003eJane Doe\u003c/li\u003e\n\u003c/ul\u003e\n\u003clabel data-obfuscation=\"0\"\u003einfo@...\u003c/label\u003e\n\u003c!-- ... --\u003e\n```\n\n\u003e **Information:** HTML tags that do not contain the `data-obfuscation` attribute are not obfuscated. This can be useful in certain situations (e.g. GDPR).\n\n## Methods\n\nThe integration provides three XOR-based methods for obfuscation:\n\n- **Method \"1\":** XOR with `userKey`, resulting in hexadecimal encoding.\n- **Method \"2\":** XOR with `userKey`, resulting in Base64 encoding (dynamically reversed).\n- **Method \"3\":** XOR with `userKey` and `userSalt`, resulting in Base62 encoding.\n\nEach method uses XOR-based encoding with additional keys to vary how the content is represented, making it harder for simpler bots to detect patterns. For increased variability, `data-obfuscation=\"0\"` enables automatic mode, which randomly selects a method during the build to further complicate bot interpretation.\n\n## Configuration\n\nThis integration **works out of the box with no required setup**.\n\nNevertheless, a few settings can be made to control the behavior of the integration:\n\n```js\n// astro.config.mjs\nimport mailObfuscation from \"astro-mail-obfuscation\";\nexport default defineConfig({\n  integrations: [\n    mailObfuscation({\n      fallbackText: \"Please enable JavaScript!\", // Default: \"[PROTECTED!]\"\n      // userKey: \"...\", // Automatically generated\n      // userSalt: \"...\", // Automatically generated (must be 8 characters if set manually)\n      // concurrencyLimit: number, // Max concurrent tasks, default: 5 (p-limit)\n      // allowedTags: [\"button\", \"...\"] // Add unsupported HTML tags to the whitelist\n    }),\n  ],\n});\n```\n\nThe `fallbackText` is displayed if the user has deactivated JavaScript in the browser. Whenever you run the build process, `userKey` and `userSalt` are automatically regenerated by default. If you still want to set static values within your Astro configuration, please note that the `userSalt` must be exactly 8 characters long. The length of the `userKey`, on the other hand, is not limited. The `userKey` and `userSalt` are set as a meta tag on all pages during the build process to make them accessible to the client-side JavaScript. Please change the `concurrencyLimit` with caution, as a value that is too high could affect stability. By default, 17 HTML tags are supported, but if you still need support for more tags, add them to the `allowedTags` array.\n\n\u003e **Recommendation:** In most cases, only the `fallbackText` needs to be adjusted. The default settings are already optimized for stable use.\n\n## Limitations\n\nWhile the majority of basic bots cannot execute JavaScript, this integration provides an effective and practical level of protection against simpler, more common bots. Astro Mail Obfuscation is a client-side solution that is particularly ideal for use on static sites.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreas-brunner%2Fastro-mail-obfuscation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreas-brunner%2Fastro-mail-obfuscation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreas-brunner%2Fastro-mail-obfuscation/lists"}