{"id":31890169,"url":"https://github.com/aquasecurity/lmdrouter","last_synced_at":"2025-10-13T07:22:04.370Z","repository":{"id":40481160,"uuid":"249174990","full_name":"aquasecurity/lmdrouter","owner":"aquasecurity","description":"Go HTTP router library for AWS API Gateway-invoked Lambda Functions","archived":false,"fork":false,"pushed_at":"2024-01-05T01:42:30.000Z","size":85,"stargazers_count":141,"open_issues_count":8,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-15T13:43:51.868Z","etag":null,"topics":["api-gateway","aws","aws-lambda","go","golang","http","lambda-functions","router"],"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/aquasecurity.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":"2020-03-22T12:07:03.000Z","updated_at":"2025-05-17T09:56:18.000Z","dependencies_parsed_at":"2024-06-18T18:29:26.788Z","dependency_job_id":null,"html_url":"https://github.com/aquasecurity/lmdrouter","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/aquasecurity/lmdrouter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquasecurity%2Flmdrouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquasecurity%2Flmdrouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquasecurity%2Flmdrouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquasecurity%2Flmdrouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aquasecurity","download_url":"https://codeload.github.com/aquasecurity/lmdrouter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquasecurity%2Flmdrouter/sbom","scorecard":{"id":204676,"data":{"date":"2025-08-11","repo":{"name":"github.com/aquasecurity/lmdrouter","commit":"fb89207ba5dc39f1d1c9881385427b533024011e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":2,"reason":"Found 6/21 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/aquasecurity/lmdrouter/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/aquasecurity/lmdrouter/go.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T23:27:44.945Z","repository_id":40481160,"created_at":"2025-08-16T23:27:44.945Z","updated_at":"2025-08-16T23:27:44.945Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014111,"owners_count":26085463,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api-gateway","aws","aws-lambda","go","golang","http","lambda-functions","router"],"created_at":"2025-10-13T07:21:59.793Z","updated_at":"2025-10-13T07:22:04.362Z","avatar_url":"https://github.com/aquasecurity.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lmdrouter\n\n[![](https://img.shields.io/static/v1?label=godoc\u0026message=reference\u0026color=blue\u0026style=flat-square)](https://godoc.org/github.com/aquasecurity/lmdrouter) [![](https://img.shields.io/github/license/aquasecurity/lmdrouter?style=flat-square)](LICENSE) [![Build Status](https://travis-ci.org/aquasecurity/lmdrouter.svg?branch=master)](https://travis-ci.org/aquasecurity/lmdrouter)\n\n**Go HTTP router library for AWS API Gateway-invoked Lambda Functions**\n\n## Table of Contents\n\n\u003c!-- vim-markdown-toc GFM --\u003e\n\n- [Overview](#overview)\n  - [Use Case](#use-case)\n  - [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Static Compilation for AWS Lambda](#static-compilation-for-aws-lambda)\n- [License](#license)\n\n\u003c!-- vim-markdown-toc --\u003e\n\n## Overview\n\n`lmdrouter` is a simple-to-use library for writing AWS Lambda functions in Go\nthat listen to events of type API Gateway Proxy Request. It allows creating a\nlambda function that can match requests based on their URI, just like an HTTP\nserver would.\n\nThe library provides an interface not unlike the standard `net/http.Mux` type\nor community libraries such as [httprouter](https://github.com/julienschmidt/httprouter)\nand [chi](https://github.com/go-chi/chi).\n\n### Use Case\n\nWhen building large cloud-native applications, there's a certain balance to\nstrike when it comes to deployment of APIs. On one side of the scale, each API\nendpoint has its own lambda function. This provides the greatest flexibility,\nbut is extremely difficult to maintain. On the other side of the scale, there\ncan be one lambda function for the entire API. This provides the least flexibility,\nbut is the easiest to maintain. Both are probably not a good idea.\n\nWith `lmdrouter`, one can create small lambda functions for different aspects of\nthe API. For example, if your application model contains multiple domains (e.g.\narticles, authors, topics, etc…), you can create one lambda function for each\ndomain, and deploy these independently (e.g. everything below \"/api/articles\" is\none lambda function, everything below \"/api/authors\" is another function). This\nis also useful for applications where different teams are in charge of different\nparts of the API.\n\n### Features\n\n- Supports all HTTP methods.\n- Supports middleware at a global and per-resource level.\n- Supports path parameters with a simple \":\u003cname\u003e\" format (e.g. \"/posts/:id\").\n- Provides ability to automatically \"unmarshal\" an API Gateway request to an\n  arbitrary Go struct, with data coming from the request path, the query string,\n  the headers and the request body (only JSON requests are currently supported).\n- Provides ability to automatically \"marshal\" responses of any type to an API\n  Gateway response (only JSON responses are currently generated).\n- Implements [net/http.Handler](https://pkg.go.dev/net/http#Handler) for running locally or as a simple HTTP server.\n\n## Installation\n\n```shell\ngo get github.com/aquasecurity/lmdrouter\n```\n\n## Usage\n\n`lmdrouter` is meant to be used inside Go Lambda functions.\n\n```go\npackage main\n\nimport (\n    \"github.com/aws/aws-lambda-go/lambda\"\n    \"github.com/aquasecurity/lmdrouter\"\n)\n\nvar router *lmdrouter.Router\n\nfunc init() {\n    router = lmdrouter.NewRouter(\"/api\", loggerMiddleware, authMiddleware)\n    router.Route(\"GET\", \"/\", listSomethings)\n    router.Route(\"POST\", \"/\", postSomething, someOtherMiddleware)\n    router.Route(\"GET\", \"/:id\", getSomething)\n    router.Route(\"PUT\", \"/:id\", updateSomething)\n    router.Route(\"DELETE\", \"/:id\", deleteSomething)\n}\n\nfunc main() {\n    lambda.Start(router.Handler)\n}\n\n// the rest of the code is a redacted example, it will probably reside in a\n// separate package inside your project\n\ntype listSomethingsInput struct {\n    ID                string   `lambda:\"path.id\"`                // a path parameter declared as :id\n    ShowSomething     bool     `lambda:\"query.show_something\"`   // a query parameter named \"show_something\"\n    AcceptedLanguages []string `lambda:\"header.Accept-Language\"` // a multi-value header parameter\n}\n\ntype postSomethingInput struct {\n    Title   string    `json:\"title\"`\n    Date    time.Time `json:\"date\"`\n}\n\nfunc listSomethings(ctx context.Context, req events.APIGatewayProxyRequest) (\n    res events.APIGatewayProxyResponse,\n    err error,\n) {\n    // parse input from request and path parameters\n    var input listSomethingsInput\n    err = lmdrouter.UnmarshalRequest(req, false, \u0026input)\n    if err != nil {\n        return lmdrouter.HandleError(err)\n    }\n\n    // call some business logic that generates an output struct\n    // ...\n\n    return lmdrouter.MarshalResponse(http.StatusOK, nil, output)\n}\n\nfunc postSomethings(ctx context.Context, req events.APIGatewayProxyRequest) (\n    res events.APIGatewayProxyResponse,\n    err error,\n) {\n    // parse input from request body\n    var input postSomethingsInput\n    err = lmdrouter.UnmarshalRequest(req, true, \u0026input)\n    if err != nil {\n        return lmdrouter.HandleError(err)\n    }\n\n    // call some business logic that generates an output struct\n    // ...\n\n    return lmdrouter.MarshalResponse(http.StatusCreated, nil, output)\n}\n\nfunc loggerMiddleware(next lmdrouter.Handler) lmdrouter.Handler {\n    return func(ctx context.Context, req events.APIGatewayProxyRequest) (\n        res events.APIGatewayProxyResponse,\n        err error,\n    ) {\n        // [LEVEL] [METHOD PATH] [CODE] EXTRA\n        format := \"[%s] [%s %s] [%d] %s\"\n    \tlevel := \"INF\"\n    \tvar code int\n    \tvar extra string\n\n    \tres, err = next(ctx, req)\n    \tif err != nil {\n    \t    level = \"ERR\"\n    \t    code = http.StatusInternalServerError\n    \t    extra = \" \" + err.Error()\n    \t} else {\n    \t    code = res.StatusCode\n    \t    if code \u003e= 400 {\n    \t        level = \"ERR\"\n    \t    }\n        }\n\n        log.Printf(format, level, req.HTTPMethod, req.Path, code, extra)\n\n        return res, err\n    }\n}\n```\n\nNote that for requests with a body (e.g. POST, PUT, PATCH), the struct types of\nyour inputs can contain parameters from all sources: path parameters, query\nstring parameters, request headers _and_ the JSON body. Anything that doesn't\nhave a `lambda` struct tag is taken from the body. Regular `json` tags can be\nused for that.\n\n## Static Compilation for AWS Lambda\n\nTo ensure Lambda applications using lmdrouter (or any Lambda applications\nwritten in Go, for that matter) will properly work in AWS's Go runtime, make\nsure to compile your applications statically. You can either disable CGO\ncompletely using `CGO_ENABLED=0`, or use the following build flags:\n\n```sh\ngo build -tags netgo -ldflags \"-s -w\"\n```\n\n## License\n\nThis library is distributed under the terms of the [Apache License 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faquasecurity%2Flmdrouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faquasecurity%2Flmdrouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faquasecurity%2Flmdrouter/lists"}