Skip to content

fix: validate internal tsfile paths for files only - #18417

Open
luoluoyuyu wants to merge 7 commits into
apache:masterfrom
luoluoyuyu:fix-load-c
Open

fix: validate internal tsfile paths for files only#18417
luoluoyuyu wants to merge 7 commits into
apache:masterfrom
luoluoyuyu:fix-load-c

Conversation

@luoluoyuyu

Copy link
Copy Markdown
Member

Description


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR

private LoadTsFileStatement(
String filePath, boolean validateSourcePath, boolean validateInternalDataDir)
throws FileNotFoundException {
if (filePath == null || filePath.isEmpty()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P1] Table Model 的 LOAD 路径没有经过这里的空路径校验。

关系型解析器 AstBuilder.visitLoadTsFileStatement() 会直接构造 LoadTsFile;该类的构造函数只检查 null,随后执行 processTsFile(new File(filePath), ...)。因此关系型语法 LOAD '' 仍会把空字符串解析成进程当前工作目录,可能递归扫描并加载其中的 .tsfile(至少也不会返回本 PR 新增的“LOAD TSFILE path cannot be empty”错误)。RelationalSql.g4STRING 规则允许空字符串。

请把校验抽成字符串级 helper,在 LoadTsFileStatementLoadTsFile 两个入口复用,并补充 Tree/Table 两种 dialect 的 LOAD '' 回归测试。

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.

3 participants