Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(common): Limits date format string length - #69000

Merged
atscott merged 1 commit into
angular:mainfrom
SkyZeroZx:fix/datepipe
Jun 5, 2026
Merged

fix(common): Limits date format string length#69000
atscott merged 1 commit into
angular:mainfrom
SkyZeroZx:fix/datepipe

Conversation

@SkyZeroZx

@SkyZeroZx SkyZeroZx commented May 28, 2026

Copy link
Copy Markdown
Contributor

Introduces a maximum length of 256 characters for date format strings.

This prevents potential Denial of Service (DoS) attacks by throwing an INVALID_DATE_FORMAT error if an excessively long format string is provided to formatDate or DatePipe, safeguarding against performance degradation or application crashes.

This can be considered similar to #68840

@angular-robot angular-robot Bot added the area: common Issues related to APIs in the @angular/common package label May 28, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 28, 2026
@SkyZeroZx
SkyZeroZx marked this pull request as ready for review May 28, 2026 19:58
@pullapprove
pullapprove Bot requested a review from crisbeto May 28, 2026 19:58
Comment thread packages/common/src/i18n/format_date.ts Outdated

@alan-agius4 alan-agius4 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.

Let's avoid introducing new error codes unless there's a strict requirement for it. We should reuse SUSPICIOUS_DATE_FORMAT here instead of adding a new variant.

Comment thread packages/common/src/i18n/format_date.ts Outdated
Introduces a maximum length of 256 characters for date format strings.

This prevents potential Denial of Service (DoS) attacks by throwing an
`INVALID_DATE_FORMAT` error if an excessively long format string is
provided to `formatDate` or `DatePipe`, safeguarding against performance
degradation or application crashes.
@SkyZeroZx
SkyZeroZx requested a review from alan-agius4 June 2, 2026 16:20
@JeanMeche
JeanMeche removed the request for review from crisbeto June 4, 2026 21:14
@SkyZeroZx

SkyZeroZx commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

I think it would be ready to merge? That way I could also generate a backport for this case.

@alan-agius4 alan-agius4 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.

LGTM

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Jun 5, 2026
@atscott
atscott merged commit eeb03f4 into angular:main Jun 5, 2026
24 checks passed
@atscott

atscott commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: common Issues related to APIs in the @angular/common package target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants