From 9f6942f3e4723f6fb4fe093debca7055f7d9dd79 Mon Sep 17 00:00:00 2001 From: "github-action[bot]" <> Date: Sun, 17 Nov 2024 09:14:29 +0000 Subject: [PATCH] Update Flex endpoint --- RECIPES.md | 3 +- ...198b53dabc891aa5c2d93e35d86e4c217a40b.json | 191 ++++++++++++++++++ ...4285a926752ec2852a5cafa39e7b527c33a38.json | 157 ++++++++++++++ ...3ff447478c98e6af6de14c20fa6d8938b4591.json | 22 ++ index.json | 20 +- symfony.framework-bundle.7.2.json | 7 +- symfony.stimulus-bundle.2.20.json | 157 ++++++++++++++ symfony.ux-turbo.2.20.json | 22 ++ 8 files changed, 576 insertions(+), 3 deletions(-) create mode 100644 archived/symfony.framework-bundle/eac198b53dabc891aa5c2d93e35d86e4c217a40b.json create mode 100644 archived/symfony.stimulus-bundle/41c4285a926752ec2852a5cafa39e7b527c33a38.json create mode 100644 archived/symfony.ux-turbo/0103ff447478c98e6af6de14c20fa6d8938b4591.json create mode 100644 symfony.stimulus-bundle.2.20.json create mode 100644 symfony.ux-turbo.2.20.json diff --git a/RECIPES.md b/RECIPES.md index 0c7166de..b798d9af 100644 --- a/RECIPES.md +++ b/RECIPES.md @@ -143,7 +143,7 @@ Additional recipes can be found on the [Contrib Recipes Repository](https://gith | [symfony/smsense-notifier](https://packagist.org/packages/symfony/smsense-notifier) | [7.1](symfony/smsense-notifier/7.1) | `smsense-notifier`, `smsensenotifier` | | [symfony/smsmode-notifier](https://packagist.org/packages/symfony/smsmode-notifier) | [6.3](symfony/smsmode-notifier/6.3) | `smsmode-notifier`, `smsmodenotifier` | | [symfony/spot-hit-notifier](https://packagist.org/packages/symfony/spot-hit-notifier) | [5.3](symfony/spot-hit-notifier/5.3) | `spot-hit-notifier`, `spothitnotifier` | -| [symfony/stimulus-bundle](https://packagist.org/packages/symfony/stimulus-bundle) | [2.13](symfony/stimulus-bundle/2.13) | `stimulus`, `stimulus-bundle`, `stimulusbundle` | +| [symfony/stimulus-bundle](https://packagist.org/packages/symfony/stimulus-bundle) | [2.20](symfony/stimulus-bundle/2.20) | `stimulus`, `stimulus-bundle`, `stimulusbundle` | | [symfony/sweego-mailer](https://packagist.org/packages/symfony/sweego-mailer) | [7.2](symfony/sweego-mailer/7.2) | `sweego-mailer`, `sweegomailer` | | [symfony/sweego-notifier](https://packagist.org/packages/symfony/sweego-notifier) | [7.2](symfony/sweego-notifier/7.2) | `sweego-notifier`, `sweegonotifier` | | [symfony/swiftmailer-bundle](https://packagist.org/packages/symfony/swiftmailer-bundle) | [2.5](symfony/swiftmailer-bundle/2.5) | `swiftmailer`, `swiftmailer-bundle`, `swiftmailerbundle` | @@ -167,6 +167,7 @@ Additional recipes can be found on the [Contrib Recipes Repository](https://gith | [symfony/ux-react](https://packagist.org/packages/symfony/ux-react) | [2.9](symfony/ux-react/2.9) | `ux-react`, `uxreact` | | [symfony/ux-svelte](https://packagist.org/packages/symfony/ux-svelte) | [2.9](symfony/ux-svelte/2.9) | `ux-svelte`, `uxsvelte` | | [symfony/ux-translator](https://packagist.org/packages/symfony/ux-translator) | [2.9](symfony/ux-translator/2.9) | `ux-translator`, `uxtranslator` | +| [symfony/ux-turbo](https://packagist.org/packages/symfony/ux-turbo) | [2.20](symfony/ux-turbo/2.20) | `ux-turbo`, `uxturbo` | | [symfony/ux-twig-component](https://packagist.org/packages/symfony/ux-twig-component) | [2.13](symfony/ux-twig-component/2.13) | `ux-twig-component`, `uxtwigcomponent` | | [symfony/ux-vue](https://packagist.org/packages/symfony/ux-vue) | [2.9](symfony/ux-vue/2.9) | `ux-vue`, `uxvue` | | [symfony/validator](https://packagist.org/packages/symfony/validator) | [7.0](symfony/validator/7.0) | `validation`, `validator` | diff --git a/archived/symfony.framework-bundle/eac198b53dabc891aa5c2d93e35d86e4c217a40b.json b/archived/symfony.framework-bundle/eac198b53dabc891aa5c2d93e35d86e4c217a40b.json new file mode 100644 index 00000000..4e151e87 --- /dev/null +++ b/archived/symfony.framework-bundle/eac198b53dabc891aa5c2d93e35d86e4c217a40b.json @@ -0,0 +1,191 @@ +{ + "manifests": { + "symfony/framework-bundle": { + "manifest": { + "bundles": { + "Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle": [ + "all" + ] + }, + "copy-from-recipe": { + "config/": "%CONFIG_DIR%/", + "public/": "%PUBLIC_DIR%/", + "src/": "%SRC_DIR%/" + }, + "composer-scripts": { + "cache:clear": "symfony-cmd", + "assets:install %PUBLIC_DIR%": "symfony-cmd" + }, + "env": { + "APP_ENV": "dev", + "APP_SECRET": "" + }, + "dotenv": { + "dev": { + "APP_SECRET": "%generate(secret)%" + } + }, + "gitignore": [ + "/.env.local", + "/.env.local.php", + "/.env.*.local", + "/%CONFIG_DIR%/secrets/prod/prod.decrypt.private.php", + "/%PUBLIC_DIR%/bundles/", + "/%VAR_DIR%/", + "/vendor/" + ], + "post-install-output": [ + " * Run your application:", + " 1. Go to the project directory", + " 2. Create your code repository with the git init command", + " 3. Download the Symfony CLI at https://symfony.com/download to install a development web server", + "", + " * Read the documentation at https://symfony.com/doc" + ] + }, + "files": { + "config/packages/cache.yaml": { + "contents": [ + "framework:", + " cache:", + " # Unique name of your app: used to compute stable namespaces for cache keys.", + " #prefix_seed: your_vendor_name/app_name", + "", + " # The \"app\" cache stores to the filesystem by default.", + " # The data in this cache should persist between deploys.", + " # Other options include:", + "", + " # Redis", + " #app: cache.adapter.redis", + " #default_redis_provider: redis://localhost", + "", + " # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)", + " #app: cache.adapter.apcu", + "", + " # Namespaced pools use the above \"app\" backend by default", + " #pools:", + " #my.dedicated.cache: null", + "" + ], + "executable": false + }, + "config/packages/framework.yaml": { + "contents": [ + "# see https://symfony.com/doc/current/reference/configuration/framework.html", + "framework:", + " secret: '%env(APP_SECRET)%'", + "", + " # Note that the session will be started ONLY if you read or write from it.", + " session: true", + "", + " #esi: true", + " #fragments: true", + "", + " # Enable stateless CSRF protection for forms and logins/logouts", + " form: { csrf_protection: { token_id: submit } }", + " csrf_protection:", + " stateless_token_ids: [submit, authenticate, logout]", + "", + "when@test:", + " framework:", + " test: true", + " session:", + " storage_factory_id: session.storage.factory.mock_file", + "" + ], + "executable": false + }, + "config/preload.php": { + "contents": [ + "=2.0.0,<2.3.0" + }, + "add-lines": [ + { + "file": "webpack.config.js", + "content": "\n // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)\n .enableStimulusBridge('./assets/controllers.json')", + "position": "after_target", + "target": ".splitEntryChunks()" + }, + { + "file": "assets/app.js", + "content": "import './bootstrap.js';", + "position": "top", + "warn_if_missing": true + }, + { + "file": "assets/bootstrap.js", + "content": "import { startStimulusApp } from '@symfony/stimulus-bridge';\n\n// Registers Stimulus controllers from controllers.json and in the controllers/ directory\nexport const app = startStimulusApp(require.context(\n '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',\n true,\n /\\.[jt]sx?$/\n));", + "position": "top", + "requires": "symfony/webpack-encore-bundle" + }, + { + "file": "assets/bootstrap.js", + "content": "import { startStimulusApp } from '@symfony/stimulus-bundle';\n\nconst app = startStimulusApp();", + "position": "top", + "requires": "symfony/asset-mapper" + } + ] + }, + "files": { + "assets/bootstrap.js": { + "contents": [ + "// register any custom, 3rd party controllers here", + "// app.register('some_controller_name', SomeImportedController);", + "" + ], + "executable": false + }, + "assets/controllers.json": { + "contents": [ + "{", + " \"controllers\": [],", + " \"entrypoints\": []", + "}", + "" + ], + "executable": false + }, + "assets/controllers/csrf_protection_controller.js": { + "contents": [ + "var nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;", + "var tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;", + "", + "// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager", + "document.addEventListener('submit', function (event) {", + " var csrfField = event.target.querySelector('input[data-controller=\"csrf-protection\"]');", + "", + " if (!csrfField) {", + " return;", + " }", + "", + " var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');", + " var csrfToken = csrfField.value;", + "", + " if (!csrfCookie && nameCheck.test(csrfToken)) {", + " csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);", + " csrfField.value = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));", + " }", + "", + " if (csrfCookie && tokenCheck.test(csrfToken)) {", + " var cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';", + " document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;", + " }", + "});", + "", + "// When @hotwired/turbo handles form submissions, send the CSRF token in a header in addition to a cookie", + "// The `framework.csrf_protection.check_header` config option needs to be enabled for the header to be checked", + "document.addEventListener('turbo:submit-start', function (event) {", + " var csrfField = event.detail.formSubmission.formElement.querySelector('input[data-controller=\"csrf-protection\"]');", + "", + " if (!csrfField) {", + " return;", + " }", + "", + " var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');", + "", + " if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {", + " event.detail.formSubmission.fetchRequest.headers[csrfCookie] = csrfField.value;", + " }", + "});", + "", + "// When @hotwired/turbo handles form submissions, remove the CSRF cookie once a form has been submitted", + "document.addEventListener('turbo:submit-end', function (event) {", + " var csrfField = event.detail.formSubmission.formElement.querySelector('input[data-controller=\"csrf-protection\"]');", + "", + " if (!csrfField) {", + " return;", + " }", + "", + " var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');", + "", + " if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {", + " var cookie = csrfCookie + '_' + csrfField.value + '=0; path=/; samesite=strict; max-age=0';", + "", + " document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;", + " }", + "});", + "", + "/* stimulusFetch: 'lazy' */", + "export default 'csrf-protection-controller';", + "" + ], + "executable": false + }, + "assets/controllers/hello_controller.js": { + "contents": [ + "import { Controller } from '@hotwired/stimulus';", + "", + "/*", + " * This is an example Stimulus controller!", + " *", + " * Any element with a data-controller=\"hello\" attribute will cause", + " * this controller to be executed. The name \"hello\" comes from the filename:", + " * hello_controller.js -> \"hello\"", + " *", + " * Delete this file or adapt it for your use!", + " */", + "export default class extends Controller {", + " connect() {", + " this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';", + " }", + "}", + "" + ], + "executable": false + } + }, + "ref": "41c4285a926752ec2852a5cafa39e7b527c33a38" + } + } +} diff --git a/archived/symfony.ux-turbo/0103ff447478c98e6af6de14c20fa6d8938b4591.json b/archived/symfony.ux-turbo/0103ff447478c98e6af6de14c20fa6d8938b4591.json new file mode 100644 index 00000000..676f0b96 --- /dev/null +++ b/archived/symfony.ux-turbo/0103ff447478c98e6af6de14c20fa6d8938b4591.json @@ -0,0 +1,22 @@ +{ + "manifests": { + "symfony/ux-turbo": { + "manifest": { + "conflict": { + "symfony/framework-bundle": "<7.2", + "symfony/security-csrf": "<7.2" + }, + "add-lines": [ + { + "file": "config/packages/framework.yaml", + "position": "after_target", + "target": " csrf_protection:", + "content": " check_header: true" + } + ] + }, + "files": [], + "ref": "0103ff447478c98e6af6de14c20fa6d8938b4591" + } + } +} diff --git a/index.json b/index.json index 0a542942..c0b6e46b 100644 --- a/index.json +++ b/index.json @@ -460,6 +460,7 @@ "ux-react": "symfony/ux-react", "ux-svelte": "symfony/ux-svelte", "ux-translator": "symfony/ux-translator", + "ux-turbo": "symfony/ux-turbo", "ux-twig-component": "symfony/ux-twig-component", "ux-vue": "symfony/ux-vue", "uxautocomplete": "symfony/ux-autocomplete", @@ -472,6 +473,7 @@ "uxreact": "symfony/ux-react", "uxsvelte": "symfony/ux-svelte", "uxtranslator": "symfony/ux-translator", + "uxturbo": "symfony/ux-turbo", "uxtwigcomponent": "symfony/ux-twig-component", "uxvue": "symfony/ux-vue", "validation": "symfony/validator", @@ -1016,7 +1018,8 @@ "symfony/stimulus-bundle": [ "2.8", "2.9", - "2.13" + "2.13", + "2.20" ], "symfony/sweego-mailer": [ "7.2" @@ -1103,6 +1106,9 @@ "2.8", "2.9" ], + "symfony/ux-turbo": [ + "2.20" + ], "symfony/ux-twig-component": [ "2.13" ], @@ -1313,6 +1319,12 @@ "2.13": { "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0", "symfony/webpack-encore-bundle": "<2.0" + }, + "2.20": { + "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0", + "symfony/framework-bundle": "<7.2", + "symfony/security-csrf": "<7.2", + "symfony/webpack-encore-bundle": "<2.0" } }, "symfony/twig-bundle": { @@ -1372,6 +1384,12 @@ "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0" } }, + "symfony/ux-turbo": { + "2.20": { + "symfony/framework-bundle": "<7.2", + "symfony/security-csrf": "<7.2" + } + }, "symfony/ux-vue": { "2.9": { "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0", diff --git a/symfony.framework-bundle.7.2.json b/symfony.framework-bundle.7.2.json index f18e9496..4e151e87 100644 --- a/symfony.framework-bundle.7.2.json +++ b/symfony.framework-bundle.7.2.json @@ -81,6 +81,11 @@ " #esi: true", " #fragments: true", "", + " # Enable stateless CSRF protection for forms and logins/logouts", + " form: { csrf_protection: { token_id: submit } }", + " csrf_protection:", + " stateless_token_ids: [submit, authenticate, logout]", + "", "when@test:", " framework:", " test: true", @@ -180,7 +185,7 @@ "executable": false } }, - "ref": "87bcf6f7c55201f345d8895deda46d2adbdbaa89" + "ref": "eac198b53dabc891aa5c2d93e35d86e4c217a40b" } } } diff --git a/symfony.stimulus-bundle.2.20.json b/symfony.stimulus-bundle.2.20.json new file mode 100644 index 00000000..05904408 --- /dev/null +++ b/symfony.stimulus-bundle.2.20.json @@ -0,0 +1,157 @@ +{ + "manifests": { + "symfony/stimulus-bundle": { + "manifest": { + "bundles": { + "Symfony\\UX\\StimulusBundle\\StimulusBundle": [ + "all" + ] + }, + "copy-from-recipe": { + "assets/": "assets/" + }, + "conflict": { + "symfony/framework-bundle": "<7.2", + "symfony/security-csrf": "<7.2", + "symfony/webpack-encore-bundle": "<2.0", + "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0" + }, + "add-lines": [ + { + "file": "webpack.config.js", + "content": "\n // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)\n .enableStimulusBridge('./assets/controllers.json')", + "position": "after_target", + "target": ".splitEntryChunks()" + }, + { + "file": "assets/app.js", + "content": "import './bootstrap.js';", + "position": "top", + "warn_if_missing": true + }, + { + "file": "assets/bootstrap.js", + "content": "import { startStimulusApp } from '@symfony/stimulus-bridge';\n\n// Registers Stimulus controllers from controllers.json and in the controllers/ directory\nexport const app = startStimulusApp(require.context(\n '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',\n true,\n /\\.[jt]sx?$/\n));", + "position": "top", + "requires": "symfony/webpack-encore-bundle" + }, + { + "file": "assets/bootstrap.js", + "content": "import { startStimulusApp } from '@symfony/stimulus-bundle';\n\nconst app = startStimulusApp();", + "position": "top", + "requires": "symfony/asset-mapper" + } + ] + }, + "files": { + "assets/bootstrap.js": { + "contents": [ + "// register any custom, 3rd party controllers here", + "// app.register('some_controller_name', SomeImportedController);", + "" + ], + "executable": false + }, + "assets/controllers.json": { + "contents": [ + "{", + " \"controllers\": [],", + " \"entrypoints\": []", + "}", + "" + ], + "executable": false + }, + "assets/controllers/csrf_protection_controller.js": { + "contents": [ + "var nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;", + "var tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;", + "", + "// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager", + "document.addEventListener('submit', function (event) {", + " var csrfField = event.target.querySelector('input[data-controller=\"csrf-protection\"]');", + "", + " if (!csrfField) {", + " return;", + " }", + "", + " var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');", + " var csrfToken = csrfField.value;", + "", + " if (!csrfCookie && nameCheck.test(csrfToken)) {", + " csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);", + " csrfField.value = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));", + " }", + "", + " if (csrfCookie && tokenCheck.test(csrfToken)) {", + " var cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';", + " document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;", + " }", + "});", + "", + "// When @hotwired/turbo handles form submissions, send the CSRF token in a header in addition to a cookie", + "// The `framework.csrf_protection.check_header` config option needs to be enabled for the header to be checked", + "document.addEventListener('turbo:submit-start', function (event) {", + " var csrfField = event.detail.formSubmission.formElement.querySelector('input[data-controller=\"csrf-protection\"]');", + "", + " if (!csrfField) {", + " return;", + " }", + "", + " var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');", + "", + " if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {", + " event.detail.formSubmission.fetchRequest.headers[csrfCookie] = csrfField.value;", + " }", + "});", + "", + "// When @hotwired/turbo handles form submissions, remove the CSRF cookie once a form has been submitted", + "document.addEventListener('turbo:submit-end', function (event) {", + " var csrfField = event.detail.formSubmission.formElement.querySelector('input[data-controller=\"csrf-protection\"]');", + "", + " if (!csrfField) {", + " return;", + " }", + "", + " var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');", + "", + " if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {", + " var cookie = csrfCookie + '_' + csrfField.value + '=0; path=/; samesite=strict; max-age=0';", + "", + " document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;", + " }", + "});", + "", + "/* stimulusFetch: 'lazy' */", + "export default 'csrf-protection-controller';", + "" + ], + "executable": false + }, + "assets/controllers/hello_controller.js": { + "contents": [ + "import { Controller } from '@hotwired/stimulus';", + "", + "/*", + " * This is an example Stimulus controller!", + " *", + " * Any element with a data-controller=\"hello\" attribute will cause", + " * this controller to be executed. The name \"hello\" comes from the filename:", + " * hello_controller.js -> \"hello\"", + " *", + " * Delete this file or adapt it for your use!", + " */", + "export default class extends Controller {", + " connect() {", + " this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';", + " }", + "}", + "" + ], + "executable": false + } + }, + "ref": "41c4285a926752ec2852a5cafa39e7b527c33a38" + } + } +} diff --git a/symfony.ux-turbo.2.20.json b/symfony.ux-turbo.2.20.json new file mode 100644 index 00000000..676f0b96 --- /dev/null +++ b/symfony.ux-turbo.2.20.json @@ -0,0 +1,22 @@ +{ + "manifests": { + "symfony/ux-turbo": { + "manifest": { + "conflict": { + "symfony/framework-bundle": "<7.2", + "symfony/security-csrf": "<7.2" + }, + "add-lines": [ + { + "file": "config/packages/framework.yaml", + "position": "after_target", + "target": " csrf_protection:", + "content": " check_header: true" + } + ] + }, + "files": [], + "ref": "0103ff447478c98e6af6de14c20fa6d8938b4591" + } + } +}