{"id":15612068,"url":"https://github.com/tarellel/ldap_query","last_synced_at":"2026-04-19T04:36:01.514Z","repository":{"id":56880905,"uuid":"345273330","full_name":"tarellel/ldap_query","owner":"tarellel","description":"Used to easily query LDAP to authenticate or do a query for matching user attributes","archived":false,"fork":false,"pushed_at":"2021-03-07T06:18:42.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-04T02:17:51.588Z","etag":null,"topics":["ldap","ldap-authentication","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/tarellel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-07T06:17:24.000Z","updated_at":"2021-03-07T06:25:31.000Z","dependencies_parsed_at":"2022-08-20T22:31:15.266Z","dependency_job_id":null,"html_url":"https://github.com/tarellel/ldap_query","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tarellel/ldap_query","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarellel%2Fldap_query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarellel%2Fldap_query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarellel%2Fldap_query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarellel%2Fldap_query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarellel","download_url":"https://codeload.github.com/tarellel/ldap_query/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarellel%2Fldap_query/sbom","scorecard":{"id":868792,"data":{"date":"2025-08-11","repo":{"name":"github.com/tarellel/ldap_query","commit":"d152aecd3eb84df4af2be6b9454e7e08c0541550"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"Code-Review","score":0,"reason":"Found 0/1 approved changesets -- score normalized to 0","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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: 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 'main'"],"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":"Vulnerabilities","score":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-cr5q-6q9f-rq6q","Warn: Project is vulnerable to: GHSA-j6gc-792m-qgm2","Warn: Project is vulnerable to: GHSA-pj73-v5mw-pm9j","Warn: Project is vulnerable to: GHSA-2rxp-v6pw-ch6m","Warn: Project is vulnerable to: GHSA-4xqq-m2hx-25v8","Warn: Project is vulnerable to: GHSA-5866-49gr-22v4","Warn: Project is vulnerable to: GHSA-8cr8-4vfw-mr7h","Warn: Project is vulnerable to: GHSA-r55c-59qm-vjw6","Warn: Project is vulnerable to: GHSA-vg3r-rm7w-2xgh","Warn: Project is vulnerable to: GHSA-vmwr-mc7x-5vc3","Warn: Project is vulnerable to: GHSA-8mq4-9jjh-9xrc"],"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-24T03:31:09.037Z","repository_id":56880905,"created_at":"2025-08-24T03:31:09.037Z","updated_at":"2025-08-24T03:31:09.037Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31995167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"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":["ldap","ldap-authentication","rails","ruby"],"created_at":"2024-10-03T06:21:45.068Z","updated_at":"2026-04-19T04:36:01.486Z","avatar_url":"https://github.com/tarellel.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![LdapQuery][rubygems-downloads]][rubygems-link]\n[![Gem Version][rubygems-version]][rubygems-link]\n[![MIT License][license-shield]][license-url]\n\n# LdapQuery\n\nI used to make querying LDAP with a ruby or rails application an easy process rather than pain trying to figure out how to bind the connections. Build a LDAP filter and querying the LDAP host for matching results.\n\nIt was taken into account that not all ruby scripts are part of a rails application, so you can either pass it a credentials hash. But if you're making the queries from a rails application with and haven't passed a credentials hash it resolves to looking for an entry in your encrypted credentials with an ldap key.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ldap_query'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install ldap_query\n\n## Usage\n\nIf you're using this gems functionality from a rails application you'll want to either add the following to your encrypted credentials file or pass the credentials to your query helpers as an optional parameter.\n\n```yaml\nldap:\n  host: company_host.tld\n  base: DC=company,DC=org,DC=tld\n  username: cn=Common,OU=Organization,DC=Domain,DC=tld\n  password: password123\n  port: 636\n  encryption: simple_tls\n  method: simple\n```\n\n_(port, encryption, and method are optional)_\n\nIf using this gem in a rails application there are helpers available that you can called from your controllers, views/helpers, and/or models.\n\n#### Rails Helpers\n\n```ruby\nsearch_ldap_by_username(str)  # seaches for a matching `cn`\n\nsearch_ldap_by_name(str)  # searches for a matching `displayname`\n\nsearch_ldap_by_group(str) # tries to find a match against a matching `memberof`\n\nsearch_ldap_by_mail(str)  # matches against the ldap users mail attribute\n\nsearch_ldap_by_other(attr: 'key', val: 'val') # matches against the specified ldap attribute and value\n\nauthenticate_user(username: 'jdoe', password: 'pass123')  # Bind a user against the ldap base to authenticate their credentials\n```\n\nThere are 2 optional keyword parameters you can pass when using these helpers, `wildcard:` and `limit:`.\n\nDefault values\n\n```ruby\nwildcard: false # when set as false it expects an exact match\nlimit: 20       # default limit of ldap results returned\n```\n\nWithout wildcard ldap requires an exact match like, ie if you have a user with a displayname of `John A. Doe` and you do a lookup with wildcard as false with the str `John Doe` it won't return the user. But if wildcard is set as true it compares against ldap with the value of `John*Doe`. Which _should_ match the user,\n\nTo change these values you just add the key and value to the method call.\n\n`search_ldap_by_username('jdoe', wildcard: true)`\n\n\nThese helpers also allow a _(optional)_ secondary parameter to be passed to them. This secondary will be used as the ldap credential. By default the gem will pull the ldap connections credentials from your encrypted credentials, so you don't need to pass paramters, if you have set the credentials with a base key of `ldap:`. But the one case were you may need to pass the credentials is if you want to hit multiple ldap hosts/bases to grab different results.\n\n```ruby\nfirst_results = search_ldap_by_username('jdoe', first_host_credentials_hash)\nsecond_results = search_ldap_by_username('jdoe', hash_host_credentials_hash)\n```\n\n#### CLI or Ruby script\n\nBut these helpers are optional and can be used in CLI or through a ruby script without having to use rails.\n\nJsut be sure to include the LdapQuery gem into your ruby script or terminal with the following: `require 'ldap_query'`.\n\nThe main part of build the query if using `LdapQuery::Query.perform` method. You need to ensure you pass the credentials hash, the ldap attribute you want to query againt _(ie: :cn)_ and the val you are will be querying ldap with. As see from the helper methods above you can also pass the keyword/values for `wildcard` and `limit`.\n\n```ruby\nrequire 'ldap_query'\n\n# You LDAP credentials always need to be passed as hash, listed below are the required parameters\n# (optional parameters include: port, method, and encryption)\ncredentials = { base: 'DC=company,DC=org,DC=tld', username: 'cn=Common,OU=Organization,DC=Domain,DC=tld', password: 'password123', host: 'company.tld' }\n\nLdapQuery::Query.perform(credentials, attr: :cn, val: str)\nLdapQuery::Query.perform(credentials, attr: :displayname, val: 'John Doe', limit: 3)\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/tarellel/ldap_query.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n[license-shield]: https://img.shields.io/github/license/tarellel/ldap_query.svg?style=flat-square\n[license-url]: https://github.com/tarellel/ldap_query/blob/master/LICENSE\n[rubygems-downloads]: https://ruby-gem-downloads-badge.herokuapp.com/ldap_query?type=total\n[rubygems-link]: https://rubygems.org/gems/ldap_query\n[rubygems-version]: https://badge.fury.io/rb/ldap_query.svg","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarellel%2Fldap_query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarellel%2Fldap_query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarellel%2Fldap_query/lists"}