use forward slashes for the linked table test csv marker path so h2 does not strip windows separators, and assert the fixture wrote the marker before checking it was not rewritten on load
What changed, and why it matters
This commit fixes a unit test that was failing on Windows. The test uses an embedded H2 database feature, and Windows file paths use backslashes. H2 interprets backslashes in its connection URL as escape characters, so the test path was being mangled. The fix converts the Windows path to forward slashes for the URL and adds a check that the test setup actually created the expected file before proceeding. There is no change to production wallet code or user-facing behavior.
No security action required. Treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is confined to src/test/java/com/sparrowwallet/sparrow/io/DbPersistenceTest.java. It normalizes the CSV marker path used in an H2 JDBC INIT URL by replacing backslashes with forward slashes, preventing H2 from treating Windows directory separators as escape characters. It also adds an assertion that the fixture wrote the marker file before the test deletes it and checks that loading a malicious wallet does not rewrite it. This is a test-hardening change, not a product security fix.
Changed components
src/test/java/com/sparrowwallet/sparrow/io/DbPersistenceTest.javaInspect captured patch +3 / −1
### src/test/java/com/sparrowwallet/sparrow/io/DbPersistenceTest.java
@@ -64,8 +64,10 @@ private void assertRejected(File walletFile) {
@Test
public void linkedTableRejectedWithoutExecuting() throws Exception {
File marker = tempDir.resolve("output.csv").toFile();
- String target = "jdbc:h2:" + tempDir.resolve("external") + ";INIT=CREATE TABLE IF NOT EXISTS PUB(ID INT)\\;CALL CSVWRITE('" + marker.getAbsolutePath() + "','SELECT 1')";
+ //H2 treats a backslash in a URL setting as an escape, so a Windows marker path must use forward slashes
+ String target = "jdbc:h2:" + tempDir.resolve("external") + ";INIT=CREATE TABLE IF NOT EXISTS PUB(ID INT)\\;CALL CSVWRITE('" + marker.getAbsolutePath().replace('\\', '/') + "','SELECT 1')";
File walletFile = buildWalletFile("create force linked table wallet_master.remote('','" + target.replace("'", "''") + "','sa','','PUB')");
+ Assertions.assertTrue(marker.exists(), "fixture did not write the marker");
marker.delete();
assertRejected(walletFile);Why this scored 14/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.