Skip to content

Comments

Implement toast script#555

Open
codycooperross wants to merge 3 commits intomasterfrom
toast-test
Open

Implement toast script#555
codycooperross wants to merge 3 commits intomasterfrom
toast-test

Conversation

@codycooperross
Copy link
Contributor

@codycooperross codycooperross commented Jan 23, 2026

Purpose

closes: Add github issue that originated this PR

Approach

Open Questions and Pre-Merge TODOs

Learning

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

Summary by CodeRabbit

  • New Features
    • DataCite toast notifications added: an external, asynchronously loaded script now enables toast-style alerts in the UI.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

Walkthrough

Adds a new Script element (id "datacite-toasts", data-site="commons") to the main layout that loads an external Datacite toast_notifications.js. No application logic or control flow changes — only DOM expansion to include an additional third-party script.

Changes

Cohort / File(s) Summary
Layout Script Addition
src/app/(main)/layout.tsx
Adds a Script element (id: "datacite-toasts") referencing external Datacite toast_notifications.js with data-site="commons", alongside the existing feedback-button script.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Implement toast script' directly reflects the main change: adding a new Script element for Datacite toast notifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cypress
Copy link

cypress bot commented Jan 23, 2026

akita    Run #1850

Run Properties:  status check passed Passed #1850  •  git commit 7360e610ff ℹ️: Merge 124af3615504bf8fa02611ca270801048ed794a6 into 526b2bafa7612862b6a89d73b651...
Project akita
Branch Review toast-test
Run status status check passed Passed #1850
Run duration 01m 40s
Commit git commit 7360e610ff ℹ️: Merge 124af3615504bf8fa02611ca270801048ed794a6 into 526b2bafa7612862b6a89d73b651...
Committer codycooperross
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 47
View all changes introduced in this branch ↗︎

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/app/`(main)/layout.tsx:
- Around line 69-70: Replace the mutable gist raw URL used in the Script tag
with a safe, versioned, and integrity-checked source: stop loading from
"datacite_toast.js" via githack and instead serve a pinned copy from your
controlled assets (or a vetted CDN) and add an integrity attribute and a
Next/React Script "strategy" prop to control loading; locate the Script with id
"datacite-toasts" in layout.tsx, remove the external gist/raw URL, point src to
the internal/versioned asset (or a pinned CDN URL), compute and add the SRI hash
in integrity, and set an appropriate strategy (e.g., "lazyOnload" or
"afterInteractive") to match desired load timing before merging.

Comment on lines 69 to 70
<Script id="datacite-toasts" data-site="commons" src="https://gist.githack.com/codycooperross/6a895e0a6c7f9328d4c69ff349cfa670/raw/datacite_toast.js">
</Script>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Loading scripts from mutable Gist URLs poses a significant supply chain security risk.

This implementation has several serious concerns:

  1. Mutable content: The /raw/ URL serves the latest gist revision. The gist owner (or anyone who gains access) can modify the script at any time, and those changes would immediately execute in all users' browsers.

  2. No integrity verification: Without a Subresource Integrity (SRI) hash, there's no way to detect if the script has been tampered with.

  3. Unofficial CDN: githack.com explicitly warns it's not intended for production use and offers no uptime guarantees.

  4. PR title indicates "test CDN": If this is for testing, it should not be merged to master without a production-ready hosting solution.

Recommended approach:

  • Host the script on controlled infrastructure (e.g., your own CDN, npm package, or versioned asset in this repository)
  • If an external CDN is required, use a pinned version URL with an integrity attribute
  • Add a strategy prop to control script loading behavior
-      <Script id="datacite-toasts" data-site="commons" src="https://gist.githack.com/codycooperross/6a895e0a6c7f9328d4c69ff349cfa670/raw/datacite_toast.js">
-      </Script>
+      <Script
+        id="datacite-toasts"
+        data-site="commons"
+        src="https://your-cdn.example.com/datacite_toast@1.0.0.js"
+        integrity="sha384-<hash>"
+        strategy="afterInteractive"
+      />
🤖 Prompt for AI Agents
In `@src/app/`(main)/layout.tsx around lines 69 - 70, Replace the mutable gist raw
URL used in the Script tag with a safe, versioned, and integrity-checked source:
stop loading from "datacite_toast.js" via githack and instead serve a pinned
copy from your controlled assets (or a vetted CDN) and add an integrity
attribute and a Next/React Script "strategy" prop to control loading; locate the
Script with id "datacite-toasts" in layout.tsx, remove the external gist/raw
URL, point src to the internal/versioned asset (or a pinned CDN URL), compute
and add the SRI hash in integrity, and set an appropriate strategy (e.g.,
"lazyOnload" or "afterInteractive") to match desired load timing before merging.

@codycooperross codycooperross changed the title Implement toast script via test CDN Implement toast script Jan 28, 2026
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.

1 participant