This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/release/v1.2/pr-9131-5bf52ec17641af551990508a29c989b18705c2b3
in repository https://gitbox.apache.org/repos/asf/texera.git

commit cbfe3321fc32261dba732bf583312ad23f541a2e
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 4 04:16:52 2026 +0000

    fix(v1.2): strip the development forum's accounts and sessions from the 
Flarum seed (#9131)
    
    ### What changes were proposed in this PR?
    
    Automated backport of #9127 to `release/v1.2`.
    
    Source: d108cc19fda36c7b8aa1b68dfc934c1c3563b99b ยท [automation
    run](https://github.com/apache/texera/actions/runs/40155367470)
    
    ### Any related issues, documentation, discussions?
    
    Backport of #9127. Originally linked #9126.
    
    ### How was this PR tested?
    
    Release-branch CI runs on this branch once the conflicts are resolved
    and this PR is marked ready for review.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    No.
    
    ---------
    
    Co-authored-by: Meng Wang <[email protected]>
    Co-authored-by: mengw15 <[email protected]>
---
 bin/extend.php                                     | 27 ++++++++++++++++++++++
 bin/forum/flarum.sql                               |  7 ++----
 bin/forum/macos-install.sh                         |  1 +
 bin/forum/ubuntu-install.sh                        |  1 +
 .../service/user/flarum/flarum.service.ts          | 12 ++++------
 5 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/bin/extend.php b/bin/extend.php
new file mode 100644
index 0000000000..11328a914b
--- /dev/null
+++ b/bin/extend.php
@@ -0,0 +1,27 @@
+<?php
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use Flarum\Extend;
+
+// The Texera dashboard signs users up to the forum through Flarum's API
+// (FlarumService.register). Flarum exempts only its login route from CSRF
+// checks, so exempt the sign-up route too. Whether anyone may sign up is still
+// decided by the forum's allow_sign_up setting.
+return [
+    (new Extend\Csrf())->exemptRoute('users.create'),
+];
diff --git a/bin/forum/flarum.sql b/bin/forum/flarum.sql
index 743b730eac..857ce2211a 100644
--- a/bin/forum/flarum.sql
+++ b/bin/forum/flarum.sql
@@ -66,7 +66,6 @@ CREATE TABLE `access_tokens` (
 
 LOCK TABLES `access_tokens` WRITE;
 /*!40000 ALTER TABLE `access_tokens` DISABLE KEYS */;
-INSERT INTO `access_tokens` VALUES 
(1,'IgO67IH27IxOvvtgXvET4KHleDvf5TjEmGxSp14r',1,'2023-09-30 
20:58:55','2023-09-30 
20:58:55','session_remember',NULL,NULL,NULL),(3,'4r7sjWlKaN9uEH45Fh2AyDXtrMjficVfUUqJ8dhe',1,'2023-09-30
 21:27:35','2023-09-30 
21:27:35','session_remember',NULL,'::1','PostmanRuntime/7.32.3'),(4,'YCA69PvpLrUj8EKaRewSRPxzl16TjBPWOoO43EyG',1,'2023-09-30
 21:27:57','2023-09-30 21:27:57','session_remember',NULL,'::1','Mozilla/5.0 
(Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/ [...]
 /*!40000 ALTER TABLE `access_tokens` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -98,7 +97,6 @@ CREATE TABLE `api_keys` (
 
 LOCK TABLES `api_keys` WRITE;
 /*!40000 ALTER TABLE `api_keys` DISABLE KEYS */;
-INSERT INTO `api_keys` VALUES 
('hdebsyxiigyklxgsqivyswwiisohzlnezzzzzzzz',1,NULL,NULL,NULL,'2023-09-30 
21:19:35','2023-10-01 04:14:27');
 /*!40000 ALTER TABLE `api_keys` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -187,7 +185,6 @@ CREATE TABLE `discussion_views` (
 
 LOCK TABLES `discussion_views` WRITE;
 /*!40000 ALTER TABLE `discussion_views` DISABLE KEYS */;
-INSERT INTO `discussion_views` VALUES (1,4,5,'128.195.14.114','2024-01-09 
00:41:35'),(6,NULL,5,'128.195.14.114','2024-01-09 03:15:01');
 /*!40000 ALTER TABLE `discussion_views` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -720,7 +717,7 @@ CREATE TABLE `posts` (
 
 LOCK TABLES `posts` WRITE;
 /*!40000 ALTER TABLE `posts` DISABLE KEYS */;
-INSERT INTO `posts` VALUES (2,2,1,'2023-10-09 
19:31:56',1,'comment','<t><p>idk</p></t>',NULL,NULL,NULL,NULL,'::1',0,1,0,0),(3,3,1,'2023-10-09
 19:46:22',1,'comment','<r><p><STRONG><s>**</s>sxxbnsb 
nxsbxsxnsx<e>**</e></STRONG></p></r>',NULL,NULL,NULL,NULL,'::1',0,1,0,1),(4,3,2,'2023-10-09
 
19:46:54',1,'comment','<t><p>fjyfj</p></t>',NULL,NULL,NULL,NULL,'::1',0,1,0,1),(5,3,3,'2023-10-09
 19:47:12',1,'comment','<r> <p><USERMENTION displayname=\"myAdmin\" 
id=\"1\">@myAdmin</USERMENTION></p> \n< [...]
+INSERT INTO `posts` VALUES (2,2,1,'2023-10-09 
19:31:56',1,'comment','<t><p>idk</p></t>',NULL,NULL,NULL,NULL,NULL,0,1,0,0),(3,3,1,'2023-10-09
 19:46:22',1,'comment','<r><p><STRONG><s>**</s>sxxbnsb 
nxsbxsxnsx<e>**</e></STRONG></p></r>',NULL,NULL,NULL,NULL,NULL,0,1,0,1),(4,3,2,'2023-10-09
 
19:46:54',1,'comment','<t><p>fjyfj</p></t>',NULL,NULL,NULL,NULL,NULL,0,1,0,1),(5,3,3,'2023-10-09
 19:47:12',1,'comment','<r> <p><USERMENTION displayname=\"myAdmin\" 
id=\"1\">@myAdmin</USERMENTION></p> \n</r> [...]
 /*!40000 ALTER TABLE `posts` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -932,7 +929,7 @@ CREATE TABLE `users` (
 
 LOCK TABLES `users` WRITE;
 /*!40000 ALTER TABLE `users` DISABLE KEYS */;
-INSERT INTO `users` VALUES 
(1,'myAdmin',NULL,'[email protected]',1,'$2a$10$0raoWm.MtGloDa95/CDgne54rX9uoa4RlmeoCA.ce9V1axfIHECSK',NULL,NULL,'2023-09-30
 20:58:55','2024-01-09 03:24:06',NULL,'2023-10-17 03:07:23',3,49,'2023-10-16 
06:52:14',NULL,NULL,NULL,0),(4,'[email protected]',NULL,'[email protected]',1,'$2a$10$63ISJ9VtBtA7R33QqNWLxeqb9Qqg97nq6D8E4sSAfIiquLcSO9XHC',NULL,NULL,NULL,'2024-01-09
 
00:51:18',NULL,NULL,1,1,NULL,NULL,NULL,NULL,0),(6,'[email protected]',NULL,'[email protected]',
 [...]
+INSERT INTO `users` VALUES 
(1,'myAdmin',NULL,'[email protected]',1,'',NULL,NULL,'2023-09-30 
20:58:55','2024-01-09 03:24:06',NULL,'2023-10-17 03:07:23',3,49,'2023-10-16 
06:52:14',NULL,NULL,NULL,0),(4,'user4',NULL,'[email protected]',1,'',NULL,NULL,NULL,'2024-01-09
 
00:51:18',NULL,NULL,1,1,NULL,NULL,NULL,NULL,0),(6,'user6',NULL,'[email protected]',1,'',NULL,NULL,NULL,'2024-01-09
 02:54:23',NULL,'2024-01-09 02:55:22',0,0,NULL,NULL,NULL,NULL,0);
 /*!40000 ALTER TABLE `users` ENABLE KEYS */;
 UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
diff --git a/bin/forum/macos-install.sh b/bin/forum/macos-install.sh
index f38b0b972d..a33002228c 100755
--- a/bin/forum/macos-install.sh
+++ b/bin/forum/macos-install.sh
@@ -29,6 +29,7 @@ composer create-project flarum/flarum 
/opt/homebrew/var/www/flarum
 composer require --working-dir=/opt/homebrew/var/www/flarum 
michaelbelgium/flarum-discussion-views
 composer require --working-dir=/opt/homebrew/var/www/flarum fof/byobu:"*"
 cp config.php /opt/homebrew/var/www/flarum/config.php
+cp extend.php /opt/homebrew/var/www/flarum/extend.php
 cp .htaccess /opt/homebrew/var/www/flarum/public/.htaccess
 
 # Database Configuration
diff --git a/bin/forum/ubuntu-install.sh b/bin/forum/ubuntu-install.sh
index e4d7c11952..bd96434507 100755
--- a/bin/forum/ubuntu-install.sh
+++ b/bin/forum/ubuntu-install.sh
@@ -32,6 +32,7 @@ composer create-project flarum/flarum /opt/flarum
 composer require --working-dir=/opt/flarum 
michaelbelgium/flarum-discussion-views
 composer require --working-dir=/opt/flarum fof/byobu:"*"
 sudo cp bin/config.php /opt/flarum/config.php
+sudo cp bin/extend.php /opt/flarum/extend.php
 sudo cp bin/.htaccess /opt/flarum/public/.htaccess
 sudo chown -R www-data:www-data /opt/flarum
 sudo mysql -u root -p < sql/flarum.sql
diff --git a/frontend/src/app/dashboard/service/user/flarum/flarum.service.ts 
b/frontend/src/app/dashboard/service/user/flarum/flarum.service.ts
index 3e2722621b..98da83eaca 100644
--- a/frontend/src/app/dashboard/service/user/flarum/flarum.service.ts
+++ b/frontend/src/app/dashboard/service/user/flarum/flarum.service.ts
@@ -32,15 +32,11 @@ export class FlarumService {
 
   register() {
     const user = this.userService.getCurrentUser();
-    return this.http.post(
-      "forum/api/users",
-      {
-        data: {
-          attributes: { username: user!.email.split("@")[0] + user!.uid, 
email: user!.email, password: user!.googleId },
-        },
+    return this.http.post("forum/api/users", {
+      data: {
+        attributes: { username: user!.email.split("@")[0] + user!.uid, email: 
user!.email, password: user!.googleId },
       },
-      { headers: { Authorization: "Token 
hdebsyxiigyklxgsqivyswwiisohzlnezzzzzzzz;userId=1" } }
-    );
+    });
   }
 
   auth() {

Reply via email to