Skip to content
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

[s7Ob7Zm7] Test that all load and import procedures respect security #360

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

vga91
Copy link
Collaborator

@vga91 vga91 commented Apr 1, 2023

  • Added ImportAndLoadCoreSecurityTest.java with all test config, for both load.* and import.* procedures, since they share the same behaviors with the configs internal.dbms.cypher_ip_blocklist, apoc.import.file.enabled, apoc.import.file.use_neo4j_config and apoc.import.file.allow_read_from_filesystem
  • Deleted LoadCoreSecurityTest, as it has been replaced by ImportAndLoadSecurityTest
  • Added createTempFolder() to create a temp folder without having to use DatabaseManagementService and ClassRule TemporaryFolder
  • Changed SensitivePathGenerator.etcPasswd() as it didn't seem to work locally if the project located in a subfolder

@vga91 vga91 marked this pull request as draft April 1, 2023 08:57
@vga91 vga91 force-pushed the test-loads-and-imports-configs branch from b2fcc27 to b8ca6f4 Compare April 3, 2023 07:05
@vga91 vga91 marked this pull request as ready for review April 3, 2023 07:05
@vga91 vga91 changed the title Test that all load and import procedures respect security [s7Ob7Zm7] Test that all load and import procedures respect security Apr 3, 2023
@vga91 vga91 force-pushed the test-loads-and-imports-configs branch 2 times, most recently from 8f4b542 to f8bf9b0 Compare April 3, 2023 07:14
Copy link
Contributor

@gem-neo4j gem-neo4j left a comment

Choose a reason for hiding this comment

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

This looks really good :) I know the card specified import and load, but how hard would it be to do this style for all our export as well? then we would be super tested :D

Just a few comments otherwise!

public static void setUp() throws IOException {
TestUtil.registerProcedure(db,
ImportJson.class, Xml.class, ImportCsv.class, ExportGraphML.class,
LoadJson.class, Xml.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Xml.class is here twice ^^


@Test
public void testIllegalFSAccessWithDifferentApocConfs() {
setFileApocConfigs(true, true, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can a comment be added to explain which each boolean is setting so the test is easier to read as is?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also would help explain why not all permutations are listed here, I can't directly see why we aren't also testing:

false, false, true
true, false, true
true, true, false

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually I don't remember why I didn't test all permutations 😅... Anyway I've now added them all.


@Test
public void testImportFileDisabled() {
setFileApocConfigs(false, false, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can a comment be added to explain which each boolean is setting so the test is easier to read as is?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added

@BeforeClass
public static void setUp() throws IOException {
TestUtil.registerProcedure(db,
ImportJson.class, Xml.class, ImportCsv.class, ExportGraphML.class,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we not want arrow procedures here as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Strange that the load graphml prcocedure is in the ExportGraphML class, maybe add a comment here as I was about to comment asking why an export procedure class was loaded into an import test 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes sorry, I thought I also added arrow, added.
And added a comment as well

@vga91 vga91 force-pushed the test-loads-and-imports-configs branch 2 times, most recently from afd8d11 to e6a545b Compare April 12, 2023 15:33
Copy link
Contributor

@gem-neo4j gem-neo4j left a comment

Choose a reason for hiding this comment

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

Great, thanks for this :D Nice work!

@vga91 vga91 force-pushed the test-loads-and-imports-configs branch from e6a545b to a074d54 Compare April 14, 2023 12:11
@vga91 vga91 merged commit ecec458 into dev Apr 17, 2023
@vga91 vga91 deleted the test-loads-and-imports-configs branch April 17, 2023 07:20
vga91 added a commit that referenced this pull request Apr 17, 2023
vga91 added a commit that referenced this pull request Apr 17, 2023
vga91 added a commit that referenced this pull request Apr 17, 2023
vga91 added a commit that referenced this pull request Apr 17, 2023
…360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one
vga91 added a commit that referenced this pull request Apr 20, 2023
…360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one
vga91 added a commit that referenced this pull request May 4, 2023
…360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one
vga91 added a commit that referenced this pull request May 8, 2023
…360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one
vga91 added a commit that referenced this pull request May 10, 2023
…360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one
vga91 added a commit that referenced this pull request Jun 7, 2023
…360) (#377)

* [s7Ob7Zm7] Test that all load and import procedures respect security (#360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one

* [s7Ob7Zm7] changed tests

* [s7Ob7Zm7] Update ImportAndLoadCoreSecurityTest.java

* [s7Ob7Zm7] reduce logs

* [s7Ob7Zm7] reduce logs in export tests
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Jun 7, 2023
…eo4j/apoc#360) (neo4j/apoc#377)

* [s7Ob7Zm7] Test that all load and import procedures respect security (#360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one

* [s7Ob7Zm7] changed tests

* [s7Ob7Zm7] Update ImportAndLoadCoreSecurityTest.java

* [s7Ob7Zm7] reduce logs

* [s7Ob7Zm7] reduce logs in export tests
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Jun 7, 2023
…eo4j/apoc#360) (neo4j/apoc#377)

* [s7Ob7Zm7] Test that all load and import procedures respect security (#360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one

* [s7Ob7Zm7] changed tests

* [s7Ob7Zm7] Update ImportAndLoadCoreSecurityTest.java

* [s7Ob7Zm7] reduce logs

* [s7Ob7Zm7] reduce logs in export tests
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Jun 16, 2023
…eo4j/apoc#360) (neo4j/apoc#377)

* [s7Ob7Zm7] Test that all load and import procedures respect security (#360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one

* [s7Ob7Zm7] changed tests

* [s7Ob7Zm7] Update ImportAndLoadCoreSecurityTest.java

* [s7Ob7Zm7] reduce logs

* [s7Ob7Zm7] reduce logs in export tests
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Jun 19, 2023
…eo4j/apoc#360) (neo4j/apoc#377)

* [s7Ob7Zm7] Test that all load and import procedures respect security (#360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one

* [s7Ob7Zm7] changed tests

* [s7Ob7Zm7] Update ImportAndLoadCoreSecurityTest.java

* [s7Ob7Zm7] reduce logs

* [s7Ob7Zm7] reduce logs in export tests
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Jun 21, 2023
…eo4j/apoc#360) (neo4j/apoc#377) (#3617)

* [s7Ob7Zm7] Test that all load and import procedures respect security (neo4j/apoc#360) (neo4j/apoc#377)

* [s7Ob7Zm7] Test that all load and import procedures respect security (#360)

* [s7Ob7Zm7] Test that all load and import procedures respect security

* [3QAbWQds] changed ExportCoreSecurityTest consistent with LoadImport one

* [s7Ob7Zm7] changed tests

* [s7Ob7Zm7] Update ImportAndLoadCoreSecurityTest.java

* [s7Ob7Zm7] reduce logs

* [s7Ob7Zm7] reduce logs in export tests

* [s7Ob7Zm7] 4.x changes
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.

2 participants