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

GEODE-3974: Improve permissions for geode-modules functions #1258

Merged
merged 5 commits into from
Jan 10, 2018

Conversation

jdeppe-pivotal
Copy link
Contributor

Thank you for submitting a contribution to Apache Geode.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.

}

@Test
public void testInvalidPermissionsForBootstrappingFunction() throws Exception {
Copy link
Member

@jinmeiliao jinmeiliao Jan 9, 2018

Choose a reason for hiding this comment

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

Another way to have the test auto connect with a specific user/password is to do this:

@rule // instead of a classrule so that it connect/disconnect around each test
public GfshCommandRule gfsh = new GfshCommandRule(server::getJmxPort, PortType.JmxManager);

@test
@ConnectionConfiguration(user = "dataWrite", password = "dataWrite")
public void test(){
gfsh.executeAndAssertThat("execute function --id=test");
}

@@ -87,6 +91,11 @@ private Cache verifyCacheExists() {
return cache;

Choose a reason for hiding this comment

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

I think this would be a good opportunity to eliminate the CacheFactory.getAnyInstance() call above. The cache should be available through the FunctionConext.

Copy link
Contributor Author

@jdeppe-pivotal jdeppe-pivotal Jan 9, 2018

Choose a reason for hiding this comment

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

I'm going to open a separate Jira for that - it seems a bit orthogonal to what's in this PR. (GEODE-4262).

import org.apache.geode.test.junit.rules.ServerStarterRule;

@Category(IntegrationTest.class)
public class ModuleFunctionsSecurityTest {
Copy link
Member

Choose a reason for hiding this comment

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

Should there not be any positive testing for these commands? That'll make the interaction a lot more complicated, true, but it seems strange that we'd only test some selective negatives here and assume positive security coverage elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed with @jinmeiliao which is why I removed them. The tests are targeted to ensure that these functions require specific permissions and not that the security framework is working.

import org.apache.geode.test.junit.rules.GfshCommandRule;
import org.apache.geode.test.junit.rules.ServerStarterRule;

@Category(IntegrationTest.class)
Copy link
Member

Choose a reason for hiding this comment

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

I know we don't really just them for anything, but this deserves the SecurityTest.class category, too.

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.

4 participants