Skip to content

Commit 3d73108

Browse files
committed
Merge branch '5.9' into 6.x
# Conflicts: # CHANGELOG-WIP.md # src/config/app.php # src/services/Entries.php # yii2-adapter/legacy/services/Gql.php
2 parents a6bc4c3 + 315f5f8 commit 3d73108

File tree

11 files changed

+62
-16
lines changed

11 files changed

+62
-16
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- Fixed a bug where it wasn’t possible to copy/paste nested entries within Matrix fields set to the inline-editable blocks view mode, for unpublished owner elements. ([#18185](https://github.com/craftcms/cms/pull/18185))
1717
- Fixed a bug where custom fields’ checkboxes weren’t getting removed from field layouts’ “Card Attributes” lists when removed from the layout.
1818
- Fixed an SSRF vulnerability. (GHSA-96pq-hxpw-rgh8)
19+
- Fixed an XSS vulnerability. (GHSA-7pr4-wx9w-mqwr)
1920

2021
## 5.8.21 - 2025-12-04
2122

@@ -28,10 +29,10 @@
2829
- Fixed a bug where relation fields weren’t handling `:empty:`/`:notempty:` element query params properly if the field had multiple instances within a field layout. ([#18092](https://github.com/craftcms/cms/pull/18092))
2930
- Fixed a bug where user preferences were being respected for users who formerly had access to the control panel.
3031
- Fixed a bug where nested entries could be reordered when their owner element was resaved programmatically. ([#18121](https://github.com/craftcms/cms/pull/18121))
31-
- Fixed RCE vulnerabilities. (GHSA-255j-qw47-wjh5, GHSA-742x-x762-7383)
32-
- Fixed an SSRF vulnerability. (GHSA-x27p-wfqw-hfcc)
33-
- Fixed a DoS vulnerability. (GHSA-v64r-7wg9-23pr)
34-
- Fixed an information disclosure vulnerability. (GHSA-53vf-c43h-j2x9)
32+
- Fixed RCE vulnerabilities. ([GHSA-255j-qw47-wjh5](https://github.com/craftcms/cms/security/advisories/GHSA-255j-qw47-wjh5), [GHSA-742x-x762-7383](https://github.com/craftcms/cms/security/advisories/GHSA-742x-x762-7383))
33+
- Fixed an SSRF vulnerability. ([GHSA-x27p-wfqw-hfcc](https://github.com/craftcms/cms/security/advisories/GHSA-x27p-wfqw-hfcc))
34+
- Fixed a DoS vulnerability. ([GHSA-v64r-7wg9-23pr](https://github.com/craftcms/cms/security/advisories/GHSA-v64r-7wg9-23pr))
35+
- Fixed an information disclosure vulnerability. ([GHSA-53vf-c43h-j2x9](https://github.com/craftcms/cms/security/advisories/GHSA-53vf-c43h-j2x9))
3536

3637
## 5.8.20 - 2025-11-18
3738

resources/templates/graphql/schemas/_edit.twig

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
<li>
3737
{{ checkbox({
38-
label: props.label,
38+
label: raw(props.label|md(inlineOnly=true, encode=true)),
3939
name: 'permissions[]',
4040
value: permissionName,
4141
checked: checked,
@@ -101,7 +101,7 @@
101101
</div>
102102
{% endfor %}
103103

104-
<hr/>
104+
<hr>
105105
<h2>{{ 'Choose the available mutations for this schema:'|t('app') }}</h2>
106106

107107
{% for category, catPermissions in schemaComponents.mutations|filter %}
@@ -113,6 +113,19 @@
113113
</div>
114114
{% endfor %}
115115

116+
<hr>
117+
<h2>{{ 'Choose optional features available to this schema:'|t('app') }}</h2>
118+
119+
<div class="user-permissions">
120+
{{ permissionList(schema, {
121+
'directive:parseRefs': {
122+
label: '{name} directive'|t('app', {
123+
name: '`@parseRefs`',
124+
}),
125+
warning: 'Provides read-only access to user data and most content.',
126+
},
127+
}) }}
128+
</div>
116129

117130
{% endblock %}
118131

resources/translations/cy/app.php

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

src/Database/Queries/ElementQuery.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,10 @@ public function nth(int $n, array|string $columns = ['*']): ?ElementInterface
592592
return $eagerResult->first();
593593
}
594594

595-
return $this->query->skip(($this->offset ?: 0) + $n)->first($columns);
595+
/** @var ?ElementInterface $element */
596+
$element = $this->query->skip(($this->offset ?: 0) + $n)->first($columns);
597+
598+
return $element;
596599
}
597600

598601
/**

src/Element/ElementSources.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private function defineSources(string $elementType, string $context): array
203203
continue;
204204
}
205205

206-
$source['sites'] = collect($source['sites'] ?? [])
206+
$source['sites'] = collect($source['sites'])
207207
->map(function (int|string $siteId) {
208208
if (! is_string($siteId)) {
209209
return $siteId;
@@ -215,6 +215,7 @@ private function defineSources(string $elementType, string $context): array
215215

216216
try {
217217
return Sites::getSiteByUid($siteId)->id;
218+
/** @phpstan-ignore catch.neverThrown */
218219
} catch (SiteNotFoundException) {
219220
return null;
220221
}

src/Entry/EntryTypes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ public function getTableData(
598598
$usages = $this->allEntryTypeUsages();
599599

600600
foreach ($entryTypes as $entryType) {
601-
$label = $entryType->getUiLabel();
601+
$label = Html::encode($entryType->getUiLabel());
602602
$chipCellContent = Html::beginTag('div', ['class' => 'inline-chips']).
603603
Cp::chipHtml($entryType, [
604604
'labelHtml' => Html::a($label, $entryType->getCpEditUrl(), [

yii2-adapter/legacy/Craft.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public static function t($category, $message, $params = [], $language = null): s
6969
/**
7070
* @inheritdoc
7171
* @template T
72-
* @param class-string<T>|array|callable $type
73-
* @phpstan-param class-string<T>|array{class:class-string<T>}|callable():T $type
72+
* @param class-string<T>|array{class:class-string<T>}|array{__class:class-string<T>}|callable():T $type
7473
* @param array $params
7574
* @return T
7675
*/

yii2-adapter/legacy/controllers/ElementsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ public function actionEdit(?ElementInterface $element, ?int $elementId = null):
382382
$notice = null;
383383
if ($element->isProvisionalDraft) {
384384
$notice = fn() => $this->_draftNotice();
385-
} elseif ($element->getIsRevision()) {
385+
} elseif ($isRevision) {
386386
$notice = fn() => $this->_revisionNotice($element::lowerDisplayName());
387387
}
388388

yii2-adapter/legacy/helpers/Gql.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ public static function createFullAccessSchema(): GqlSchema
346346
$traverser($group);
347347
}
348348

349+
$schema->scope[] = 'directive:parseRefs';
350+
349351
return $schema;
350352
}
351353

yii2-adapter/legacy/services/Gql.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public function getSchemaDef(?GqlSchema $schema = null, bool $prebuildSchema = f
390390
'typeLoader' => TypeLoader::class . '::loadType',
391391
'query' => TypeLoader::loadType('Query'),
392392
'mutation' => TypeLoader::loadType('Mutation'),
393-
'directives' => $this->_loadGqlDirectives(),
393+
'directives' => $this->_loadGqlDirectives($schema),
394394
];
395395

396396
// If we're not required to pre-build the schema the relevant GraphQL types will be added to the Schema
@@ -1540,21 +1540,25 @@ private function _registerGqlMutations(): void
15401540
/**
15411541
* Get GraphQL query definitions
15421542
*
1543+
* @param GqlSchema|null $schema
15431544
* @return GqlDirective[]
15441545
*/
1545-
private function _loadGqlDirectives(): array
1546+
private function _loadGqlDirectives(?GqlSchema $schema): array
15461547
{
15471548
/** @var class-string<Directive>[] $directiveClasses */
15481549
$directiveClasses = [
15491550
// Directives
15501551
FormatDateTime::class,
15511552
Markdown::class,
15521553
Money::class,
1553-
ParseRefs::class,
15541554
StripTags::class,
15551555
Trim::class,
15561556
];
15571557

1558+
if (in_array('directive:parseRefs', $schema->scope)) {
1559+
$directiveClasses[] = ParseRefs::class;
1560+
}
1561+
15581562
if (!Cms::config()->disableGraphqlTransformDirective) {
15591563
$directiveClasses[] = Transform::class;
15601564
}

0 commit comments

Comments
 (0)