Skip to content

Security Audit and fixes#1716

Merged
kotAPI merged 6 commits into
mainfrom
kotapi/security-fixes-mar-30
Mar 30, 2026
Merged

Security Audit and fixes#1716
kotAPI merged 6 commits into
mainfrom
kotapi/security-fixes-mar-30

Conversation

@kotAPI

@kotAPI kotAPI commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR applies the current security dependency updates and fixes the regressions introduced by those upgrades so the repo remains buildable and testable.

What Changed

  • updated root and docs dependencies/lockfiles for the security fixes
  • kept root ESLint scoped to the library and excluded docs/
  • migrated docs/ to its own flat ESLint config for the newer Next/ESLint stack
  • updated docs cookie handling away from the removed cookie deps
  • fixed the root Slider story type regression introduced during verification
  • adapted docs MDX pages for Next 16 by moving page content into content.mdx and keeping metadata in page.tsx

Verification

  • npm test -- --ci
  • npm run lint
  • npm run check:types
  • npm run check:exports
  • npm run build:rollup
  • npm run build-storybook
  • cd docs && npm run lint
  • cd docs && npm run build

Notes

  • root lint still reports existing warnings, but no errors
  • there are unrelated local unstaged edits in Toolbar/Combobox files that are not part of this PR

Summary by CodeRabbit

  • New Features

    • Toolbar component is now available as a standalone export.
  • Chores

    • Updated ESLint configuration with improved ignore patterns.
    • Refactored documentation page structure for better organization.
    • Upgraded dependencies including Next.js, Storybook, and TypeScript tooling.
    • Enhanced theme preference cookie handling.

@changeset-bot

changeset-bot Bot commented Mar 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 17f7b7f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f018fde-29c7-4301-b2ad-6882309696d0

📥 Commits

Reviewing files that changed from the base of the PR and between 925168b and 17f7b7f.

📒 Files selected for processing (3)
  • docs/components/Main/NavBar/helpers/NavRoot/index.tsx
  • docs/components/navigation/Navigation.tsx
  • package.json
✅ Files skipped from review due to trivial changes (1)
  • docs/components/navigation/Navigation.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/components/Main/NavBar/helpers/NavRoot/index.tsx
  • package.json

📝 Walkthrough

Walkthrough

This pull request systematically restructures documentation metadata handling by removing metadata exports from MDX content files and adding corresponding Next.js page modules that import and re-export metadata. It also refactors theme cookie management from nookies to js-cookie, simplifies navigation state handling, updates build configurations, and bumps multiple dependencies across the project.

Changes

Cohort / File(s) Summary
ESLint Configuration
.eslintrc.cjs, docs/.eslintrc.json, docs/eslint.config.mjs
Root ESLint config adds ignorePatterns for docs folder; docs-specific ESLint config file removed and replaced with new eslint.config.mjs following flat config format with rule overrides.
Documentation Metadata Restructuring – Components
docs/app/docs/components/*/content.mdx (30+ files), docs/app/docs/components/*/page.tsx (30+ files)
Systematic migration removes metadata exports from MDX content files and adds new page modules that import SEO metadata from ./seo and export it for framework use. Affects accordion, alert-dialog, aspect-ratio, avatar, avatar-group, badge, blockquote, button, callout, card, code, dialog, em, heading, kbd, progress, separator, strong, switch, table, tabs, text, toggle, toggle-group, tooltip, and visually-hidden.
Documentation Metadata Restructuring – Contributing & First Steps
docs/app/docs/contributing/*/content.mdx, docs/app/docs/contributing/*/page.tsx, docs/app/docs/first-steps/*/content.mdx, docs/app/docs/first-steps/*/page.tsx, docs/app/docs/guides/*/content.mdx, docs/app/docs/guides/*/page.tsx
Same metadata migration pattern applied to contributing, first-steps, and guides documentation sections (before-you-start, component-coverage, component-maturity-rubric, contributing-to-rad-ui, setting-up-dev-environment, installation, introduction, usage, accessibility).
Theme & Cookie Management
docs/components/Main/Main.js, docs/components/Main/NavBar/index.js, docs/components/Main/NavBar/helpers/NavRoot/index.tsx
Replaced nookies-based cookie handling with js-cookie; updated NavBar props from cookies/setCookie to single setThemeCookie function; adjusted cookie write options from maxAge to expires format.
Navigation Component Simplification
docs/components/navigation/Navigation.tsx
Removed useState and useEffect hooks; sections now computed as derived value using regex-based pathname check rather than synchronized state.
Build & Configuration
docs/next.config.js, docs/package.json, docs/tsconfig.json
Next.js config removes eslint.ignoreDuringBuilds and adds turbopack root scoping; build script switches to webpack bundler; lint script changes from Next wrapper to direct eslint execution; JSX transform updated to react-jsx; dependencies bumped (Next.js, ESLint, postcss); nookies and next-cookies removed; package overrides expanded.
Root Package Exports & Dependencies
package.json
Added ./Toolbar subpath export (ESM, CJS, TypeScript types); expanded lint-staged configuration; bumped devDependency versions (Babel, Rollup plugins, Storybook, TypeScript-ESLint, ESLint, postcss, Storybook, tsx).
Slider Story Handler
src/components/ui/Slider/stories/Slider.stories.tsx
ControlledSlider's onValueChange handler now normalizes array input to single value (first element or 0 default) before setting state.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly related PRs

