Merge branch 'main' into avm99963-monorail

Merged commit 3779da353b36d43cf778e7d4f468097714dd4540

GitOrigin-RevId: 6451a5c6b75afb0fd1f37b3f14521148d0722ea8
diff --git a/flaskregisterpages.py b/flaskregisterpages.py
index af73a7f..4b01785 100644
--- a/flaskregisterpages.py
+++ b/flaskregisterpages.py
@@ -16,6 +16,7 @@
 from features import userhotlists
 from framework import banned
 from framework import clientmon
+from framework import csp_report
 from framework import warmup
 from framework import reap
 from framework import deleteusers
@@ -139,22 +140,22 @@
   def RegisterGroupUrls(self, services):
     flaskapp_group = flask.Flask(__name__)
     _GROUP_URL = [
-        # ('/', grouplist.GroupList(services=services).GetGroupList, ['GET']),
-        # (
-        #     '/<string:viewed_username>/',
-        #     groupdetail.GroupDetail(services=services).GetGroupDetail,
-        #     ['GET']),
-        # (
-        #     '/<string:viewed_username>/edit.do',
-        #     groupdetail.GroupDetail(services=services).PostGroupDetail,
-        #     ['POST']),
-        # (
-        #     '/<string:viewed_username>/groupadmin',
-        #     groupadmin.GroupAdmin(services=services).GetGroupAdmin, ['GET']),
-        # (
-        #     '/<string:viewed_username>/groupadmin.do',
-        #     groupadmin.GroupAdmin(services=services).PostGroupAdmin,
-        #     ['POST']),
+        (
+            '/', grouplist.FlaskGroupList(services=services).GetGroupList,
+            ['GET']),
+        (
+            '/<string:viewed_username>/',
+            groupdetail.GroupDetail(services=services).GetGroupDetail, ['GET']),
+        (
+            '/<string:viewed_username>/edit.do',
+            groupdetail.GroupDetail(services=services).PostGroupDetail,
+            ['POST']),
+        (
+            '/<string:viewed_username>/groupadmin',
+            groupadmin.GroupAdmin(services=services).GetGroupAdmin, ['GET']),
+        (
+            '/<string:viewed_username>/groupadmin.do',
+            groupadmin.GroupAdmin(services=services).PostGroupAdmin, ['POST']),
     ]
 
     return self._AddFlaskUrlRules(flaskapp_group, _GROUP_URL)
