Skip to content

Commit 4e8a32d

Browse files
committed
AG-48788 fix support of negative values in ubo redirect rules [scriptlets]
Squashed commit of the following: commit a473be8 Author: slvvko <v.leleka@adguard.com> Date: Tue Nov 25 00:40:38 2025 -0500 update changelog commit bcd973e Author: slvvko <v.leleka@adguard.com> Date: Tue Nov 25 00:40:07 2025 -0500 update agtree to 3.3.1 commit 68b956f Merge: 31858a5 59bf85f Author: slvvko <v.leleka@adguard.com> Date: Tue Nov 25 00:37:02 2025 -0500 merge parent branch into current one, resolve conflicts commit 31858a5 Merge: 30fd0c3 b9773c6 Author: slvvko <v.leleka@adguard.com> Date: Tue Nov 25 00:32:30 2025 -0500 merge parent branch into current one, resolve conflicts commit 30fd0c3 Author: slvvko <v.leleka@adguard.com> Date: Mon Nov 24 22:48:41 2025 -0500 AG-48788 fix support of negative values in ubo redirect rules
1 parent 59bf85f commit 4e8a32d

4 files changed

Lines changed: 29 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,23 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
1010
<!-- TODO: change `@added unknown` tag due to the actual version -->
1111
<!-- during new scriptlets or redirects releasing -->
1212

13-
## Unreleased
13+
## [v2.2.13] - 2025-11-25
1414

1515
### Added
1616

1717
- New value to `set-cookie` and `set-cookie-reload` scriptlets: `denied` [#512].
1818

19+
### Changed
20+
21+
- Updated [@adguard/agtree] to `3.3.1`.
22+
1923
### Fixed
2024

2125
- Determination of string values more precisely
2226
for `trusted-set-constant` scriptlet [#499].
27+
- Support for negative priority suffix in UBO redirects rules.
2328

29+
[v2.2.13]: https://github.com/AdguardTeam/Scriptlets/compare/v2.2.12...v2.2.13
2430
[#499]: https://github.com/AdguardTeam/Scriptlets/issues/499
2531
[#512]: https://github.com/AdguardTeam/Scriptlets/issues/512
2632

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adguard/scriptlets",
3-
"version": "2.2.12",
3+
"version": "2.2.13",
44
"description": "AdGuard's JavaScript library of Scriptlets and Redirect resources",
55
"type": "module",
66
"scripts": {
@@ -64,7 +64,7 @@
6464
"neverBuiltDependencies": []
6565
},
6666
"dependencies": {
67-
"@adguard/agtree": "^3.2.5",
67+
"@adguard/agtree": "^3.3.1",
6868
"@types/trusted-types": "^2.0.7",
6969
"js-yaml": "^3.14.1"
7070
},

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/api/validators.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ describe('validators', () => {
7676
// $redirect-rule
7777
'||example.org$xmlhttprequest,redirect-rule=noopvast-2.0',
7878
'||example.org/script.js$script,redirect-rule=googletagmanager-gtm',
79+
// with positive priority
80+
'||example.org^$xmlhttprequest,redirect=nooptext:1',
81+
'||example.org^$xmlhttprequest,redirect-rule=nooptext:100',
82+
// with negative priority
83+
'||example.org^$xmlhttprequest,redirect=nooptext:-1',
7984
];
8085
test.each(validRules)('%s', (rule: string) => {
8186
expect(isValidAdgRedirectRule(rule)).toBeTruthy();
@@ -89,6 +94,9 @@ describe('validators', () => {
8994
// invalid adg redirect name
9095
'||example.com/banner$image,redirect=redirect.png',
9196
'||example.com/banner$image,redirect-rule=redirect.png',
97+
// invalid redirect resource with priority
98+
'||example.com/banner$image,redirect=invalid:1',
99+
'||example.com/banner$image,redirect-rule=invalid:-1',
92100
];
93101
test.each(invalidRules)('%s', (rule: string) => {
94102
expect(isValidAdgRedirectRule(rule)).toBeFalsy();
@@ -99,6 +107,11 @@ describe('validators', () => {
99107
const validRedirectNames = [
100108
'noopvast-4.0', // adg only
101109
'empty', // adg/ubo
110+
// with positive priority
111+
'nooptext:1',
112+
'nooptext:100',
113+
// with negative priority
114+
'nooptext:-1',
102115
];
103116
test.each(validRedirectNames)('%s', (name: string) => {
104117
expect(isRedirectResourceCompatibleWithAdg(name)).toBeTruthy();
@@ -107,6 +120,8 @@ describe('validators', () => {
107120
const invalidRedirectNames = [
108121
'outbrain-widget.js', // ubo only
109122
'stylesheet', // ubo only
123+
'invalid:1', // invalid resource even with priority
124+
'invalid:-1', // invalid resource even with negative priority
110125
];
111126
test.each(invalidRedirectNames)('%s', (name: string) => {
112127
expect(isRedirectResourceCompatibleWithAdg(name)).toBeFalsy();

0 commit comments

Comments
 (0)