{"id":48331001,"url":"https://github.com/toolmanorg/net-peercred","last_synced_at":"2026-04-05T01:04:59.874Z","repository":{"id":64303339,"uuid":"189258887","full_name":"toolmanorg/net-peercred","owner":"toolmanorg","description":"A net.Listener implementation leveraging Unix domain socket features to reliably identify client processes.","archived":false,"fork":false,"pushed_at":"2024-01-31T23:20:30.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-01T01:15:59.416Z","etag":null,"topics":["golang","golang-library","identification","linux","networking","socket-programming"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/toolmanorg.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-29T16:10:32.000Z","updated_at":"2023-11-19T17:13:25.000Z","dependencies_parsed_at":"2023-01-15T10:00:46.693Z","dependency_job_id":"fc15e457-1c90-4e85-8b4c-27b987070d9d","html_url":"https://github.com/toolmanorg/net-peercred","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"a76f36aa6e6f7bf4acbd1f36c3501fef3c5c5523"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/toolmanorg/net-peercred","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolmanorg%2Fnet-peercred","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolmanorg%2Fnet-peercred/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolmanorg%2Fnet-peercred/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolmanorg%2Fnet-peercred/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toolmanorg","download_url":"https://codeload.github.com/toolmanorg/net-peercred/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolmanorg%2Fnet-peercred/sbom","scorecard":{"id":894293,"data":{"date":"2025-08-11","repo":{"name":"github.com/toolmanorg/net-peercred","commit":"2a80377184bdc060520f3b6b65b03ea1ffeb6d86"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"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":"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":"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":"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":0,"reason":"Found 0/24 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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"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-24T13:05:11.648Z","repository_id":64303339,"created_at":"2025-08-24T13:05:11.648Z","updated_at":"2025-08-24T13:05:11.648Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31420789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","golang-library","identification","linux","networking","socket-programming"],"created_at":"2026-04-05T01:04:59.787Z","updated_at":"2026-04-05T01:04:59.860Z","avatar_url":"https://github.com/toolmanorg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# peercred [![Mit License][mit-img]][mit] [![GitHub Release][release-img]][release] [![GoDoc][godoc-img]][godoc] [![Go Report Card][reportcard-img]][reportcard] [![Build Status][travis-img]][travis]\n\n`import \"toolman.org/net/peercred\"`\n\n* [Install](#pkg-install)\n* [Overview](#pkg-overview)\n* [Index](#pkg-index)\n* [Subdirectories](#pkg-subdirectories)\n\n## \u003ca name=\"pkg-install\"\u003eInstall\u003c/a\u003e\n\n```sh\n    go get toolman.org/net/peercred\n```\n\n## \u003ca name=\"pkg-overview\"\u003eOverview\u003c/a\u003e\nPackage peercred provides a net.Listener implementation leveraging the Linux\nSO_PEERCRED socket option to acquire the PID, UID, and GID of the foreign\nprocess connected to each socket. According to the socket(7) manual,\n\n    This is possible only for connected AF_UNIX stream\n    sockets and AF_UNIX stream and datagram socket pairs\n    created using socketpair(2).\n\nTherefore, peercred.Listener only supports Unix domain sockets and IP\nconnections are not available.\n\npeercred.Listener is intended for use cases where a Unix domain server needs\nto reliably identify the process on the client side of each connection. By\nitself, peercred provides support for simple \"unix\" socket connections.\nAdditional support for gRPC over Unix domain sockets is available with the\nsubordinate package toolman.org/net/peercred/grpcpeer.\n\nA simple, unix-domain server can be written similar to the following:\n\n\t// Create a new Listener listening on socketName\n\tlsnr, err := peercred.Listen(ctx, socketName)\n\tif err != nil {\n\t    return err\n\t}\n\t\n\t// Wait for and accept an incoming connection\n\tconn, err := lsnr.AcceptPeerCred()\n\tif err != nil {\n\t    return err\n\t}\n\t\n\t// conn.Ucred has fields Pid, Uid and Gid\n\tfmt.Printf(\"Client PID=%d UID=%d\\n\", conn.Ucred.Pid, conn.Ucred.Uid)\n\n\n## \u003ca name=\"pkg-index\"\u003eIndex\u003c/a\u003e\n* [Constants](#pkg-constants)\n* [type Conn](#Conn)\n* [type Listener](#Listener)\n  * [func Listen(ctx context.Context, addr string) (*Listener, error)](#Listen)\n  * [func (pcl *Listener) Accept() (net.Conn, error)](#Listener.Accept)\n  * [func (pcl *Listener) AcceptPeerCred() (*Conn, error)](#Listener.AcceptPeerCred)\n\n\n#### \u003ca name=\"pkg-files\"\u003ePackage files\u003c/a\u003e\n[listener.go](/src/toolman.org/net/peercred/listener.go) \n\n\n## \u003ca name=\"pkg-constants\"\u003eConstants\u003c/a\u003e\n``` go\nconst ErrAddrInUse = unix.EADDRINUSE\n```\nErrAddrInUse is a convenience wrapper around the Posix errno value for\nEADDRINUSE.\n\n\n## \u003ca name=\"Conn\"\u003etype\u003c/a\u003e [Conn](/src/target/listener.go?s=4734:4791#L138)\n``` go\ntype Conn struct {\n    Ucred *unix.Ucred\n    net.Conn\n}\n\n```\nConn is a net.Conn containing the process credentials for the client\nside of a Unix domain socket connection.\n\n\n## \u003ca name=\"Listener\"\u003etype\u003c/a\u003e [Listener](/src/target/listener.go?s=2919:2965#L71)\n``` go\ntype Listener struct {\n    net.Listener\n}\n\n```\nListener is an implementation of net.Listener that extracts\nthe identity (i.e. pid, uid, gid) from the connection's client process.\nThis information is then made available through the Ucred member of\nthe *Conn returned by AcceptPeerCred or Accept (after a type\nassertion).\n\n\n### \u003ca name=\"Listen\"\u003efunc\u003c/a\u003e [Listen](/src/target/listener.go?s=3047:3116#L76)\n``` go\nfunc Listen(ctx context.Context, addr string) (*Listener, error)\n```\nListen returns a new Listener listening on the Unix domain socket addr.\n\n\n### \u003ca name=\"Listener.Accept\"\u003efunc\u003c/a\u003e (\\*Listener) [Accept](/src/target/listener.go?s=3657:3712#L93)\n``` go\nfunc (pcl *Listener) Accept() (net.Conn, error)\n```\nAccept is a convenience wrapper around AcceptPeerCred allowing\nListener callers that utilize net.Listener to function\nas expected. The returned net.Conn is a *Conn which may\nbe accessed through a type assertion. See AcceptPeerCred for\ndetails on possible error conditions.\n\nAccept contributes to implementing the  net.Listener interface.\n\n\n### \u003ca name=\"Listener.AcceptPeerCred\"\u003efunc\u003c/a\u003e (\\*Listener) [AcceptPeerCred](/src/target/listener.go?s=4020:4088#L101)\n``` go\nfunc (pcl *Listener) AcceptPeerCred() (*Conn, error)\n```\nAcceptPeerCred accepts a connection from the receiver's listener\nreturning a *Conn containing the process credentials for\nthe client. If the underlying Accept fails or if process credentials\ncannot be extracted, AcceptPeerCred returns nil and an error.\n\n\n[mit-img]: http://img.shields.io/badge/License-MIT-c41e3a.svg\n[mit]: https://github.com/toolmanorg/net-peercred/blob/master/LICENSE\n\n[release-img]: https://img.shields.io/github/release/toolmanorg/net-peercred/all.svg\n[release]: https://github.com/toolmanorg/net-peercred/releases\n\n[godoc-img]: https://godoc.org/toolman.org/net/peercred?status.svg\n[godoc]: https://godoc.org/toolman.org/net/peercred\n\n[reportcard-img]: https://goreportcard.com/badge/toolman.org/net/peercred\n[reportcard]: https://goreportcard.com/report/toolman.org/net/peercred\n\n[travis-img]: https://travis-ci.org/toolmanorg/net-peercred.svg?branch=master\n[travis]: https://travis-ci.org/toolmanorg/net-peercred\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoolmanorg%2Fnet-peercred","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoolmanorg%2Fnet-peercred","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoolmanorg%2Fnet-peercred/lists"}