You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "fallintoplace (via GitHub)" <gi...@apache.org> on 2026/07/25 20:41:09 UTC

[PR] fix(view): protect identifiers from mutation [iceberg-go]

fallintoplace opened a new pull request, #1543:
URL: https://github.com/apache/iceberg-go/pull/1543

   ## What changed
   
   Copy view identifiers when constructing a View and when returning Identifier.
   
   ## Why
   
   View identifiers are slices. New previously retained the caller-owned slice, and Identifier returned that same backing array. Either path allowed external mutation to change the identity of an existing View and affect equality or catalog behavior.
   
   The regression test mutates both the constructor input and the getter result.
   
   ## Testing
   
   - go test ./view
   - go vet ./view
   - go test ./...


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(view): protect identifiers from mutation [iceberg-go]

Posted by "laskoviymishka (via GitHub)" <gi...@apache.org>.
laskoviymishka commented on code in PR #1543:
URL: https://github.com/apache/iceberg-go/pull/1543#discussion_r3678316500


##########
view/view_test.go:
##########
@@ -145,3 +145,15 @@ func TestCreateViewReturnsMetadataCloseError(t *testing.T) {
 	require.EqualError(t, err, "error on close")
 	require.Nil(t, createdView)
 }
+
+func (t *ViewTestSuite) TestIdentifierReturnsDefensiveCopy() {
+	identifier := []string{"namespace", "view"}
+	vw := New(identifier, nil, "metadata.json")

Review Comment:
   the `nil` `Metadata` is safe today since we only touch `Identifier()`, but it's a sharp edge — any future assertion that reaches into the metadata (equality, `CurrentVersion()`) nil-derefs with an opaque panic.
   
   I'd either build a minimal `Metadata` or drop a one-line comment that nil is intentional because this test only exercises identifier isolation. wdyt?



##########
view/view_test.go:
##########
@@ -145,3 +145,15 @@ func TestCreateViewReturnsMetadataCloseError(t *testing.T) {
 	require.EqualError(t, err, "error on close")
 	require.Nil(t, createdView)
 }
+
+func (t *ViewTestSuite) TestIdentifierReturnsDefensiveCopy() {

Review Comment:
   tiny thing while we're here — this suite method landed after the standalone `TestCreateViewReturnsMetadataCloseError` func. Testify wires it up fine either way, but it'd read cleaner grouped with the other `*ViewTestSuite` methods above.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(view): protect identifiers from mutation [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on PR #1543:
URL: https://github.com/apache/iceberg-go/pull/1543#issuecomment-5096640300

   Approved and good to go — this just needs a rebase on main. #1542 landed in view/view.go just ahead of it, so GitHub now flags a conflict. Could you rebase, @fallintoplace? I will merge once it is green.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(view): protect identifiers from mutation [iceberg-go]

Posted by "laskoviymishka (via GitHub)" <gi...@apache.org>.
laskoviymishka merged PR #1543:
URL: https://github.com/apache/iceberg-go/pull/1543


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org