@@ -163,55 +164,52 @@
   def RegisterHostingUrl(self, service):
     flaskapp_hosting = flask.Flask(__name__)
     _HOSTING_URL = [
-        # (
-        #     '/excessiveActivity',
-        #     excessiveactivity.ExcessiveActivity(
-        #         services=service).GetExcessiveActivity, ['GET']),
-        # (
-        #     '/settings',
-        #     usersettings.UserSettings(services=service).GetUserSetting, ['GET'
-        #                                                                 ]),
-        # (
-        #     '/settings.do',
-        #     usersettings.UserSettings(services=service).PostUserSetting,
-        #     ['POST']),
-        # ('/noAccess', banned.Banned(services=service).GetNoAccessPage,
-        #   ['GET']),
-        # (
-        #     '/moved', moved.ProjectMoved(services=service).GetProjectMoved,
-        #     ['GET']),
-        # (
-        #     '/createProject',
-        #     projectcreate.ProjectCreate(services=service).GetCreateProject,
-        #     ['GET']),
-        # (
-        #     '/createProject.do',
-        #     projectcreate.ProjectCreate(services=service).PostCreateProject,
-        #     ['POST']),
-        # (
-        #     '/createHotlist',
-        #     hotlistcreate.HotlistCreate(services=service).GetCreateHotlist,
-        #     ['GET']),
-        # (
-        #     '/createHotlist.do',
-        #     hotlistcreate.HotlistCreate(services=service).PostCreateHotlist,
-        #     ['POST']),
-        # (
-        #     '/createGroup',
-        #     groupcreate.GroupCreate(services=service).GetGroupCreate,
-        #     ['GET']),
-        # (
-        #     '/createGroup.do',
-        #     groupcreate.GroupCreate(services=service).PostGroupCreate,
-        #     ['POST']),
-        # (
-        #     '/deleteGroup',
-        #     grouplist.GroupDelete(services=service).GetGroupDelete,
-        #     ['GET']),
-        # (
-        #     '/deleteGroup.do',
-        #     grouplist.GroupDelete(services=service).PostGroupDelete,
-        #     ['POST']),
+        (
+            '/excessiveActivity',
+            excessiveactivity.ExcessiveActivity(
+                services=service).GetExcessiveActivity, ['GET']),
+        (
+            '/settings',
+            usersettings.UserSettings(services=service).GetUserSetting, ['GET'
+                                                                        ]),
+        (
+            '/settings.do',
+            usersettings.UserSettings(services=service).PostUserSetting,
+            ['POST']),
+        ('/noAccess', banned.Banned(services=service).GetNoAccessPage, ['GET']),
+        (
+            '/moved', moved.ProjectMoved(services=service).GetProjectMoved,
+            ['GET']),
+        (
+            '/createProject',
+            projectcreate.ProjectCreate(services=service).GetCreateProject,
+            ['GET']),
+        (
+            '/createProject.do',
+            projectcreate.ProjectCreate(services=service).PostCreateProject,
+            ['POST']),
+        (
+            '/createHotlist',
+            hotlistcreate.HotlistCreate(services=service).GetCreateHotlist,
+            ['GET']),
+        (
+            '/createHotlist.do',
+            hotlistcreate.HotlistCreate(services=service).PostCreateHotlist,
+            ['POST']),
+        (
+            '/createGroup',
+            groupcreate.GroupCreate(services=service).GetGroupCreate, ['GET']),
+        (
+            '/createGroup.do',
+            groupcreate.GroupCreate(services=service).PostGroupCreate, ['POST'
+                                                                       ]),
+        (
+            '/deleteGroup',
+            grouplist.FlaskGroupList(services=service).GetGroupDelete, ['GET']),
+        (
+            '/deleteGroup.do',
+            grouplist.FlaskGroupList(services=service).PostGroupDelete,
+            ['POST']),
     ]
 
     flaskapp_hosting = self._AddFlaskUrlRules(flaskapp_hosting, _HOSTING_URL)
@@ -246,6 +244,13 @@
 
     return flaskapp_project_redirect
 
