Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3547

Create a utility that generates a security policy file for Derby's tests

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 10.15.1.3
    • Test
    • None

    Description

      With the number of current test policy files it is becoming a pain to remember to modify all of them when needed to add a new permission.
      In addition with JMX, SystemPermission (and DatabasePermission) support, testing of fine-grained permissions will become unmanagable if a new policy file is needed for every combination.

      I suggest a java utility that can be used in a test decorator to create a set of permissions that can then be modified before creating a real policy file and pointing the security manager to it. I imagine an api like:

      TestPolicy() - constructor creates a set of permissions that corresponds to the current derby_tests.policy (or similar)

      The object supports a number of code bases, corresponding to the current jars, e.g.
      derby, derbynet, derbytools,derbyclient,ant,emma, junit,

      removeCodebase(String code) - remove all the permissions for a given code base. Allows specific testing, e.g. with just client tests don't have permissions for any other jars.

      removePermission(String code, Permission permission) - remove a single permission from a code base - allows negative testing, what happens if this permission is not available.

      addPermission(String code, Permission permission) - add a permission into the code base

      writePolicyFile(PrintStream out) - write the policy file out

      This would also stop the need for derby_tests.policy to have a jar and classes section with duplicated information, TestPolicy would just create the grant code blocks with the correct code location.

      TestPolicy could obviously be expanded as new needs appear, eg. Principal testing.

      Attachments

        1. SecurityPolicyVTI.java
          11 kB
          Richard N. Hillegas
        2. derby-3547-05-aa-fixCanonicalization.diff
          0.6 kB
          Richard N. Hillegas
        3. derby-3547-04-aa-canonicalizeFileNamesOnWindows.diff
          0.8 kB
          Richard N. Hillegas
        4. derby-3547-03-aa-removeTemplatePolicy.diff
          13 kB
          Richard N. Hillegas
        5. derby-3547-02-aa-remainingTestPolicies.diff
          363 kB
          Richard N. Hillegas
        6. derby-3547-01-ab-policyGenerator.diff
          112 kB
          Richard N. Hillegas

        Issue Links

          Activity

            People

              rhillegas Richard N. Hillegas
              djd Daniel John Debrunner
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: