{"id":24133208,"url":"https://github.com/programmarchy/pg-ssl","last_synced_at":"2026-05-01T21:02:22.945Z","repository":{"id":142566083,"uuid":"263169589","full_name":"programmarchy/pg-ssl","owner":"programmarchy","description":"A function to parse libpq-style environment variables for node-postgres ssl configuration","archived":false,"fork":false,"pushed_at":"2020-05-11T22:14:25.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-31T12:25:13.536Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/programmarchy.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-05-11T22:08:26.000Z","updated_at":"2020-05-11T22:14:27.000Z","dependencies_parsed_at":"2023-06-19T06:07:13.896Z","dependency_job_id":null,"html_url":"https://github.com/programmarchy/pg-ssl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/programmarchy/pg-ssl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/programmarchy%2Fpg-ssl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/programmarchy%2Fpg-ssl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/programmarchy%2Fpg-ssl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/programmarchy%2Fpg-ssl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/programmarchy","download_url":"https://codeload.github.com/programmarchy/pg-ssl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/programmarchy%2Fpg-ssl/sbom","scorecard":{"id":746166,"data":{"date":"2025-08-11","repo":{"name":"github.com/programmarchy/pg-ssl","commit":"df8ea518f0ebf62e683dadd6355780d977a6ae8b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":-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":"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":"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":"Code-Review","score":0,"reason":"Found 0/2 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":"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":"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":"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"}},{"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 '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"}}]},"last_synced_at":"2025-08-22T18:48:39.972Z","repository_id":142566083,"created_at":"2025-08-22T18:48:39.972Z","updated_at":"2025-08-22T18:48:39.972Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32512670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":[],"created_at":"2025-01-11T23:21:52.171Z","updated_at":"2026-05-01T21:02:22.925Z","avatar_url":"https://github.com/programmarchy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"pg-ssl\n======\n\nA function to parse libpq-style environment variables for node-postgres ssl configuration\n\n## Usage\n\n```\nconst { Pool } = require('pg')\nconst { parseSsl } = require('pg-ssl')\n\nconst pool = new Pool({\n    ssl: parseSsl()\n})\n```\n\nThe resulting config contains the following properties:\n\n- `ca` - contents of a SSL certificate authority (CA) certificate file if specified by `PGSSLROOTCERT`\n- `cert` - contents of a client SSL certificate if specified by `PGSSLCERT`\n- `key` - contents of the secret key used for the client SSL certificate if specified by `PGSSLKEY`\n- `rejectUnauthorized` - defaults to true\n\n## Why?\n\nAlthough [node-postgres](https://github.com/brianc/node-postgres) supports environment variables like `PGHOST`, `PGUSER`, and `PGPASSWORD` that match the ones defined by [libpq](https://www.postgresql.org/docs/11/libpq-envars.html) it doesn't support SSL-related environment variables like `PGSSLMODE`, `PGSSLCERT`, `PGSSLKEY`, or `PGSSLROOTCERT`. These are useful, especially if you're connecting to cloud SQL databases requiring these parameters for a secure connection.\n\nThe `parseSsl` function looks to these environment variables to build an object that maps to the options for [tls.connect](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback), including support for `rejectUnauthorized`, `checkServerIdentity` and `servername`.\n\nIf you are getting an error message like `UNABLE_TO_VERIFY_LEAF_SIGNATURE` when connecting to your database, then this module can help you correctly set up your SSL parameters for node postgres.\n\n## Options\n\nUse options to override environment variables or specify custom options.\n\n- `sslmode` - If set to `disabled`, returns `false`. Otherwise, try to parse other options. Defaults to `PGSSLMODE`.\n- `sslrootcert` - The path to the root SSL certificate. Defaults to `PGSSLROOTCERT`.\n- `sslcert` - The path to the client SSL certificate. Defaults to `PGSSLCERT`.\n- `sslkey` - The path to the secret key for the client SSL certificate. Defaults to `PGSSLKEY`.\n- `rejectUnauthorized` - If not `false`, the server certificate is verified against the supplied CAs. See [tls.connect](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback). Defaults to `true`.\n- `servername` - Server name for the SNI (Server Name Indication) TLS extension. See [tls.connect](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).\n- `checkServerIdentity` - A callback function to be used (instead of the built-in one) when checking the server's host name against the certificate. See [tls.connect](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).\n\n## More Examples\n\nFor a Google Cloud SQL connection specify the [servername](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) using the project ID `my-project` and the instance ID `my-sql-instance` to match the name specified by the client certificate, otherwise you'll receive `NODE_TLS_REJECT_UNAUTHORIZED`. Your environment would look like:\n\n```\nPGHOST=38.X.X.X\nPGPORT=5432\nPGUSER=my_user\nPGPASSWORD=MyP@ssw0rd!\nPGDATABASE=my_db\nPGSSLMODE=verify-ca\nPGSSLROOTCERT=/path/to/server-ca.pem\nPGSSLCERT=/path/to/client-cert.pem\nPGSSLKEY=/path/to/client-key.pem\n```\n\nAnd your Postgres would look like:\n\n```\nconst pool = new Pool({\n    ssl: parseSsl({\n        servername: 'my-project/my-sql-instance'\n    })\n})\n```\n\n## Additional Details\n\nIf the `sslmode` option or `PGSSLMODE` environment variable is set to disabled, then `parseSsl` returns `false`.\n\nLikewise, if neither `sslrootcert`/`PGSSLROOTCERT`, `sslcert`/`PGSSLCERT`, or `sslkey`/`PGSSLKEY` are specified, then `parseSsl` will return `false`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogrammarchy%2Fpg-ssl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprogrammarchy%2Fpg-ssl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogrammarchy%2Fpg-ssl/lists"}