Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-369

Cannot use Lucene in an unsigned applet due to Java security restrictions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core/other
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Bugzilla Id:
      34359

      Description

      A few of the Lucene source files call System.getProperty and perform a couple of
      other operations within static initializers that assume full Java 2 permissions.
      This prevents Lucene from being used from an unsigned applet embedded in a
      browser page, since the default security permissions for an applet will prohibit
      reading of most properties.

      I would suggest wrapping the initialization of the properties in try/catch
      blocks. This does mean that a couple properties would need to be made non-final,
      and in some cases, getter and setter methods might be desirable to allow the
      applet programmer to change the property values at runtime (some variables are
      public static and could be changed directly without accessors).

      This problem occurs with the shipping 1.4.3 version as well as the latest (as of
      07-apr-2005) source code fetched from CVS.

      Currently, the files that are affected are org.apache.lucene.index.IndexWriter,
      org.apache.lucene.index.SegmentReader, org.apache.lucene.search.BooleanQuery,
      and org.apache.lucene.store.FSDirectory.

      I have modified versions of these files with some suggested changes, plus a
      simple test applet and associated files that demonstrate the situation. The
      sample applet can be launched in a browser either by double-clicking the file
      locally or by putting it on a web server and launching it from an http URL. As
      soon as I can figure out how to attach to a bug report, I'll do that.

      P.S. This topic came up in August, 2004 in lucene dev mailing list but as far as
      I can tell, has not yet been resolved.

      1. ASF.LICENSE.NOT.GRANTED--BooleanQuery.diffs
        1 kB
        Jon Schuster
      2. ASF.LICENSE.NOT.GRANTED--BooleanQuery.java
        14 kB
        Jon Schuster
      3. ASF.LICENSE.NOT.GRANTED--FSDirectory.diffs
        3 kB
        Jon Schuster
      4. ASF.LICENSE.NOT.GRANTED--FSDirectory.java
        16 kB
        Jon Schuster
      5. ASF.LICENSE.NOT.GRANTED--IndexWriter.diffs
        5 kB
        Jon Schuster
      6. ASF.LICENSE.NOT.GRANTED--IndexWriter.java
        29 kB
        Jon Schuster
      7. ASF.LICENSE.NOT.GRANTED--sampleapplet.zip
        15 kB
        Jon Schuster
      8. ASF.LICENSE.NOT.GRANTED--SegmentReader.diffs
        0.9 kB
        Jon Schuster
      9. ASF.LICENSE.NOT.GRANTED--SegmentReader.java
        18 kB
        Jon Schuster

        Activity

        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14647)
        Changes to org.apache.lucene.index.IndexWriter to prevent security exceptions

        Suggested changes to IndexWriter to prevent applet security exceptions.

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14647) Changes to org.apache.lucene.index.IndexWriter to prevent security exceptions Suggested changes to IndexWriter to prevent applet security exceptions.
        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14648)
        Changes to org.apache.lucene.index.SegmentReader to prevent applet security
        exceptions

        Suggested changes to IndexWriter to prevent applet security exceptions.

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14648) Changes to org.apache.lucene.index.SegmentReader to prevent applet security exceptions Suggested changes to IndexWriter to prevent applet security exceptions.
        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14650)
        Changes to org.apache.lucene.search.BooleanQuery to prevent applet security
        exceptions

        Suggested changes to BooleanQuery to prevent applet security exceptions.

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14650) Changes to org.apache.lucene.search.BooleanQuery to prevent applet security exceptions Suggested changes to BooleanQuery to prevent applet security exceptions.
        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14651)
        Changes to org.apache.lucene.store.FSDirectory to prevent applet security
        exceptions

        Suggested changes to FSDirectory to prevent applet security exceptions.

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14651) Changes to org.apache.lucene.store.FSDirectory to prevent applet security exceptions Suggested changes to FSDirectory to prevent applet security exceptions.
        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14653)
        Sample of unsigned applet using Lucene for searching

        Zip file contains sample source file and class file, some index files, and some
        html pages that demonstrate using Lucene from an unsigned applet. Add the
        lucene.jar file to the directory with the class file and edit the search.html
        as needed.

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14653) Sample of unsigned applet using Lucene for searching Zip file contains sample source file and class file, some index files, and some html pages that demonstrate using Lucene from an unsigned applet. Add the lucene.jar file to the directory with the class file and edit the search.html as needed.
        Hide
        bugs@goofrider.imap.cc Jeffrey Chan added a comment -

        Thanks for opening this bug report. Hope it'll be accepted and resolved soon.

        Show
        bugs@goofrider.imap.cc Jeffrey Chan added a comment - Thanks for opening this bug report. Hope it'll be accepted and resolved soon.
        Hide
        jakarta@ehatchersolutions.com Erik Hatcher added a comment -

        Please provide your changes as unified diff (svn diff) against the Lucene trunk
        rather than the entire file. It would be nice to get these changes into Lucene 1.9.

        Show
        jakarta@ehatchersolutions.com Erik Hatcher added a comment - Please provide your changes as unified diff (svn diff) against the Lucene trunk rather than the entire file. It would be nice to get these changes into Lucene 1.9.
        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14869)
        diffs of IndexWriter changes for unsigned applet

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14869) diffs of IndexWriter changes for unsigned applet
        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14870)
        diffs of SegmentReader changes for unsigned applet

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14870) diffs of SegmentReader changes for unsigned applet
        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14871)
        diffs of BooleanQuery for unsigned applet

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14871) diffs of BooleanQuery for unsigned applet
        Hide
        jons@wrq.com Jon Schuster added a comment -

        Created an attachment (id=14872)
        diffs of FSDirectory for unsigned applet

        Show
        jons@wrq.com Jon Schuster added a comment - Created an attachment (id=14872) diffs of FSDirectory for unsigned applet
        Hide
        lucenebugs@danielnaber.de Daniel Naber added a comment -

        Thanks, you patches have been committed, Lucene can now be used inside an
        Applet.

        Show
        lucenebugs@danielnaber.de Daniel Naber added a comment - Thanks, you patches have been committed, Lucene can now be used inside an Applet.

          People

          • Assignee:
            java-dev@lucene.apache.org Lucene Developers
            Reporter:
            jons@wrq.com Jon Schuster
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development