-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
fix: prevent wildcard CSS leakage in sb-errordisplay_main #34064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -147,84 +147,80 @@ | |||||||||
| border: 1px solid #ff0000; | ||||||||||
| box-shadow: 0 0 64px rgba(0, 0, 0, 0.1); | ||||||||||
| gap: 24px; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| & ol { | ||||||||||
| padding-left: 18px; | ||||||||||
| margin: 0; | ||||||||||
| } | ||||||||||
| .sb-errordisplay_main ol { | ||||||||||
| padding-left: 18px; | ||||||||||
| margin: 0; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /* Redefine colors to ensure readability regardless of user-provided * selectors. */ | ||||||||||
| * { | ||||||||||
| background: white; | ||||||||||
| color: black; | ||||||||||
| } | ||||||||||
| /* Prevent wildcard leakage */ | ||||||||||
| .sb-errordisplay_main * { | ||||||||||
| background: white; | ||||||||||
| color: black; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| & h1 { | ||||||||||
| font-family: Nunito Sans; | ||||||||||
| font-size: 22px; | ||||||||||
| font-weight: 400; | ||||||||||
| line-height: 30px; | ||||||||||
| font-weight: normal; | ||||||||||
| margin: 0; | ||||||||||
|
|
||||||||||
| &::before { | ||||||||||
| content: ''; | ||||||||||
| display: inline-block; | ||||||||||
| width: 12px; | ||||||||||
| height: 12px; | ||||||||||
| background: #ff4400; | ||||||||||
| border-radius: 50%; | ||||||||||
| margin-right: 8px; | ||||||||||
| } | ||||||||||
| } | ||||||||||
| .sb-errordisplay_main h1 { | ||||||||||
| font-family: Nunito Sans; | ||||||||||
| font-size: 22px; | ||||||||||
| font-weight: 400; | ||||||||||
| line-height: 30px; | ||||||||||
| margin: 0; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| & p, | ||||||||||
| & ol { | ||||||||||
| font-family: Nunito Sans; | ||||||||||
| font-size: 14px; | ||||||||||
| font-weight: 400; | ||||||||||
| line-height: 19px; | ||||||||||
| margin: 0; | ||||||||||
| } | ||||||||||
| .sb-errordisplay_main h1::before { | ||||||||||
| content: ''; | ||||||||||
| display: inline-block; | ||||||||||
| width: 12px; | ||||||||||
| height: 12px; | ||||||||||
| background: #ff4400; | ||||||||||
| border-radius: 50%; | ||||||||||
| margin-right: 8px; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| & li + li { | ||||||||||
| margin: 0; | ||||||||||
| padding: 0; | ||||||||||
| padding-top: 12px; | ||||||||||
| } | ||||||||||
| .sb-errordisplay_main p, | ||||||||||
| .sb-errordisplay_main ol { | ||||||||||
| font-family: Nunito Sans; | ||||||||||
| font-size: 14px; | ||||||||||
| font-weight: 400; | ||||||||||
| line-height: 19px; | ||||||||||
| margin: 0; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| & a { | ||||||||||
| color: currentColor; | ||||||||||
| } | ||||||||||
| .sb-errordisplay_main li + li { | ||||||||||
| padding-top: 12px; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| & .sb-errordisplay_code { | ||||||||||
| padding: 10px; | ||||||||||
| flex: 1; | ||||||||||
| background: #242424; | ||||||||||
| color: #c6c6c6; | ||||||||||
| box-sizing: border-box; | ||||||||||
|
|
||||||||||
| font-size: 14px; | ||||||||||
| font-weight: 400; | ||||||||||
| line-height: 19px; | ||||||||||
| border-radius: 4px; | ||||||||||
|
|
||||||||||
| font-family: | ||||||||||
| 'Operator Mono', 'Fira Code Retina', 'Fira Code', 'FiraCode-Retina', 'Andale Mono', | ||||||||||
| 'Lucida Console', Consolas, Monaco, monospace; | ||||||||||
| margin: 0; | ||||||||||
| overflow: auto; | ||||||||||
|
|
||||||||||
| & code { | ||||||||||
| background-color: inherit; | ||||||||||
| color: inherit; | ||||||||||
| } | ||||||||||
| } | ||||||||||
| .sb-errordisplay_main a { | ||||||||||
| color: currentColor; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| & .sb-errordisplay pre { | ||||||||||
| white-space: pre-wrap; | ||||||||||
| white-space: revert; | ||||||||||
| } | ||||||||||
| .sb-errordisplay_main .sb-errordisplay_code { | ||||||||||
| padding: 10px; | ||||||||||
| flex: 1; | ||||||||||
| background: #242424; | ||||||||||
| color: #c6c6c6; | ||||||||||
| box-sizing: border-box; | ||||||||||
|
|
||||||||||
| font-size: 14px; | ||||||||||
| line-height: 19px; | ||||||||||
| border-radius: 4px; | ||||||||||
|
|
||||||||||
| font-family: | ||||||||||
| 'Operator Mono', 'Fira Code Retina', 'Fira Code', 'FiraCode-Retina', 'Andale Mono', | ||||||||||
| 'Lucida Console', Consolas, Monaco, monospace; | ||||||||||
|
|
||||||||||
| margin: 0; | ||||||||||
| overflow: auto; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| .sb-errordisplay_main .sb-errordisplay_code code { | ||||||||||
| background-color: inherit; | ||||||||||
| color: inherit; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| .sb-errordisplay_main .sb-errordisplay pre { | ||||||||||
| white-space: revert; | ||||||||||
|
Comment on lines
+222
to
+223
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This In Suggested fix- .sb-errordisplay_main .sb-errordisplay pre {
+ .sb-errordisplay_main pre {
white-space: revert;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| } | ||||||||||
|
|
||||||||||
| @-webkit-keyframes sb-rotate360 { | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| description = "storybook dev environment"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| outputs = { self, nixpkgs }: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| let | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| system = "x86_64-linux"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| pkgs = import nixpkgs { inherit system; }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| in { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| devShells.${system}.default = pkgs.mkShell { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'flake.nix system key:\n'
nl -ba flake.nix | sed -n '6,15p'
printf '\nRepo-supported architectures from .yarnrc.yml:\n'
rg -n -A6 -B2 'supportedArchitectures|cpu:|os:|- x64|- arm64|- linux|- darwin' .yarnrc.ymlRepository: storybookjs/storybook Length of output: 146 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'flake.nix (lines 6-15):\n'
sed -n '6,15p' flake.nix | cat -n
printf '\nRepo-supported architectures from .yarnrc.yml:\n'
rg -n 'supportedArchitectures|cpu:|os:|x64|arm64|linux|darwin' .yarnrc.yml | head -20Repository: storybookjs/storybook Length of output: 547 Make the dev shell portable across all supported architectures. The hardcoded Use Portable flake pattern {
description = "storybook dev environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ inputs.flake-utils.url = "github:numtide/flake-utils";
- outputs = { self, nixpkgs }:
- let
- system = "x86_64-linux";
- pkgs = import nixpkgs { inherit system; };
- in {
- devShells.${system}.default = pkgs.mkShell {
- packages = with pkgs; [
- nodejs
- pnpm
- ];
- };
- };
+ outputs = { nixpkgs, flake-utils, ... }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ in {
+ devShells.default = pkgs.mkShell {
+ packages = with pkgs; [
+ nodejs
+ pnpm
+ ];
+ };
+ });
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| packages = with pkgs; [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| nodejs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| pnpm | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Declared package manager:\n'
rg -n '"packageManager"\s*:\s*"[^"]+"' package.json
printf '\nYarn-specific repo config:\n'
rg -n 'yarnPath|nodeLinker|npmRegistryServer' .yarnrc.yml
printf '\nflake.nix shell packages:\n'
nl -ba flake.nix | sed -n '11,15p'Repository: storybookjs/storybook Length of output: 368 🏁 Script executed: sed -n '12,15p' flake.nixRepository: storybookjs/storybook Length of output: 131 Use the repo's Yarn workflow here, not The repository is explicitly pinned to 🧹 Minimal fix packages = with pkgs; [
nodejs
- pnpm
];📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep ANSI-rendered stack spans inside the dark code theme.
#error-stackis filled withansiConverter.toHtml(detail), so the universal reset on Lines 157-160 also hits nested<span>nodes. Right now only thecodeelement is restored on Lines 217-220, which leaves ANSI children with white backgrounds inside the dark<pre>.Suggested fix
Also applies to: 217-220
🤖 Prompt for AI Agents