{"id":19364905,"url":"https://github.com/simonbaese/jsonapi_obscurity","last_synced_at":"2026-05-17T05:41:23.022Z","repository":{"id":182130510,"uuid":"492896249","full_name":"simonbaese/jsonapi_obscurity","owner":"simonbaese","description":"A Drupal module to handle an obscurity prefix for JSON:API requests.","archived":false,"fork":false,"pushed_at":"2022-05-17T14:32:04.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-06T21:16:38.261Z","etag":null,"topics":["drupal","jsonapi","obscurity","security"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonbaese.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}},"created_at":"2022-05-16T15:33:28.000Z","updated_at":"2022-11-21T16:47:16.000Z","dependencies_parsed_at":"2023-07-18T20:55:18.416Z","dependency_job_id":null,"html_url":"https://github.com/simonbaese/jsonapi_obscurity","commit_stats":null,"previous_names":["simonbaese/jsonapi_obscurity"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbaese%2Fjsonapi_obscurity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbaese%2Fjsonapi_obscurity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbaese%2Fjsonapi_obscurity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbaese%2Fjsonapi_obscurity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonbaese","download_url":"https://codeload.github.com/simonbaese/jsonapi_obscurity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240483762,"owners_count":19808636,"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":["drupal","jsonapi","obscurity","security"],"created_at":"2024-11-10T07:38:36.917Z","updated_at":"2026-05-17T05:41:18.001Z","avatar_url":"https://github.com/simonbaese.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON:API Obscurity\n\nA **Drupal** module to handle an obscurity prefix for JSON:API requests.\n\n## :wave: Introduction\n\n:wrench: This module depends on `jsonapi`. Requires at least `PHP 8.0`.\n\n:warning: This is an **alpha** implementation.  \n:warning: **Obscurity** is not **security**.  \n:warning: Please be advised that there is no security garantuee.\n\nAn obscurity prefix for your JSON:API routes is an effective way to deny automated attacks - see [\"Security considerations of the JSON:API module\"](https://www.drupal.org/docs/core-modules-and-themes/core-modules/jsonapi-module/security-considerations#s-5-security-through-obscurity-secret-base-path). The common way to add an obscurity prefix is to modify the JSON:API base bath. This practice is problematic because the _secret_ prefix leaks into the system. For example, the prefix will be displayed in the database logs or in the meta information delivered by the JSON:API module.\n\nThis module steps in very early in the request event handling. It validates the obscurity prefix for JSON:API requests and then reinitializes the request with the prefix-stripped path. If the obscurity can not be verified, it will throw a `NotFoundHttpException`. \n\nThere is also some basic support for language negotiation via path prefix. \n\n## :whale: Usage\n\nAfter installation you should set the obscurity prefix in `sites/default/services.yml` as follows:\n\n``` yml\nparameters:\n  jsonapi_obscurity.prefix: '/12345'\n```\n\nThe module makes some assumptions, when handling a request:\n- All other route paths should _not_ include the JSON:API base path.\n- The obscurity prefix should _not_ include the JSON:API base path.\n- The JSON:API base path should _not_ be equal to a standard langcode - see `LanguageManager`.\n- The `JsonApiObscuritySubscriber` service runs before any other service that requires route information.\n- The `OPTIONS` request is still available for the plain JSON:API routes.\n- The site only uses standard langcodes for language negotiation via path prefix.\n\nUsing this module breaks the functionality of the `EntityToJsonApi` service provided by the `jsonapi_extras` module. This service is used by the `jsonapi_boost` module to warm caches. The repository includes a simple patch (`obscurity-prefix-in-entitytojsonapi-service.patch`) to prepend the obscurity prefix for the requests in the service. The tests of the effected modules may fail after applying the patch.\n\n## :seedling: Contact \n\nI am open to further develop this module and to discuss your considerations and needs - feel free to contact me.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonbaese%2Fjsonapi_obscurity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonbaese%2Fjsonapi_obscurity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonbaese%2Fjsonapi_obscurity/lists"}