+  def RegisterCspUrl(self):
+    flaskapp_csp = flask.Flask(__name__)
+    flaskapp_csp.add_url_rule(
+        '/', view_func=csp_report.postCsp, methods=['POST'])
+
+    return flaskapp_csp
+
   def RegisterProjectUrls(self, service):
     flaskapp_project = flask.Flask(__name__)
     _PROJECT_URLS = [
@@ -668,114 +673,61 @@
   def RegisterTaskUrl(self, service):
     flaskapp_task = flask.Flask(__name__)
     _TASK_URL = [
-        # (
-        #     '/banSpammer',
-        #     banspammer.BanSpammerTask(services=service).GetBanSpammer,
-        #     ['GET']),
-        # (
-        #     '/banSpammer.do',
-        #     banspammer.BanSpammerTask(services=service).PostBanSpammer,
-        #     ['POST']),
-        # (
-        #     '/sendWipeoutUserListsTask',
-        #     deleteusers.SendWipeoutUserListsTask(
-        #         services=service).GetSendWipeoutUserListsTask, ['GET']),
-        # (
-        #     '/sendWipeoutUserListsTask.do',
-        #     deleteusers.SendWipeoutUserListsTask(
-        #         services=service).PostSendWipeoutUserListsTask, ['POST']),
-        # (
-        #     '/deleteWipeoutUsersTask',
-        #     deleteusers.DeleteWipeoutUsersTask(
-        #         services=service).GetDeleteWipeoutUsersTask, ['GET']),
-        # (
-        #     '/deleteWipeoutUsersTask.do',
-        #     deleteusers.DeleteWipeoutUsersTask(
-        #         services=service).PostDeleteWipeoutUsersTask, ['POST']),
-        # (
-        #     '/deleteUsersTask',
-        #     deleteusers.DeleteUsersTask(services=service).GetDeleteUsersTask,
-        #     ['GET']),
-        # (
-        #     '/deleteUsersTask.do',
-        #     deleteusers.DeleteUsersTask(services=service).PostDeleteUsersTask,
-        #     ['POST']),
-        # (
-        #     '/notifyRulesDeleted',
-        #     notify.NotifyRulesDeletedTask(
-        #         services=service).GetNotifyRulesDeletedTask, ['GET']),
-        # (
-        #     '/notifyRulesDeleted.do',
-        #     notify.NotifyRulesDeletedTask(
-        #         services=service).PostNotifyRulesDeletedTask, ['POST']),
-        # (
-        #     '/notifyIssueChange', notify.NotifyIssueChangeTask(
-        #         services=service).GetNotifyIssueChangeTask, ['GET']),
-        # (
-        #     '/notifyIssueChange.do',
-        #     notify.NotifyIssueChangeTask(
-        #         services=service).PostNotifyIssueChangeTask, ['POST']),
-        # (
-        #     '/notifyBlockingChange',
-        #     notify.NotifyBlockingChangeTask(
-        #         services=service).GetNotifyBlockingChangeTask, ['GET']),
-        # (
-        #     '/notifyBlockingChange.do',
-        #     notify.NotifyBlockingChangeTask(
-        #         services=service).PostNotifyBlockingChangeTask, ['POST']),
-        # (
-        #     '/notifyBulkEdit', notify.NotifyBulkChangeTask(
-        #         services=service).GetNotifyBulkChangeTask, ['GET']),
-        # (
-        #     '/notifyBulkEdit.do', notify.NotifyBulkChangeTask(
-        #         services=service).PostNotifyBulkChangeTask, ['POST']),
-        # (
-        #     '/notifyApprovalChange',
-        #     notify.NotifyApprovalChangeTask(
-        #         services=service).GetNotifyApprovalChangeTask, ['GET']),
-        # (
-        #     '/notifyApprovalChange.do',
-        #     notify.NotifyApprovalChangeTask(
-        #         services=service).PostNotifyApprovalChangeTask, ['POST']),
-        # (
-        #     '/publishPubsubIssueChange',
-        #     pubsub.PublishPubsubIssueChangeTask(
-        #         services=service).GetPublishPubsubIssueChangeTask, ['GET']),
-        # (
-        #     '/publishPubsubIssueChange.do',
-        #     pubsub.PublishPubsubIssueChangeTask(
-        #         services=service).PostPublishPubsubIssueChangeTask, ['POST']),
-        # (
-        #     '/issueDateAction', dateaction.IssueDateActionTask(
-        #         services=service).GetIssueDateActionTask, ['GET']),
-        # (
-        #     '/issueDateAction.do',
-        #     dateaction.IssueDateActionTask(
-        #         services=service).PostIssueDateActionTask, ['POST']),
-        # (
-        #     '/fltConversionTask',
-        #     fltconversion.FLTConvertTask(services=service).GetFLTConvertTask,
-        #     ['GET']),
-        # (
-        #     '/fltConversionTask.do',
-        #     fltconversion.FLTConvertTask(services=service).PostFLTConvertTask,
-        #     ['POST']),
-        # (
-        #     '/outboundEmail',
-        #     notify.OutboundEmailTask(services=service).GetOutboundEmailTask,
-        #     ['GET']),
-        # (
-        #     '/outboundEmail.do',
-        #     notify.OutboundEmailTask(services=service).PostOutboundEmailTask,
-        #     ['POST']),
-        # (
-        #     '/recomputeDerivedFields',
-        #     filterrules.RecomputeDerivedFieldsTask(
-        #         services=service).GetRecomputeDerivedFieldsTask, ['GET']),
-        # (
-        #     '/recomputeDerivedFields.do',
-        #     filterrules.RecomputeDerivedFieldsTask(
-        #         services=service).PostRecomputeDerivedFieldsTask, ['POST']),
+        (
+            '/banSpammer.do',
+            banspammer.BanSpammerTask(services=service).PostBanSpammer,
+            ['POST']),
+        (
+            '/sendWipeoutUserListsTask.do',
+            deleteusers.SendWipeoutUserListsTask(
+                services=service).PostSendWipeoutUserListsTask, ['POST']),
+        (
+            '/deleteWipeoutUsersTask.do',
+            deleteusers.DeleteWipeoutUsersTask(
+                services=service).PostDeleteWipeoutUsersTask, ['POST']),
+        (
+            '/deleteUsersTask.do',
+            deleteusers.DeleteUsersTask(services=service).PostDeleteUsersTask,
+            ['POST']),
+        (
+            '/notifyRulesDeleted.do',
+            notify.NotifyRulesDeletedTask(
+                services=service).PostNotifyRulesDeletedTask, ['POST']),
+        (
+            '/notifyIssueChange.do',
+            notify.NotifyIssueChangeTask(
+                services=service).PostNotifyIssueChangeTask, ['POST']),
+        (
+            '/notifyBlockingChange.do',
+            notify.NotifyBlockingChangeTask(
+                services=service).PostNotifyBlockingChangeTask, ['POST']),
+        (
+            '/notifyBulkEdit.do', notify.NotifyBulkChangeTask(
+                services=service).PostNotifyBulkChangeTask, ['POST']),
+        (
+            '/notifyApprovalChange.do',
+            notify.NotifyApprovalChangeTask(
+                services=service).PostNotifyApprovalChangeTask, ['POST']),
+        (
+            '/publishPubsubIssueChange.do',
+            pubsub.PublishPubsubIssueChangeTask(
+                services=service).PostPublishPubsubIssueChangeTask, ['POST']),
+        (
+            '/issueDateAction.do',
+            dateaction.IssueDateActionTask(
+                services=service).PostIssueDateActionTask, ['POST']),
+        (
+            '/fltConversionTask.do',
+            fltconversion.FLTConvertTask(services=service).PostFLTConvertTask,
+            ['POST']),
+        (
+            '/outboundEmail.do',
+            notify.OutboundEmailTask(services=service).PostOutboundEmailTask,
+            ['POST']),
+        (
+            '/recomputeDerivedFields.do',
+            filterrules.RecomputeDerivedFieldsTask(
+                services=service).PostRecomputeDerivedFieldsTask, ['POST']),
     ]
 
     for rule in _TASK_URL:
@@ -787,54 +739,30 @@
   def RegisterCronUrl(self, service):
     flaskapp_cron = flask.Flask(__name__)
     _CRON_URL = [
-        # (
-        #     '/wipeoutSync',
-        #     deleteusers.WipeoutSyncCron(services=service).GetWipeoutSyncCron,
-        #     ['GET']),
-        # (
-        #     '/wipeoutSync.do',
-        #     deleteusers.WipeoutSyncCron(services=service).PostWipeoutSyncCron,
-        #     ['POST']),
-        # (
-        #     '/reindexQueue',
-        #     filterrules.ReindexQueueCron(
-        #       services=service).GetReindexQueueCron,
-        #     ['GET']),
-        # (
-        #     '/reindexQueue.do',
-        #     filterrules.ReindexQueueCron(
-        #       services=service).PostReindexQueueCron,
-        #     ['POST']),
-        # (
-        #     '/dateAction',
-        #     dateaction.DateActionCron(services=service).GetDateActionCron,
-        #     ['GET']),
-        # (
-        #     '/dateAction.do',
-        #     dateaction.DateActionCron(services=service).PostDateActionCron,
-        #     ['POST']),
-        # (
-        #     '/ramCacheConsolidate',
-        #     cachemanager_svc.RamCacheConsolidate(
-        #         services=service).GetRamCacheConsolidate, ['GET']),
-        # (
-        #     '/ramCacheConsolidate.do',
-        #     cachemanager_svc.RamCacheConsolidate(
-        #         services=service).PostRamCacheConsolidate, ['POST']),
-        # ('/reap', reap.Reap(services=service).GetReap, ['GET']),
-        # ('/reap.do', reap.Reap(services=service).PostReap, ['POST']),
-        # (
-        #     '/loadApiClientConfigs',
-        #     client_config_svc.LoadApiClientConfigs().GetLoadApiClientConfigs,
-        #     ['GET']),
-        # (
-        #     '/trimVisitedPages',
-        #     trimvisitedpages.TrimVisitedPages(
-        #         services=service).GetTrimVisitedPages, ['GET']),
-        # (
-        #     '/trimVisitedPages.do',
-        #     trimvisitedpages.TrimVisitedPages(
-        #         services=service).PostTrimVisitedPages, ['POST']),
+        (
+            '/wipeoutSync',
+            deleteusers.WipeoutSyncCron(services=service).GetWipeoutSyncCron,
+            ['GET']),
+        (
+            '/reindexQueue',
+            filterrules.ReindexQueueCron(services=service).GetReindexQueueCron,
+            ['GET']),
+        (
+            '/dateAction',
+            dateaction.DateActionCron(services=service).GetDateActionCron,
+            ['GET']),
+        (
+            '/ramCacheConsolidate',
+            cachemanager_svc.RamCacheConsolidate(
+                services=service).GetRamCacheConsolidate, ['GET']),
+        ('/reap', reap.Reap(services=service).GetReap, ['GET']),
+        (
+            '/loadApiClientConfigs', client_config_svc.GetLoadApiClientConfigs,
+            ['GET']),
+        (
+            '/trimVisitedPages',
+            trimvisitedpages.TrimVisitedPages(
+                services=service).GetTrimVisitedPages, ['GET']),
     ]
 
     for rule in _CRON_URL:
@@ -846,24 +774,14 @@
   def RegisterBackendUrl(self, service):
     flaskapp_backend = flask.Flask(__name__)
     _BACKEND_URL = [
-        # (
-        #     '/search',
-        #     backendsearch.BackendSearch(services=service).GetBackendSearch,
-        #     ['GET']),
-        # (
-        #     '/search.do',
-        #     backendsearch.BackendSearch(services=service).PostBackendSearch,
-        #     ['POST']),
-        # (
-        #     '/nonviewable',
-        #     backendnonviewable.BackendNonviewable(
-        #         services=service).GetBackendNonviewable,
-        #     ['GET']),
-        # (
-        #     '/nonviewable.do',
-        #     backendnonviewable.BackendNonviewable(
-        #        services=service).PostBackendNonviewable,
-        #     ['POST']),
+        (
+            '/search',
+            backendsearch.BackendSearch(services=service).GetBackendSearch,
+            ['GET']),
+        (
+            '/nonviewable',
+            backendnonviewable.BackendNonviewable(
+                services=service).GetBackendNonviewable, ['GET']),
     ]
 
     for rule in _BACKEND_URL:
@@ -875,40 +793,34 @@
   def RegisterMONSetUrl(self, service):
     flaskapp_mon = flask.Flask(__name__)
     _MON_URL = [
-        # (
-        #     '/clientmon',
-        #     clientmon.ClientMonitor(services=service).GetClientMonitor, ['GET'
-        #                                                                 ]),
-        # (
-        #     '/clientmon.do',
-        #     clientmon.ClientMonitor(services=service).PostClientMonitor,
-        #     ['POST']),
-        # (
-        #     '/jstsmon.do',
-        #     ts_mon_js.FlaskMonorailTSMonJSHandler(
-        #         services=service).PostMonorailTSMonJSHandler,
-        #     ['POST'],
-        # )
+        (
+            '/clientmon.do',
+            clientmon.ClientMonitor(services=service).PostClientMonitor,
+            ['POST']),
+        (
+            '/jstsmon.do',
+            ts_mon_js.FlaskMonorailTSMonJSHandler(
+                services=service).PostMonorailTSMonJSHandler,
+            ['POST'],
+        )
     ]
 
     flaskapp_mon = self._AddFlaskUrlRules(flaskapp_mon, _MON_URL)
     return flaskapp_mon
 
-  # pylint: disable=unused-argument
   def RegisterAHUrl(self, service):
     flaskapp_ah = flask.Flask(__name__)
     _AH_URL = [
-        # ('/warmup', warmup.Warmup(services=service).GetWarmup, ['GET']),
-        # ('/start', warmup.Start(services=service).GetStart, ['GET']),
-        # ('/stop', warmup.Stop(services=service).GetStop, ['GET']),
-        # (
-        #     '/bounce',
-        #     inboundemail.BouncedEmail(services=service).postBouncedEmail,
-        #     ['POST']),
-        # (
-        #     '/mail/<string:project_addr>',
-        #     inboundemail.InboundEmail(services=service).HandleInboundEmail,
-        #     ['GET', 'POST'])
+        ('/warmup', warmup.Warmup, ['GET']), ('/start', warmup.Start, ['GET']),
+        ('/stop', warmup.Stop, ['GET']),
+        (
+            '/bounce',
+            inboundemail.BouncedEmail(services=service).postBouncedEmail,
+            ['POST']),
+        (
+            '/mail/<string:project_addr>',
+            inboundemail.InboundEmail(services=service).HandleInboundEmail,
+            ['GET', 'POST'])
     ]
 
     flaskapp_ah = self._AddFlaskUrlRules(flaskapp_ah, _AH_URL)