Skip to content

Commit 508de67

Browse files
author
Anthony MARTIN
committed
[FrameworkBundle] Add sid_length and sid_bits_per_character session ini options in configuration
| Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29830 | License | MIT | Doc PR | n/a this a fix for the issue #29830 After deliberation, we estimate that only `sid_length` and` sid_bits_per_character` session options should be exposed. These options à optional. For others, we recommend changing your php.ini file We can now configure the session like this : ```yaml framwork: session: sid_length: 64 //optional, recommended value is 32 sid_bits_per_character: 6 //optional, recommended value is 5 ```
1 parent be641d8 commit 508de67

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ CHANGELOG
1313
original serialization method, set the `framework.messenger.serializer.id`
1414
config option to `messenger.transport.symfony_serializer`.
1515
* Added information about deprecated aliases in `debug:autowiring`
16+
* Added php ini session options `sid_length` and `sid_bits_per_character`
17+
to the `session` section of the configuration
1618

1719
4.2.0
1820
-----

DependencyInjection/Configuration.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,14 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
509509
->defaultValue(0)
510510
->info('seconds to wait between 2 session metadata updates')
511511
->end()
512+
->integerNode('sid_length')
513+
->min(22)
514+
->max(256)
515+
->end()
516+
->integerNode('sid_bits_per_character')
517+
->min(4)
518+
->max(6)
519+
->end()
512520
->end()
513521
->end()
514522
->end()

Resources/config/schema/symfony-1.0.xsd

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
<xsd:attribute name="gc-probability" type="xsd:string" />
113113
<xsd:attribute name="save-path" type="xsd:string" />
114114
<xsd:attribute name="metadata-update-threshold" type="xsd:nonNegativeInteger" />
115+
<xsd:attribute name="sid-length" type="sid_length" />
116+
<xsd:attribute name="sid-bits-per-character" type="sid_bits_per_character" />
115117
</xsd:complexType>
116118

117119
<xsd:complexType name="request">
@@ -343,14 +345,29 @@
343345
</xsd:restriction>
344346
</xsd:simpleType>
345347

346-
<xsd:simpleType name="cookie_samesite">
348+
<xsd:simpleType name="cookie_samesite">
347349
<xsd:restriction base="xsd:string">
348350
<xsd:enumeration value="" />
349351
<xsd:enumeration value="lax" />
350352
<xsd:enumeration value="strict" />
351353
</xsd:restriction>
352354
</xsd:simpleType>
353355

356+
<xsd:simpleType name="sid_bits_per_character">
357+
<xsd:restriction base="xsd:positiveInteger">
358+
<xsd:enumeration value="4" />
359+
<xsd:enumeration value="5" />
360+
<xsd:enumeration value="6" />
361+
</xsd:restriction>
362+
</xsd:simpleType>
363+
364+
<xsd:simpleType name="sid_length">
365+
<xsd:restriction base="xsd:positiveInteger">
366+
<xsd:minInclusive value="22" />
367+
<xsd:maxInclusive value="256" />
368+
</xsd:restriction>
369+
</xsd:simpleType>
370+
354371
<xsd:simpleType name="workflow_type">
355372
<xsd:restriction base="xsd:string">
356373
<xsd:enumeration value="state_machine" />

0 commit comments

Comments
 (0)