{"id":13564769,"url":"https://github.com/abiosoft/caddy-hmac","last_synced_at":"2025-04-11T00:31:52.807Z","repository":{"id":137635647,"uuid":"264465898","full_name":"abiosoft/caddy-hmac","owner":"abiosoft","description":"Caddy v2 hmac signature validation middleware","archived":false,"fork":false,"pushed_at":"2021-05-22T20:55:02.000Z","size":73,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T21:13:33.862Z","etag":null,"topics":["caddy","caddy-module","caddyserver","hmac","hmac-signature"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abiosoft.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}},"created_at":"2020-05-16T15:22:49.000Z","updated_at":"2025-01-22T21:27:56.000Z","dependencies_parsed_at":"2024-01-16T18:58:42.727Z","dependency_job_id":"9cf175d0-079a-495e-bd08-378b1e852e93","html_url":"https://github.com/abiosoft/caddy-hmac","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abiosoft%2Fcaddy-hmac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abiosoft%2Fcaddy-hmac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abiosoft%2Fcaddy-hmac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abiosoft%2Fcaddy-hmac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abiosoft","download_url":"https://codeload.github.com/abiosoft/caddy-hmac/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322236,"owners_count":21084333,"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":["caddy","caddy-module","caddyserver","hmac","hmac-signature"],"created_at":"2024-08-01T13:01:35.653Z","updated_at":"2025-04-11T00:31:52.780Z","avatar_url":"https://github.com/abiosoft.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![Go](https://github.com/abiosoft/caddy-hmac/workflows/Go/badge.svg)](https://github.com/abiosoft/caddy-hmac/actions)\n\n# caddy-hmac\n\nCaddy v2 hmac middleware\n\n## Installation\n\n```\nxcaddy build v2.0.0 \\\n    --with github.com/abiosoft/caddy-hmac\n```\n\n## Usage\n\n`hmac` computes the hash of the request body as a `{hmac.signature}` [placeholder](https://caddyserver.com/docs/caddyfile/concepts#placeholders) for other [matchers](https://caddyserver.com/docs/caddyfile/matchers) and [handlers](https://caddyserver.com/docs/caddyfile/directives).\n\n### Caddyfile\n\n```\nhmac [\u003cname\u003e] \u003calgorithm\u003e \u003csecret\u003e\n```\n\n* **name** - [optional] if set, names the signature and available as `{hmac.name.signature}`.\n* **algorithm** - hash algorithm to use. Can be one of `sha1`, `sha256`, `md5`.\n* **secret** - the hmac secret key.\n\n#### Example\n\nRun a [command](https://github.com/abiosoft/caddy-exec) after validating a Github webhook secured with a secret.\n\n```\n@github {\n    path /webhook\n    header_regexp X-Hub-Signature \"[a-z0-9]+\\=([a-z0-9]+)\"\n}\n@hmac {\n    expression {hmac.signature} == {http.regexp.1}\n}\nroute @github {\n    hmac sha1 {$GITHUB_WEBHOOK_SECRET}\n    exec @hmac git pull origin master\n}\n```\n\n### JSON\n\n`hmac` can be part of any route as an handler\n\n```jsonc\n{\n  ...\n  \"routes\": [\n    {\n      \"handle\": [\n        {\n          // required to indicate the handler\n          \"handler\": \"hmac\",\n          // [optional] if set, names the sigurature to be referenced\n          // as {hmac.name.signature}.\n          \"name\": \"\",\n          // the algorithm to use. can be sha1, sha256, md5\n          \"algorithm\": \"sha1\",\n          // hmac secret\n          \"secret\": \"some secrets\"\n        }\n      ]\n    },\n    ...\n  ]\n  ...\n}\n```\n\n## License\n\nApache 2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabiosoft%2Fcaddy-hmac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabiosoft%2Fcaddy-hmac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabiosoft%2Fcaddy-hmac/lists"}