{"id":26116160,"url":"https://github.com/dbudwin/react-secure-link","last_synced_at":"2025-08-25T14:04:36.235Z","repository":{"id":39760934,"uuid":"323644538","full_name":"dbudwin/react-secure-link","owner":"dbudwin","description":"A React component to avoid a security exploit when opening a link in a new tab.","archived":false,"fork":false,"pushed_at":"2023-11-22T02:56:52.000Z","size":638,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-09T14:50:04.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/dbudwin.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-12-22T14:11:26.000Z","updated_at":"2025-07-24T19:54:44.000Z","dependencies_parsed_at":"2023-02-16T14:15:50.049Z","dependency_job_id":"b43fdc8c-32e8-43fd-b68b-b1f6d4ee597f","html_url":"https://github.com/dbudwin/react-secure-link","commit_stats":{"total_commits":26,"total_committers":3,"mean_commits":8.666666666666666,"dds":"0.34615384615384615","last_synced_commit":"84df4d80206f8ab2d40d21f5b4c11f9f69f745a3"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/dbudwin/react-secure-link","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbudwin%2Freact-secure-link","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbudwin%2Freact-secure-link/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbudwin%2Freact-secure-link/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbudwin%2Freact-secure-link/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbudwin","download_url":"https://codeload.github.com/dbudwin/react-secure-link/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbudwin%2Freact-secure-link/sbom","scorecard":{"id":329331,"data":{"date":"2025-08-11","repo":{"name":"github.com/dbudwin/react-secure-link","commit":"c614fbb3fac70175a8212d9eac8b41878ccbf0bd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/13 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":"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":"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":"Token-Permissions","score":9,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: jobLevel 'checks' permission set to 'write': .github/workflows/pull_request_build.yml:10","Warn: no topLevel permission defined: .github/workflows/pull_request_build.yml:1"],"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":"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":"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":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pull_request_build.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/dbudwin/react-secure-link/pull_request_build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pull_request_build.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/dbudwin/react-secure-link/pull_request_build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull_request_build.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/dbudwin/react-secure-link/pull_request_build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull_request_build.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/dbudwin/react-secure-link/pull_request_build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull_request_build.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/dbudwin/react-secure-link/pull_request_build.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party 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":"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":"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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 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":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-prr3-c3m5-p7q2","Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-5w9c-rv96-fr7g","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"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-18T03:12:16.717Z","repository_id":39760934,"created_at":"2025-08-18T03:12:16.721Z","updated_at":"2025-08-18T03:12:16.721Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272077690,"owners_count":24869288,"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-08-25T02:00:12.092Z","response_time":1107,"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-03-10T08:26:44.473Z","updated_at":"2025-08-25T14:04:36.046Z","avatar_url":"https://github.com/dbudwin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-secure-link 🔗\n\n![Test](https://github.com/dbudwin/react-secure-link/workflows/Test/badge.svg?branch=main)\n[![Coverage Status](https://coveralls.io/repos/github/dbudwin/react-secure-link/badge.svg?branch=main)](https://coveralls.io/github/dbudwin/react-secure-link?branch=main)\n![npm](https://img.shields.io/npm/dw/react-secure-link)\n![GitHub](https://img.shields.io/github/license/dbudwin/react-secure-link)\n![npm bundle size](https://img.shields.io/bundlephobia/min/react-secure-link)\n![npm](https://img.shields.io/npm/v/react-secure-link)\n\nA TypeScript compatible React component to avoid security exploits when opening a link in a new tab.  `react-secure-link` is **lightweight** and has **zero dependencies**!\n\n## The Exploit 💥\n\nIt's possible when opening a link to a webpage in a new tab that the webpage in the new tab can hijack the webpage in the original tab via the `window.opener` property.  This is an easy, low-level exploit.  Here is how it can occur:\n\nA hacker knows they can leave links in comments on your webpage and that they will open in a new tab.  When a user to your website clicks that link, it will show them a seemingly harmless webpage.  This newly opened tab has access to the `window.opener` property which the hacker can exploit.  This webpage will use the `window.opener` property to run a little JavaScript like: `window.opener.location = \"https://www.some-malicious-website.com/login.html\"`.  This changes what webpage is opened in the original tab where the user clicked the link.  This is problematic if the hacker redirects the original tab to a webpage that _looks_ like the original.  The hacker could show a message like, \"You have been automatically logged out, log back in to continue.\"  Since the webpage _looks_ the same and the user knows they were just on the same webpage in that same tab, they'll trust the login form, but now their account has been compromised and they don't know it.  The hacker could then redirect back to the original webpage after the login form is submitted to further cover their tracks.\n\n## What is the `window.opener` Property?\n\nFrom [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/opener):\n\n\u003e The Window interface's opener property returns a reference to the window that opened the window, either with open(), or by navigating a link with a target attribute.\n\n## How Does `react-secure-link` Prevent this Exploit?\n\nUsing `react-secure-link` for outbound links prevents the new tab from having access to the `window.opener` property altogether.\n\n## Usage\n\n1. Add `react-secure-link` to your project via `npm install react-secure-link`\n2. Import the package: `import { SecureLink } from \"react-secure-link\";`\n3. Use the following for links you want to open in a new tab: `\u003cSecureLink href=\"https://www.npmjs.com/package/react-secure-link\"\u003ereact-secure-link on NPM\u003c/SecureLink\u003e`\n\n## CodeSandbox Examples\n\nThere are several examples of the various ways to use this package on CodeSandbox.\n\n[react-secure-link CodeSandbox Examples](https://codesandbox.io/s/react-seucre-link-examples-wzcwf)\n\n### API\n\n`SecureLink` can be used to make text, images, or other children components clickable.  In addition, standard `a` element attributes can be pass in as props (i.e. `href`, `className`, `id`, `role`, `style`).\n\n### Basic Usage Example\n\n```tsx\n\u003cSecureLink href=\"https://www.npmjs.com/package/react-secure-link\" /\u003e\n```\n\n### Advance Usage Example\n\n```tsx\n\u003cSecureLink\n    href=\"https://www.npmjs.com/package/react-secure-link\"\n    className=\"no-link-decoration\"\n    style={{ color: \"red\" }}\n    key={123}\n    onClick={() =\u003e console.log(\"Clicked\")}\n\u003e\n    react-secure-link on NPM\n\u003c/SecureLink\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbudwin%2Freact-secure-link","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbudwin%2Freact-secure-link","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbudwin%2Freact-secure-link/lists"}