Skip to content

🔒 Fix broken CompanyUrl link and improve security attributes - #22

Open
SmolSoftBoi wants to merge 2 commits into
mainfrom
fix-company-url-link-security-5361912156639603957
Open

🔒 Fix broken CompanyUrl link and improve security attributes#22
SmolSoftBoi wants to merge 2 commits into
mainfrom
fix-company-url-link-security-5361912156639603957

Conversation

@SmolSoftBoi

@SmolSoftBoi SmolSoftBoi commented May 5, 2026

Copy link
Copy Markdown
Owner

🎯 What: The href attribute of the CompanyUrl link in SDSComXSL.xsl was hardcoded to the string "CompanyUrl", rendering the link broken. This PR fixes the link to use the dynamic value from the XML and adds rel="noopener noreferrer" for enhanced security.

⚠️ Risk: A broken link degrades user experience by preventing access to the supplier's website. Furthermore, using target="_blank" without rel="noopener noreferrer" exposes users to potential tabnabbing attacks, where a malicious linked site could gain control over the original tab.

🛡️ Solution:

  • Updated the href attribute to {CompanyUrl} using XSLT attribute value templates.
  • Added rel="noopener noreferrer" to the <a> tag to follow security best practices for external links.

PR created automatically by Jules for task 5361912156639603957 started by @SmolSoftBoi

Summary by Sourcery

Fix the supplier website link in SDSComXSL to use the dynamic CompanyUrl value and harden the external link with appropriate security attributes.

Bug Fixes:

  • Correct the CompanyUrl anchor to use the actual CompanyUrl value instead of a hardcoded placeholder string.

Enhancements:

  • Add rel="noopener noreferrer" to the external CompanyUrl link to follow security best practices.

- Use attribute value template `{CompanyUrl}` for href to make the link dynamic.
- Add `rel="noopener noreferrer"` to the link with `target="_blank"` to mitigate tabnabbing risks.

Co-authored-by: SmolSoftBoi <491681+SmolSoftBoi@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 14:14
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector

This comment was marked as low quality.

@sourcery-ai

sourcery-ai Bot commented May 5, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fixes the broken CompanyUrl hyperlink in the SDSCom XSLT template and hardens the anchor tag against tabnabbing by adding appropriate security attributes.

File-Level Changes

Change Details Files
Correct the CompanyUrl anchor to use the dynamic XML value and add security attributes for external links.
  • Replace hardcoded href string with an XSLT attribute value template referencing CompanyUrl
  • Add rel="noopener noreferrer" to the external link that uses target="_blank"
SDSComXSL.xsl

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

This comment was marked as low quality.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider normalizing or validating CompanyUrl (e.g., ensuring it has a proper scheme like https:// and no dangerous protocols) before using it in href to avoid generating unusable or unsafe links.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider normalizing or validating `CompanyUrl` (e.g., ensuring it has a proper scheme like `https://` and no dangerous protocols) before using it in `href` to avoid generating unusable or unsafe links.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the rendered “Company URL” anchor in the main SDSComXSL.xsl transform so it actually links to the company URL value from the input XML, and hardens the external link against tabnabbing when opened in a new tab.

Changes:

  • Updated the <a> tag href from a hardcoded string to an XSLT attribute value template that uses the XML CompanyUrl value.
  • Added rel="noopener noreferrer" alongside target="_blank" for safer external link behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@charliecreates charliecreates Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-blocking feedback (1)
  1. Validate and normalize CompanyUrl before writing it into hrefSDSComXSL.xsl#L402
    This change correctly fixes the hardcoded href, but it now emits any incoming URI scheme as-is. If a feed includes javascript:/data: (or a scheme-less value like example.com), the rendered link can be unsafe or still broken.
    Consider normalizing with normalize-space() and allowing only http/https (optionally prepending https:// for scheme-less hostnames) before setting href.

If you want Charlie to apply fixes, reply with the item number (for example: please fix 1).

- Use attribute value template `{CompanyUrl}` for href in `SDSComXSL.xsl`.
- Add `rel="noopener noreferrer"` to the link with `target="_blank"`.
- Update GitHub Actions workflow to use `v4` actions and `yarn` cache.

Co-authored-by: SmolSoftBoi <491681+SmolSoftBoi@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@SDSComXSL.xsl`:
- Line 402: The current anchor writes CompanyUrl directly into href which allows
harmful schemes; change the template around the <a href="{CompanyUrl}"> and
xsl:value-of select="CompanyUrl" to validate and only emit the href when
CompanyUrl begins with a safe scheme (allow-list http:// and https://).
Implement an XSLT conditional (xsl:choose/xsl:when or matches()/starts-with
checks) that tests CompanyUrl for ^https?:// and only sets href="{CompanyUrl}"
when it passes; otherwise render the CompanyUrl as plain text (or omit the link)
to avoid emitting javascript: or other unsafe schemes. Ensure you update the
same element where xsl:value-of select="CompanyUrl" is used so displayed text
remains but the clickable link is only created for validated URLs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ae173db6-b5db-4dc3-8323-d2280c7f95a8

📥 Commits

Reviewing files that changed from the base of the PR and between e33d34f and 6a8cd79.

📒 Files selected for processing (2)
  • .github/workflows/node.js.yml
  • SDSComXSL.xsl
📜 Review details
🔇 Additional comments (1)
.github/workflows/node.js.yml (1)

23-29: Good CI alignment and action upgrades.

Using @v4 actions and switching cache to yarn at Lines 23, 25, and 28 is consistent with the install/build/test steps and improves workflow hygiene.

Comment thread SDSComXSL.xsl
</dt>
<dd class="col-8">
<a href="CompanyUrl" target="_blank"><xsl:value-of select="CompanyUrl"/></a>
<a href="{CompanyUrl}" target="_blank" rel="noopener noreferrer"><xsl:value-of select="CompanyUrl"/></a>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Validate CompanyUrl before writing it into href.

Line 402 now trusts input directly in href; a crafted value like javascript:... would create an executable link in the rendered HTML. Please allow-list safe schemes (for example http:// and https://) before emitting an <a>.

Suggested fix
-                                    <a href="{CompanyUrl}" target="_blank" rel="noopener noreferrer"><xsl:value-of select="CompanyUrl"/></a>
+                                    <xsl:variable name="companyUrl" select="normalize-space(CompanyUrl)"/>
+                                    <xsl:variable name="companyUrlLower" select="lower-case($companyUrl)"/>
+                                    <xsl:choose>
+                                        <xsl:when test="starts-with($companyUrlLower, 'http://') or starts-with($companyUrlLower, 'https://')">
+                                            <a href="{$companyUrl}" target="_blank" rel="noopener noreferrer">
+                                                <xsl:value-of select="$companyUrl"/>
+                                            </a>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                            <xsl:value-of select="$companyUrl"/>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@SDSComXSL.xsl` at line 402, The current anchor writes CompanyUrl directly
into href which allows harmful schemes; change the template around the <a
href="{CompanyUrl}"> and xsl:value-of select="CompanyUrl" to validate and only
emit the href when CompanyUrl begins with a safe scheme (allow-list http:// and
https://). Implement an XSLT conditional (xsl:choose/xsl:when or
matches()/starts-with checks) that tests CompanyUrl for ^https?:// and only sets
href="{CompanyUrl}" when it passes; otherwise render the CompanyUrl as plain
text (or omit the link) to avoid emitting javascript: or other unsafe schemes.
Ensure you update the same element where xsl:value-of select="CompanyUrl" is
used so displayed text remains but the clickable link is only created for
validated URLs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants