rshdhere opened a new issue, #18475:
URL: https://github.com/apache/iceberg/issues/18475

   ### Apache Iceberg version
   
   main (development)
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   **Problem**
   
   `NessieIcebergClient.listNamespaces` builds a CEL filter for child 
namespaces by putting the parent's name inside a single-quoted string literal, 
without escaping it:
   
   ```java
   "size(entry.keyElements) == %d && entry.encodedKey.startsWith('%s.')"
   ```
   
   So listing the children of a namespace whose name contains `'` or `\` 
breaks, with both Nessie API v1 and v2:
   
   - `catalog.listNamespaces(Namespace.of("o'brien"))` fails with 
`NessieBadRequestException: Bad Request (HTTP/400): ... ScriptCreateException: 
parse failed: ... Syntax error: mismatched input 'brien'`, because the quote 
ends the literal early.
   - `catalog.listNamespaces(Namespace.of("a\\b"))` returns an empty list 
instead of `a\b.c`, because CEL reads `\b` as an escape sequence.
   
   Creating, loading and dropping these namespaces works; only listing their 
children is affected.
   
   **Proposal**
   
   Escape `\` and `'` in the name before formatting it into the filter, so it 
stays a single CEL string literal. This is the only place in the repo that 
builds a CEL filter.
   
   **Related**
   
   #18034 / #18035 touch the existence check earlier in the same method. This 
fix is independent of that change.
   
   I'll open a PR for this.
   
   ### Willingness to contribute
   
   - [X] I can contribute a fix for this bug independently
   


-- 
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]

Reply via email to