Suggested labels

dependencies, documentation

Suggested reviewers

  • GoldGroove06

Poem

🐰 Cookies swapped and metadata moved,
From nookies to js-cookie's groove,
Pages now shepherd their SEO fate,
Navigation paths derive, don't wait,
Build rules refined, the docs elate! ✨

🚥 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 "Security Audit and fixes" is clearly related to the main purpose of the PR, which applies security dependency updates and fixes regressions. However, it is somewhat generic and does not capture the full scope of the refactoring work (ESLint migration, cookie handling changes, Next 16 compatibility).

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kotapi/security-fixes-mar-30

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🧹 Nitpick comments (4)
docs/app/docs/components/toggle-group/page.tsx (1)

1-8: Clean Next.js App Router migration pattern!

This file correctly implements the Next.js 13+ App Router pattern for separating metadata and content. The structure is clean and follows conventions properly.

Optional: Add explicit type annotations for enhanced type safety

While TypeScript's inference handles this well, you could optionally add explicit types:

+import type { Metadata } from 'next'
 import toggleGroupMetadata from './seo'
 import Content from './content.mdx'

-export const metadata = toggleGroupMetadata
+export const metadata: Metadata = toggleGroupMetadata

-export default function Page() {
+export default function Page(): JSX.Element {
   return <Content />
 }

This is purely a nice-to-have improvement for explicitness.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/app/docs/components/toggle-group/page.tsx` around lines 1 - 8, This file
is fine as-is; keep the current export of metadata from toggleGroupMetadata and
the default Page component returning <Content />; if you want the optional
type-safety improvement, add explicit type annotations by typing the exported
metadata (e.g., declare metadata: Metadata = toggleGroupMetadata) and annotate
the Page component signature (e.g., function Page(): JSX.Element) while leaving
Content and toggleGroupMetadata usage unchanged.
docs/app/docs/components/badge/page.tsx (1)

4-4: Consider adding explicit type annotations.

While TypeScript can infer the types, adding explicit annotations would improve type safety and developer experience:

📘 Optional type annotations
+import type { Metadata } from 'next'
+
 import badgeMetadata from './seo'
 import Content from './content.mdx'

-export const metadata = badgeMetadata
+export const metadata: Metadata = badgeMetadata

-export default function Page() {
+export default function Page(): JSX.Element {
   return <Content />
 }

Also applies to: 6-8

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/app/docs/components/badge/page.tsx` at line 4, The exported const
metadata currently lacks an explicit type annotation (it is set to
badgeMetadata); add a specific type annotation (e.g., import and use the
appropriate Metadata type) and annotate the export as export const metadata:
Metadata = badgeMetadata; also apply the same explicit type annotations to the
other exports mentioned (lines 6–8) so each exported symbol has a clear declared
type.
docs/app/docs/components/strong/page.tsx (1)

4-4: Optional: Add explicit type annotation for metadata.

Consider importing and using the Metadata type from Next.js for better type safety and self-documentation.

📝 Optional type safety improvement
+import type { Metadata } from 'next'
 import strongMetadata from './seo'
 import Content from './content.mdx'
 
-export const metadata = strongMetadata
+export const metadata: Metadata = strongMetadata
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/app/docs/components/strong/page.tsx` at line 4, Annotate the exported
metadata with Next.js's Metadata type: import the Metadata type from 'next' and
change the export to explicitly type the symbol metadata (e.g., export const
metadata: Metadata = strongMetadata) so the exported metadata is statically
typed while still assigning the existing strongMetadata value.
docs/tsconfig.json (1)

36-40: Consider cleaning up explicit .js file includes.

These specific .js file paths in the include array appear to be legacy entries. With "allowJs": true and "**/*.ts", "**/*.tsx" globs already present, these explicit includes are likely redundant unless they serve a specific purpose for type checking isolated JavaScript files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/tsconfig.json` around lines 36 - 40, The tsconfig include array contains
explicit .js entries ("app/docs/first-steps/installation/page.js",
"app/docs/first-steps/introduction/page.js", "app/layout.js",
"app/docs/first-steps/usage/page.js", "app/docsv2/page.mdx") that are likely
redundant given "allowJs": true and the existing "**/*.ts"/"**/*.tsx" globs;
remove these explicit .js/.mdx paths from the include array (or replace them
with a broader glob like "**/*.{js,jsx,mdx}" if you intentionally need to
type-check isolated JS/MDX files) so tsconfig only includes the intended file
patterns, and verify no tests or build steps relied on those explicit entries
after the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/components/Main/NavBar/helpers/NavRoot/index.tsx`:
- Around line 135-138: The cookie-setting call using setThemeCookie('darkMode',
String(toggledState), { maxAge: 30 * 24 * 60 * 60, path: '/' }) is using an
unsupported js-cookie option; replace the maxAge option with expires (in days)
so the dark-mode cookie persists across sessions—e.g., set expires: 30 and keep
path: '/' and the same name/value; update the setThemeCookie invocation (and any
related helper wrapper) to use expires instead of maxAge.

In `@docs/components/navigation/Navigation.tsx`:
- Line 29: The current check for docs routes uses pathname.includes("/docs/")
which produces false positives (e.g., "/foo/docs/bar"); update the logic that
sets sections (the assignment using pathname, docsSections, defaultSections) to
use a stricter root-prefix check such as pathname.startsWith("/docs/") or a
regex like /^\/docs(\/|$)/ so only routes that begin with "/docs" select
docsSections; modify the expression that computes sections accordingly.

In `@package.json`:
- Around line 214-216: The lint-staged glob pattern "/*.{js,jsx,ts,tsx}" wrongly
starts with a slash so it won't match staged root-level files; update the
lint-staged config to remove the leading slash (change "/*.{js,jsx,ts,tsx}" to
"*.{js,jsx,ts,tsx}") so ESLint --fix runs on root JS/TS files, and verify the
pattern is used where lint-staged entries are defined.

---

Nitpick comments:
In `@docs/app/docs/components/badge/page.tsx`:
- Line 4: The exported const metadata currently lacks an explicit type
annotation (it is set to badgeMetadata); add a specific type annotation (e.g.,
import and use the appropriate Metadata type) and annotate the export as export
const metadata: Metadata = badgeMetadata; also apply the same explicit type
annotations to the other exports mentioned (lines 6–8) so each exported symbol
has a clear declared type.

In `@docs/app/docs/components/strong/page.tsx`:
- Line 4: Annotate the exported metadata with Next.js's Metadata type: import
the Metadata type from 'next' and change the export to explicitly type the
symbol metadata (e.g., export const metadata: Metadata = strongMetadata) so the
exported metadata is statically typed while still assigning the existing
strongMetadata value.

In `@docs/app/docs/components/toggle-group/page.tsx`:
- Around line 1-8: This file is fine as-is; keep the current export of metadata
from toggleGroupMetadata and the default Page component returning <Content />;
if you want the optional type-safety improvement, add explicit type annotations
by typing the exported metadata (e.g., declare metadata: Metadata =
toggleGroupMetadata) and annotate the Page component signature (e.g., function
Page(): JSX.Element) while leaving Content and toggleGroupMetadata usage
unchanged.

In `@docs/tsconfig.json`:
- Around line 36-40: The tsconfig include array contains explicit .js entries
("app/docs/first-steps/installation/page.js",
"app/docs/first-steps/introduction/page.js", "app/layout.js",
"app/docs/first-steps/usage/page.js", "app/docsv2/page.mdx") that are likely
redundant given "allowJs": true and the existing "**/*.ts"/"**/*.tsx" globs;
remove these explicit .js/.mdx paths from the include array (or replace them
with a broader glob like "**/*.{js,jsx,mdx}" if you intentionally need to
type-check isolated JS/MDX files) so tsconfig only includes the intended file
patterns, and verify no tests or build steps relied on those explicit entries
after the change.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 268d4a4d-d46e-4c50-b627-55db6973dbdb

📥 Commits

Reviewing files that changed from the base of the PR and between ab8b028 and d1eb05b.

⛔ Files ignored due to path filters (3)
  • docs/package-lock.json is excluded by !**/package-lock.json
  • docs/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (84)
  • .eslintrc.cjs
  • docs/.eslintrc.json
  • docs/app/docs/components/accordion/content.mdx
  • docs/app/docs/components/accordion/page.tsx
  • docs/app/docs/components/alert-dialog/content.mdx
  • docs/app/docs/components/alert-dialog/page.tsx
  • docs/app/docs/components/aspect-ratio/content.mdx
  • docs/app/docs/components/aspect-ratio/page.tsx
  • docs/app/docs/components/avatar-group/content.mdx
  • docs/app/docs/components/avatar-group/page.tsx
  • docs/app/docs/components/avatar/content.mdx
  • docs/app/docs/components/avatar/page.tsx
  • docs/app/docs/components/badge/content.mdx
  • docs/app/docs/components/badge/page.tsx
  • docs/app/docs/components/blockquote/content.mdx
  • docs/app/docs/components/blockquote/page.tsx
  • docs/app/docs/components/button/content.mdx
  • docs/app/docs/components/button/page.tsx
  • docs/app/docs/components/callout/content.mdx
  • docs/app/docs/components/callout/page.tsx
  • docs/app/docs/components/card/content.mdx
  • docs/app/docs/components/card/page.tsx
  • docs/app/docs/components/code/content.mdx
  • docs/app/docs/components/code/page.tsx
  • docs/app/docs/components/dialog/content.mdx
  • docs/app/docs/components/dialog/page.tsx
  • docs/app/docs/components/em/content.mdx
  • docs/app/docs/components/em/page.tsx
  • docs/app/docs/components/heading/content.mdx
  • docs/app/docs/components/heading/page.tsx
  • docs/app/docs/components/kbd/content.mdx
  • docs/app/docs/components/kbd/page.tsx
  • docs/app/docs/components/progress/content.mdx
  • docs/app/docs/components/progress/page.tsx
  • docs/app/docs/components/separator/content.mdx
  • docs/app/docs/components/separator/page.tsx
  • docs/app/docs/components/strong/content.mdx
  • docs/app/docs/components/strong/page.tsx
  • docs/app/docs/components/switch/content.mdx
  • docs/app/docs/components/switch/page.tsx
  • docs/app/docs/components/table/content.mdx
  • docs/app/docs/components/table/page.tsx
  • docs/app/docs/components/tabs/content.mdx
  • docs/app/docs/components/tabs/page.tsx
  • docs/app/docs/components/text/content.mdx
  • docs/app/docs/components/text/page.tsx
  • docs/app/docs/components/toggle-group/content.mdx
  • docs/app/docs/components/toggle-group/page.tsx
  • docs/app/docs/components/toggle/content.mdx
  • docs/app/docs/components/toggle/page.tsx
  • docs/app/docs/components/tooltip/content.mdx
  • docs/app/docs/components/tooltip/page.tsx
  • docs/app/docs/components/visually-hidden/content.mdx
  • docs/app/docs/components/visually-hidden/page.tsx
  • docs/app/docs/contributing/before-you-start/content.mdx
  • docs/app/docs/contributing/before-you-start/page.tsx
  • docs/app/docs/contributing/component-coverage/content.mdx
  • docs/app/docs/contributing/component-coverage/page.tsx
  • docs/app/docs/contributing/component-maturity-rubric/content.mdx
  • docs/app/docs/contributing/component-maturity-rubric/page.tsx
  • docs/app/docs/contributing/contributing-to-rad-ui/content.mdx
  • docs/app/docs/contributing/contributing-to-rad-ui/page.tsx
  • docs/app/docs/contributing/setting-up-dev-environment/content.mdx
  • docs/app/docs/contributing/setting-up-dev-environment/page.tsx
  • docs/app/docs/first-steps/installation/content.mdx
  • docs/app/docs/first-steps/installation/page.tsx
  • docs/app/docs/first-steps/introduction/content.mdx
  • docs/app/docs/first-steps/introduction/page.tsx
  • docs/app/docs/first-steps/usage/content.mdx
  • docs/app/docs/first-steps/usage/page.tsx
  • docs/app/docs/guides/accessibility/content.mdx
  • docs/app/docs/guides/accessibility/page.tsx
  • docs/app/docs/guides/component-coverage/content.mdx
  • docs/app/docs/guides/component-coverage/page.tsx
  • docs/components/Main/Main.js
  • docs/components/Main/NavBar/helpers/NavRoot/index.tsx
  • docs/components/Main/NavBar/index.js
  • docs/components/navigation/Navigation.tsx
  • docs/eslint.config.mjs
  • docs/next.config.js
  • docs/package.json
  • docs/tsconfig.json
  • package.json
  • src/components/ui/Slider/stories/Slider.stories.tsx
💤 Files with no reviewable changes (37)
  • docs/app/docs/components/code/content.mdx
  • docs/app/docs/components/accordion/content.mdx
  • docs/app/docs/components/strong/content.mdx
  • docs/app/docs/components/badge/content.mdx
  • docs/app/docs/components/heading/content.mdx
  • docs/.eslintrc.json
  • docs/app/docs/components/blockquote/content.mdx
  • docs/app/docs/components/avatar/content.mdx
  • docs/app/docs/components/aspect-ratio/content.mdx
  • docs/app/docs/components/card/content.mdx
  • docs/app/docs/components/text/content.mdx
  • docs/app/docs/components/separator/content.mdx
  • docs/app/docs/components/button/content.mdx
  • docs/app/docs/components/callout/content.mdx
  • docs/app/docs/components/progress/content.mdx
  • docs/app/docs/components/em/content.mdx
  • docs/app/docs/components/tabs/content.mdx
  • docs/app/docs/components/kbd/content.mdx
  • docs/app/docs/components/visually-hidden/content.mdx
  • docs/app/docs/first-steps/usage/content.mdx
  • docs/app/docs/guides/component-coverage/content.mdx
  • docs/app/docs/components/avatar-group/content.mdx
  • docs/app/docs/contributing/setting-up-dev-environment/content.mdx
  • docs/app/docs/contributing/component-maturity-rubric/content.mdx
  • docs/app/docs/components/tooltip/content.mdx
  • docs/app/docs/components/table/content.mdx
  • docs/app/docs/first-steps/installation/content.mdx
  • docs/app/docs/contributing/before-you-start/content.mdx
  • docs/app/docs/components/toggle-group/content.mdx
  • docs/app/docs/components/dialog/content.mdx
  • docs/app/docs/first-steps/introduction/content.mdx
  • docs/app/docs/contributing/component-coverage/content.mdx
  • docs/app/docs/components/switch/content.mdx
  • docs/app/docs/components/toggle/content.mdx
  • docs/app/docs/guides/accessibility/content.mdx
  • docs/app/docs/contributing/contributing-to-rad-ui/content.mdx
  • docs/app/docs/components/alert-dialog/content.mdx

Comment thread docs/components/Main/NavBar/helpers/NavRoot/index.tsx
Comment thread docs/components/navigation/Navigation.tsx Outdated
Comment thread package.json Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Coverage

This report compares the PR with the base branch. "Δ" shows how the PR affects each metric.

Metric PR Δ
Statements 83.96% +0.00%
Branches 61.67% +0.00%
Functions 68.98% +0.00%
Lines 83.29% +0.00%

Coverage improved or stayed the same. Great job!

Run npm run coverage locally for detailed reports and target untested areas to raise these numbers.

@kotAPI kotAPI merged commit 0c444d2 into main Mar 30, 2026
10 checks passed
@kotAPI kotAPI deleted the kotapi/security-fixes-mar-30 branch March 30, 2026 05:14
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