Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: avoid pulling griffel in CardHeader and CardPreview base hooks",
"packageName": "@fluentui/react-card",
"email": "dmytrokirpa@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "safeurl related bug fix",
"packageName": "@fluentui/react-charting",
"email": "132879294+v-baambati@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "safeurl related bug fix",
"packageName": "@fluentui/react-charts",
"email": "132879294+v-baambati@users.noreply.github.com",
"dependentChangeType": "patch"
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 21 additions & 0 deletions packages/charts/chart-web-components/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
{
"name": "@fluentui/chart-web-components",
"entries": [
{
"date": "Wed, 13 May 2026 04:08:42 GMT",
"tag": "@fluentui/chart-web-components_v0.0.77",
"version": "0.0.77",
"comments": {
"patch": [
{
"author": "863023+radium-v@users.noreply.github.com",
"package": "@fluentui/chart-web-components",
"commit": "e5b0e2412175216210360fee356a404af60f38d5",
"comment": "fix: update fast-element dependency version"
},
{
"author": "beachball",
"package": "@fluentui/chart-web-components",
"comment": "Bump @fluentui/web-components to v3.0.0-rc.19",
"commit": "193b721bfced61e2faa1293118b8ff086634a317"
}
]
}
},
{
"date": "Mon, 11 May 2026 04:09:08 GMT",
"tag": "@fluentui/chart-web-components_v0.0.76",
Expand Down
12 changes: 11 additions & 1 deletion packages/charts/chart-web-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Change Log - @fluentui/chart-web-components

This log was last generated on Mon, 11 May 2026 04:09:08 GMT and should not be manually modified.
This log was last generated on Wed, 13 May 2026 04:08:42 GMT and should not be manually modified.

<!-- Start content -->

## [0.0.77](https://github.com/microsoft/fluentui/tree/@fluentui/chart-web-components_v0.0.77)

Wed, 13 May 2026 04:08:42 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/chart-web-components_v0.0.76..@fluentui/chart-web-components_v0.0.77)

### Patches

- fix: update fast-element dependency version ([PR #36184](https://github.com/microsoft/fluentui/pull/36184) by 863023+radium-v@users.noreply.github.com)
- Bump @fluentui/web-components to v3.0.0-rc.19 ([PR #36199](https://github.com/microsoft/fluentui/pull/36199) by beachball)

## [0.0.76](https://github.com/microsoft/fluentui/tree/@fluentui/chart-web-components_v0.0.76)

Mon, 11 May 2026 04:09:08 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/charts/chart-web-components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fluentui/chart-web-components",
"description": "A library of Fluent Chart Web Components",
"version": "0.0.76",
"version": "0.0.77",
"author": {
"name": "Microsoft"
},
Expand Down Expand Up @@ -69,7 +69,7 @@
"dependencies": {
"@microsoft/fast-web-utilities": "^6.0.0",
"@fluentui/tokens": "^1.0.0-alpha.23",
"@fluentui/web-components": "^3.0.0-rc.18",
"@fluentui/web-components": "^3.0.0-rc.19",
"@types/d3-selection": "^3.0.0",
"@types/d3-shape": "^3.0.0",
"d3-selection": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,10 @@ describe('isSafeUrl', () => {
expect(utils.isSafeUrl('https://example.com')).toBe(true);
});

test('Should allow https URL with leading whitespace', () => {
expect(utils.isSafeUrl(' https://example.com')).toBe(true);
});

test('Should allow https URL with path, query, and fragment', () => {
expect(utils.isSafeUrl('https://example.com/path?q=1#section')).toBe(true);
});
Expand Down Expand Up @@ -1552,6 +1556,26 @@ describe('isSafeUrl', () => {
expect(utils.isSafeUrl('javascript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with leading whitespace', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl(' javascript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with leading tabs/newlines', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('\n\tjavascript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with embedded newline in scheme', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('java\nscript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with embedded tab in scheme', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('java\tscript:alert(1)')).toBe(false);
});

test('Should block data: protocol', () => {
expect(utils.isSafeUrl('data:text/html,<script>alert(1)</script>')).toBe(false);
});
Expand All @@ -1560,6 +1584,25 @@ describe('isSafeUrl', () => {
expect(utils.isSafeUrl('vbscript:msgbox("xss")')).toBe(false);
});

test('Should block vbscript:alert(1)', () => {
expect(utils.isSafeUrl('vbscript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with null byte prefix', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('\0javascript:alert(1)')).toBe(false);
});

test('Should block mixed-case javascript: protocol with embedded newline', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('JaVa\nScRiPt:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with CRLF prefix', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('\r\njavascript:alert(1)')).toBe(false);
});

test('Should block file: protocol', () => {
expect(utils.isSafeUrl('file:///etc/passwd')).toBe(false);
});
Expand All @@ -1580,6 +1623,10 @@ describe('isSafeUrl', () => {
expect(utils.isSafeUrl('custom:payload')).toBe(false);
});

test('Should block custom: protocol with leading whitespace', () => {
expect(utils.isSafeUrl(' custom:payload')).toBe(false);
});

test('Should allow a path that contains a colon but is not a scheme', () => {
expect(utils.isSafeUrl('/path/to:resource')).toBe(true);
});
Expand Down
6 changes: 3 additions & 3 deletions packages/charts/react-charting/src/utilities/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2556,9 +2556,9 @@ const truncateTextToFitWidth = (text: string, maxWidth: number, measure: (s: str
};

export function isSafeUrl(href: string): boolean {
if (/^[a-z][a-z0-9+.-]*:/i.test(href)) {
return /^(https?|mailto|tel|ftp):/i.test(href);
const normalized = href.replace(/[\u0000-\u001F\u007F\s]+/g, '');
if (/^[a-z][a-z0-9+.-]*:/i.test(normalized)) {
return /^(https?|mailto|tel|ftp):/i.test(normalized);
}

return true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,10 @@ describe('isSafeUrl', () => {
expect(utils.isSafeUrl('https://example.com')).toBe(true);
});

test('Should allow https URL with leading whitespace', () => {
expect(utils.isSafeUrl(' https://example.com')).toBe(true);
});

test('Should allow https URL with path, query, and fragment', () => {
expect(utils.isSafeUrl('https://example.com/path?q=1#section')).toBe(true);
});
Expand Down Expand Up @@ -1557,6 +1561,26 @@ describe('isSafeUrl', () => {
expect(utils.isSafeUrl('javascript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with leading whitespace', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl(' javascript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with leading tabs/newlines', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('\n\tjavascript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with embedded newline in scheme', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('java\nscript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with embedded tab in scheme', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('java\tscript:alert(1)')).toBe(false);
});

test('Should block data: protocol', () => {
expect(utils.isSafeUrl('data:text/html,<script>alert(1)</script>')).toBe(false);
});
Expand All @@ -1565,6 +1589,25 @@ describe('isSafeUrl', () => {
expect(utils.isSafeUrl('vbscript:msgbox("xss")')).toBe(false);
});

test('Should block vbscript:alert(1)', () => {
expect(utils.isSafeUrl('vbscript:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with null byte prefix', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('\0javascript:alert(1)')).toBe(false);
});

test('Should block mixed-case javascript: protocol with embedded newline', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('JaVa\nScRiPt:alert(1)')).toBe(false);
});

test('Should block javascript: protocol with CRLF prefix', () => {
// eslint-disable-next-line no-script-url
expect(utils.isSafeUrl('\r\njavascript:alert(1)')).toBe(false);
});

test('Should block file: protocol', () => {
expect(utils.isSafeUrl('file:///etc/passwd')).toBe(false);
});
Expand All @@ -1585,6 +1628,10 @@ describe('isSafeUrl', () => {
expect(utils.isSafeUrl('custom:payload')).toBe(false);
});

test('Should block custom: protocol with leading whitespace', () => {
expect(utils.isSafeUrl(' custom:payload')).toBe(false);
});

test('Should allow a path that contains a colon but is not a scheme', () => {
expect(utils.isSafeUrl('/path/to:resource')).toBe(true);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2716,8 +2716,9 @@ const truncateTextToFitWidth = (text: string, maxWidth: number, measure: (s: str
};

export function isSafeUrl(href: string): boolean {
if (/^[a-z][a-z0-9+.-]*:/i.test(href)) {
return /^(https?|mailto|tel|ftp):/i.test(href);
const normalized = href.replace(/[\u0000-\u001F\u007F\s]+/g, '');
if (/^[a-z][a-z0-9+.-]*:/i.test(normalized)) {
return /^(https?|mailto|tel|ftp):/i.test(normalized);
}
return true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as React from 'react';
import { getIntrinsicElementProps, useId, slot } from '@fluentui/react-utilities';
import type { CardHeaderBaseProps, CardHeaderBaseState, CardHeaderProps, CardHeaderState } from './CardHeader.types';
import { useCardContext_unstable } from '../Card/CardContext';
import { cardHeaderClassNames } from './useCardHeaderStyles.styles';

/**
* Finds the first child of CardHeader with an id prop.
Expand Down Expand Up @@ -77,7 +76,7 @@ export const useCardHeaderBase_unstable = (
const headerRef = React.useRef<HTMLDivElement>(null);

const hasChildId = React.useRef(false);
const generatedId = useId(cardHeaderClassNames.header, referenceId);
const generatedId = useId('fui-CardHeader__header', referenceId);

const headerSlot = slot.optional(header, {
renderByDefault: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
CardPreviewState,
} from './CardPreview.types';
import { useCardContext_unstable } from '../Card/CardContext';
import { cardPreviewClassNames } from './useCardPreviewStyles.styles';

/**
* Create the state required to render CardPreview.
Expand Down Expand Up @@ -52,7 +51,7 @@ export const useCardPreviewBase_unstable = (
}

if (previewRef.current && previewRef.current.parentNode) {
const img = previewRef.current.parentNode.querySelector<HTMLImageElement>(`.${cardPreviewClassNames.root} > img`);
const img = previewRef.current.parentNode.querySelector<HTMLImageElement>(`.fui-CardPreview > img`);

if (img) {
const ariaLabel = img.getAttribute('aria-label');
Expand Down
Loading
Loading