Skip to content

Harden external link rel attributes#399

Merged
zz-plant merged 1 commit into
mainfrom
codex/locate-and-fix-issues-in-repo-iq3t0w
Jan 14, 2026
Merged

Harden external link rel attributes#399
zz-plant merged 1 commit into
mainfrom
codex/locate-and-fix-issues-in-repo-iq3t0w

Conversation

@zz-plant

Copy link
Copy Markdown
Owner

Motivation

  • Prevent potential reverse-tabnapping and improve security for external links opened with target="_blank" by ensuring rel includes noopener in addition to noreferrer.
  • Clean up a minor docs formatting nit in the local dev server log example.

Description

  • Replace rel="noreferrer" with rel="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).
  • Tighten spacing in the local dev server log example string in docs/local-development.md (remove extra whitespace between Local and URL).
  • Keep behavior unchanged aside from the hardened rel attributes and the docs text correction.

Testing

  • Ran bun run check, which executes lint, unit tests, TypeScript checks, astro:check, and JSON/glossary validators, and the command completed successfully.
  • Unit/component tests: bun test results showed 14 pass, 3 skip, 0 fail (all tests passed); JSON and glossary validations succeeded.
  • astro:check and 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

@zz-plant zz-plant merged commit 1b6185f into main Jan 14, 2026
1 of 2 checks passed
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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 noopener attribute to prevent potential reverse-tabnapping attacks. This change is propagated across shared navigation, utility links, layout footer links, and page CTAs. Additionally, it includes a small but precise correction to a log message example in the local development documentation, improving clarity.

Highlights

  • Security Enhancement: Implemented noopener alongside noreferrer for external links opened in new tabs (target="_blank") to mitigate reverse-tabnapping vulnerabilities across various components and content files.
  • Documentation Fix: Corrected a minor formatting inconsistency by removing an extra space in the local development server log example within docs/local-development.md.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/content/comparison.ts
href: "https://ethotechnics.com/studio",
variant: "primary",
rel: "noreferrer",
rel: "noopener noreferrer",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Comment on lines +93 to +97
rel={
action.href.startsWith("http")
? "noopener noreferrer"
: undefined
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While adding noopener noreferrer is correct, this link appears to be missing a target="_blank" attribute. For the noopener value to be effective against tabnapping, the link must open in a new tab. Please consider adding target={action.href.startsWith("http") ? "_blank" : undefined} to the <a> tag.

Comment on lines +185 to +189
rel={
action.href.startsWith("http")
? "noopener noreferrer"
: undefined
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the other link on this page, this one is also missing a target="_blank" attribute. For the noopener value to be effective against tabnapping, the link must open in a new tab. Please consider adding target={action.href.startsWith("http") ? "_blank" : undefined} to the <a> tag.

href={studio.ctaHref}
aria-label={studio.ctaAriaLabel}
rel="noreferrer"
rel="noopener noreferrer"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The aria-label for this link is "Open ethotechnics.com/studio in a new tab...", which implies target="_blank" is intended. To match this behavior and for rel="noopener noreferrer" to be effective, please add target="_blank" to this <a> tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant