github-advanced-security[bot] commented on code in PR #44560: URL: https://github.com/apache/superset/pull/44560#discussion_r4079703245
########## superset/mcp_service/dashboard/layout_placement.py: ########## @@ -0,0 +1,297 @@ +# 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. + +""" +Shared layout-placement helpers for MCP tools that insert new components +into a dashboard's ``position_json`` tree. + +Extracted from ``add_chart_to_existing_dashboard`` so that other +layout-mutating tools (e.g. ``manage_dashboard_markdown``) can resolve the +same GRID/TABS insertion target and scaffold the same GRID/ROOT structure +without duplicating the tab-matching logic. +""" + +import re +from typing import Any, Dict + +from superset.mcp_service.dashboard.constants import generate_id + +# Compiled regex for stripping common emoji Unicode ranges from tab text. +# Uses specific Unicode blocks to avoid overly permissive ranges. +_EMOJI_RE = re.compile( + "[" + "\U0001f300-\U0001f5ff" # Misc Symbols and Pictographs Review Comment: ## CodeQL / Overly permissive regular expression range Suspicious character range that overlaps with \ufffd-\ufffd in the same character class. [Show more details](https://github.com/apache/superset/security/code-scanning/3896) ########## superset/mcp_service/dashboard/layout_placement.py: ########## @@ -0,0 +1,297 @@ +# 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. + +""" +Shared layout-placement helpers for MCP tools that insert new components +into a dashboard's ``position_json`` tree. + +Extracted from ``add_chart_to_existing_dashboard`` so that other +layout-mutating tools (e.g. ``manage_dashboard_markdown``) can resolve the +same GRID/TABS insertion target and scaffold the same GRID/ROOT structure +without duplicating the tab-matching logic. +""" + +import re +from typing import Any, Dict + +from superset.mcp_service.dashboard.constants import generate_id + +# Compiled regex for stripping common emoji Unicode ranges from tab text. +# Uses specific Unicode blocks to avoid overly permissive ranges. +_EMOJI_RE = re.compile( + "[" + "\U0001f300-\U0001f5ff" # Misc Symbols and Pictographs Review Comment: ## CodeQL / Overly permissive regular expression range Suspicious character range that overlaps with \ufffd-\ufffd in the same character class. [Show more details](https://github.com/apache/superset/security/code-scanning/3898) ########## superset/mcp_service/dashboard/layout_placement.py: ########## @@ -0,0 +1,297 @@ +# 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. + +""" +Shared layout-placement helpers for MCP tools that insert new components +into a dashboard's ``position_json`` tree. + +Extracted from ``add_chart_to_existing_dashboard`` so that other +layout-mutating tools (e.g. ``manage_dashboard_markdown``) can resolve the +same GRID/TABS insertion target and scaffold the same GRID/ROOT structure +without duplicating the tab-matching logic. +""" + +import re +from typing import Any, Dict + +from superset.mcp_service.dashboard.constants import generate_id + +# Compiled regex for stripping common emoji Unicode ranges from tab text. +# Uses specific Unicode blocks to avoid overly permissive ranges. +_EMOJI_RE = re.compile( + "[" + "\U0001f300-\U0001f5ff" # Misc Symbols and Pictographs Review Comment: ## CodeQL / Overly permissive regular expression range Suspicious character range that overlaps with \ufffd-\ufffd in the same character class. [Show more details](https://github.com/apache/superset/security/code-scanning/3899) ########## superset/mcp_service/dashboard/layout_placement.py: ########## @@ -0,0 +1,297 @@ +# 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. + +""" +Shared layout-placement helpers for MCP tools that insert new components +into a dashboard's ``position_json`` tree. + +Extracted from ``add_chart_to_existing_dashboard`` so that other +layout-mutating tools (e.g. ``manage_dashboard_markdown``) can resolve the +same GRID/TABS insertion target and scaffold the same GRID/ROOT structure +without duplicating the tab-matching logic. +""" + +import re +from typing import Any, Dict + +from superset.mcp_service.dashboard.constants import generate_id + +# Compiled regex for stripping common emoji Unicode ranges from tab text. +# Uses specific Unicode blocks to avoid overly permissive ranges. +_EMOJI_RE = re.compile( + "[" + "\U0001f300-\U0001f5ff" # Misc Symbols and Pictographs Review Comment: ## CodeQL / Overly permissive regular expression range Suspicious character range that overlaps with \ufffd-\ufffd in the same character class. [Show more details](https://github.com/apache/superset/security/code-scanning/3897) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
