-
Notifications
You must be signed in to change notification settings - Fork 69
Add support for calcite and sql queries #956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
baremaps-calcite/src/main/java/org/apache/baremaps/calcite/DataTableFactory.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/main/java/org/apache/baremaps/calcite/DataTableFactory.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/main/java/org/apache/baremaps/calcite/DataTableFactory.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/main/java/org/apache/baremaps/calcite/DataTableFactory.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/main/java/org/apache/baremaps/calcite/DataTableFactory.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/main/java/org/apache/baremaps/calcite/baremaps/BaremapsDdlExecutor.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/test/java/org/apache/baremaps/calcite/DataTableAdapterFactoryTest.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/test/java/org/apache/baremaps/calcite/DataTableAdapterFactoryTest.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/test/java/org/apache/baremaps/calcite/DataTableAdapterFactoryTest.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/test/java/org/apache/baremaps/calcite/DataTypeTest.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/test/java/org/apache/baremaps/calcite/DataTableAdapterFactoryTest.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/test/java/org/apache/baremaps/calcite/DataTableAdapterFactoryTest.java
Fixed
Show fixed
Hide fixed
748872f
to
7105e06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
…ance PostgreSQL type conversion, and update integration tests for schema registration.
…struct type for geometry envelope handling.
…nhance handling of envelope values in data retrieval.
b0fce07
to
83cdca3
Compare
baremaps-calcite/src/main/java/org/apache/baremaps/calcite/BaremapsDdlExecutor.java
Fixed
Show fixed
Hide fixed
baremaps-calcite/src/main/java/org/apache/baremaps/calcite/BaremapsTableFactory.java
Fixed
Show fixed
Hide fixed
return null; | ||
} | ||
|
||
if (geometry instanceof Point point) { |
Check notice
Code scanning / CodeQL
Chain of 'instanceof' tests Note
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '" + | ||
sanitizedTableName + "')")) { |
Check failure
Code scanning / CodeQL
Query built by concatenation with a possibly-untrusted string High
this expression
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '" + | ||
sanitizedTableName + "')")) { |
Check failure
Code scanning / CodeQL
Query built by concatenation with a possibly-untrusted string High
this expression
baremaps-core/src/main/java/org/apache/baremaps/tasks/ImportShapefile.java
Fixed
Show fixed
Hide fixed
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '" + | ||
tableName + "')")) { |
Check failure
Code scanning / CodeQL
Query built by concatenation with a possibly-untrusted string High
this expression
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '" + | ||
tableName + "')")) { |
Check failure
Code scanning / CodeQL
Query built by concatenation with a possibly-untrusted string High test
this expression
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '" + | ||
tableName + "')")) { |
Check failure
Code scanning / CodeQL
Query built by concatenation with a possibly-untrusted string High test
this expression
b976bb2
to
c678597
Compare
@Test | ||
void testCsvWithoutHeader() throws Exception { | ||
// Create a temporary file without a header | ||
File tempFile = File.createTempFile("no_header", ".csv"); |
Check warning
Code scanning / CodeQL
Local information disclosure in a temporary directory Medium test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To fix the problem, we need to ensure that the temporary file is created with secure permissions that restrict access to the owner only. This can be achieved by using the java.nio.file.Files.createTempFile
method, which allows specifying file attributes, including permissions. We will replace the File.createTempFile
method with Files.createTempFile
and set the appropriate file permissions.
-
Copy modified lines R23-R26 -
Copy modified lines R138-R139 -
Copy modified line R142
@@ -22,2 +22,6 @@ | ||
import java.io.File; | ||
import java.nio.file.Path; | ||
import java.nio.file.attribute.PosixFilePermission; | ||
import java.nio.file.attribute.PosixFilePermissions; | ||
import java.util.EnumSet; | ||
import java.io.IOException; | ||
@@ -133,7 +137,7 @@ | ||
// Create a temporary file without a header | ||
File tempFile = File.createTempFile("no_header", ".csv"); | ||
tempFile.deleteOnExit(); | ||
Path tempFilePath = Files.createTempFile("no_header", ".csv"); | ||
tempFilePath.toFile().deleteOnExit(); | ||
|
||
// Write data without header | ||
Files.writeString(tempFile.toPath(), | ||
Files.writeString(tempFilePath, | ||
"Paris,France,2148000\n" + |
@Test | ||
void testCsvWithCustomSeparator() throws Exception { | ||
// Create a temporary file with a custom separator | ||
File tempFile = File.createTempFile("custom_separator", ".csv"); |
Check warning
Code scanning / CodeQL
Local information disclosure in a temporary directory Medium test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To fix the problem, we need to ensure that the temporary files created in the test have restricted permissions, preventing other local users from reading them. We can achieve this by using the java.nio.file.Files.createTempFile
method, which allows us to specify file attributes, including permissions.
We will replace the File.createTempFile
calls with Files.createTempFile
and ensure the files have permissions set to -rw-------
(read and write permissions for the owner only).
-
Copy modified lines R134-R136 -
Copy modified lines R167-R169
@@ -133,4 +133,5 @@ | ||
// Create a temporary file without a header | ||
File tempFile = File.createTempFile("no_header", ".csv"); | ||
tempFile.deleteOnExit(); | ||
Path tempFilePath = Files.createTempFile("no_header", ".csv"); | ||
tempFilePath.toFile().deleteOnExit(); | ||
Files.setPosixFilePermissions(tempFilePath, EnumSet.of(PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE)); | ||
|
||
@@ -165,4 +166,5 @@ | ||
// Create a temporary file with a custom separator | ||
File tempFile = File.createTempFile("custom_separator", ".csv"); | ||
tempFile.deleteOnExit(); | ||
Path tempFilePath = Files.createTempFile("custom_separator", ".csv"); | ||
tempFilePath.toFile().deleteOnExit(); | ||
Files.setPosixFilePermissions(tempFilePath, EnumSet.of(PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE)); | ||
|
|
No description provided.