Harden external link rel attributes#399
Conversation
Summary of ChangesHello @zz-plant, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on enhancing the security posture of external links by consistently applying the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly hardens external links by replacing rel="noreferrer" with rel="noopener noreferrer", which is a great security improvement. The changes are applied consistently across several files. My review focuses on a few instances where the accompanying target="_blank" attribute appears to be missing. For noopener to prevent tabnapping vulnerabilities, links must open in a new tab. I've added comments to highlight these cases and suggest adding the target attribute for full effectiveness and consistency. Overall, this is a valuable security enhancement for the project.
| href: "https://ethotechnics.com/studio", | ||
| variant: "primary", | ||
| rel: "noreferrer", | ||
| rel: "noopener noreferrer", |
There was a problem hiding this comment.
This link is external, so it's good practice to have it open in a new tab using target="_blank". This would also make the rel="noopener noreferrer" attribute fully effective against tabnapping. However, the ComparisonAction type currently doesn't include a target property. Please consider updating the type to support target?: string and then adding target: "_blank" to this object.
| rel={ | ||
| action.href.startsWith("http") | ||
| ? "noopener noreferrer" | ||
| : undefined | ||
| } |
There was a problem hiding this comment.
| rel={ | ||
| action.href.startsWith("http") | ||
| ? "noopener noreferrer" | ||
| : undefined | ||
| } |
There was a problem hiding this comment.
| href={studio.ctaHref} | ||
| aria-label={studio.ctaAriaLabel} | ||
| rel="noreferrer" | ||
| rel="noopener noreferrer" |
Motivation
target="_blank"by ensuringrelincludesnoopenerin addition tonoreferrer.Description
rel="noreferrer"withrel="noopener noreferrer"across shared navigation, utility links, layout footer links, and page CTAs (src/layouts/BaseLayout.astro,src/components/NavUtilityLinks.astro,src/content/navigation.ts,src/content/comparison.ts,src/pages/start-here/index.astro,src/pages/participate/index.astro).docs/local-development.md(remove extra whitespace betweenLocaland URL).relattributes and the docs text correction.Testing
bun run check, which executes lint, unit tests, TypeScript checks,astro:check, and JSON/glossary validators, and the command completed successfully.bun testresults showed14 pass,3 skip,0 fail(all tests passed); JSON and glossary validations succeeded.astro:checkand TypeScript runs reported non-blocking hints and deprecation warnings (inline-script hints and some TS deprecation notices), but no errors blocked the change.Codex Task