Skip to content

fix(assets): validate parent_qualified_name in DynamoDBAttribute creator#820

Open
fyzanshaik-atlan wants to merge 1 commit intoadd-dynamo-db-attributefrom
fix/dynamo-db-attribute-parent-qn-validation
Open

fix(assets): validate parent_qualified_name in DynamoDBAttribute creator#820
fyzanshaik-atlan wants to merge 1 commit intoadd-dynamo-db-attributefrom
fix/dynamo-db-attribute-parent-qn-validation

Conversation

@fyzanshaik-atlan
Copy link
Contributor

Summary

  • Validate parent_qualified_name has exactly 4 segments upfront in DynamoDBAttribute.Attributes.create(), regardless of whether connection_qualified_name is provided
  • Previously, supplying connection_qualified_name bypassed the get_connector_name(..., qualified_name_len=4) call, which was the only check on parent_qualified_name shape. This could produce an IndexError at fields[3] for short names or silently build malformed assets for overly long ones
  • Add parameterized tests covering both too-short and too-long parent_qualified_name when connection_qualified_name is explicitly set

Test plan

  • All 15 DynamoDBAttribute unit tests pass (pytest tests/unit/model/dynamo_db_attribute_test.py -x -q)
  • New tests confirm ValueError is raised for invalid parent_qualified_name even when connection_qualified_name is provided

…_name is provided

The DynamoDBAttribute creator skipped parent_qualified_name shape
validation when an explicit connection_qualified_name was supplied.
This could produce an IndexError for short qualified names or
silently build malformed assets for overly long ones. Validate
segment count upfront regardless of which branch is taken.
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@fyzanshaik-atlan
Copy link
Contributor Author

Code Review

This PR fixes a validation gap in DynamoDBAttribute.Attributes.create() where the shape of parent_qualified_name (expected: exactly 4 /-delimited segments) was only validated in the else branch via get_connector_name(..., qualified_name_len=4). By moving the fields = parent_qualified_name.split("/") and adding a len(fields) != 4 guard above the if/else branch, the check now runs unconditionally -- regardless of whether the caller provides connection_qualified_name. Two parameterized test cases cover the previously unguarded paths (too-short and too-long qualified names with an explicit connection).

Confidence Score: 5/5

  • Safe to merge. The fix is minimal, targeted, and addresses a real correctness issue without changing any existing behavior for valid inputs.
  • Checked for: bugs, security, correctness of validation logic, backward compatibility (Python 3.9+), test coverage, and code standards compliance.
  • No points deducted. The change is a root-cause fix for the validation gap introduced in PR feat(assets): add DynamoDBAttribute asset class #819, with full test coverage for the newly guarded paths.
Important Files Changed
File Change Risk
pyatlan/model/assets/dynamo_d_b_attribute.py Modified Low
tests/unit/model/dynamo_db_attribute_test.py Modified Low

Change Flow

A sequence diagram is not needed for this change. The fix adds an upfront guard (len(fields) != 4) to a single method without altering any component interactions or architectural flow. The before/after is captured concisely:

  • Before: parent_qualified_name shape was validated only when connection_qualified_name was absent (via get_connector_name(..., qualified_name_len=4) in the else branch). Supplying connection_qualified_name with a malformed parent would either IndexError at fields[3] or silently build an invalid asset.
  • After: Segment count is checked unconditionally before the branch. Both paths now receive a validated fields array.

Findings

No issues found. Checked for bugs, security, and code standards compliance.

--
Reviewed with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant