codeant-ai-for-open-source[bot] commented on code in PR #39469: URL: https://github.com/apache/superset/pull/39469#discussion_r3432570597
########## superset/migrations/versions/2026-04-19_14-30_b7e4f2a891c3_add_auth_audit_log_table.py: ########## @@ -0,0 +1,65 @@ +# 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. +"""add auth_audit_log table + +Revision ID: b7e4f2a891c3 +Revises: 78a40c08b4be +Create Date: 2026-04-19 14:30:00.000000 + +""" + +import uuid + +import sqlalchemy as sa +from sqlalchemy_utils import UUIDType + +from superset.migrations.shared.utils import create_table, drop_table + +# revision identifiers, used by Alembic. +revision = "b7e4f2a891c3" +down_revision = "78a40c08b4be" + + +def upgrade() -> None: + """Create the append-only authentication audit log table.""" + create_table( + "auth_audit_log", + sa.Column( + "id", + UUIDType(binary=True), + primary_key=True, + default=uuid.uuid4, + nullable=False, + ), + sa.Column("user_id", sa.Integer(), nullable=True), + sa.Column("event_type", sa.String(length=64), nullable=False), + sa.Column("ip_address", sa.String(length=256), nullable=True), + sa.Column("user_agent", sa.Text(), nullable=True), + sa.Column("metadata", sa.JSON(), nullable=True), + sa.Column("created_at", sa.DateTime(), nullable=False), + sa.ForeignKeyConstraint( + ["user_id"], + ["ab_user.id"], + name="fk_auth_audit_log_user_id_ab_user", + ondelete="SET NULL", + ), Review Comment: **Suggestion:** Replace the integer-based user reference with a UUID-based user identifier and corresponding UUID foreign key target to avoid introducing internal integer IDs in this new UUID-keyed table. [custom_rule] **Severity Level:** Minor ⚠️ <details> <summary><b>Why it matters? 🤔 </b></summary> This new table uses a UUID primary key for `id`, but it still introduces `user_id` as an integer foreign key to `ab_user.id`, which exposes an internal integer identifier in a UUID-keyed schema. That matches the custom rule against adding internal integer IDs when UUID identifiers are being added or changed. </details> [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=62d9b1d0d4d34920968a232573072fc0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=62d9b1d0d4d34920968a232573072fc0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent 🤖 </b></summary> ```mdx This is a comment left during a code review. **Path:** superset/migrations/versions/2026-04-19_14-30_b7e4f2a891c3_add_auth_audit_log_table.py **Line:** 48:59 **Comment:** *Custom Rule: Replace the integer-based user reference with a UUID-based user identifier and corresponding UUID foreign key target to avoid introducing internal integer IDs in this new UUID-keyed table. Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39469&comment_hash=e40a13ee88a64afb849de6b0c4a0e1ced3c71b9ba6e0e509b8f243f197e18476&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39469&comment_hash=e40a13ee88a64afb849de6b0c4a0e1ced3c71b9ba6e0e509b8f243f197e18476&reaction=dislike'>👎</a> -- 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]
