Skip to content

Jruby-rack rails applications may have directory traversal issues in some configurations #327

Open

Description

@shahrutul1993

currently I am facing issue while using warble gem. I am using Jruby based rails application.
I am able to access direct file path code in server URL which breaking security.
so I was trying to modify config/warble.rb where I have made some changes which is showing below.

config.webxml.jruby.min.runtimes = 1
config.webxml.jruby.max.runtimes = 1
config.webxml.org.eclipse.jetty.servlet.default.dirAllowed = false

after adding config, I am able to access WEB-INF directory as well as file from direct server URL which is breaking security of our application.
for example:

  1. server url/WEB-INF./web.xml
  2. server url/WEB-INF./config/secrets.yml
    all the files can be accessible from this directory.

Looks like this is just preventing directory access but still able to access file path code in URL directly.
Any one have any idea to fix this issue in warble?
Any help would be appreciated.
Thanks.

Activity

  1. changed the title [-]facing issue while creating war file Jruby based rails application[/-] [+]facing security issue while creating war file Jruby based rails application[/+] on Aug 4, 2023
  2. thimios commented on Aug 12, 2024

    @thimios
    Contributor

    any updates on this? We are also facing the same issue. Adding

    config.webxml.org.eclipse.jetty.servlet.default.dirAllowed = false
    

    does not have an effect on the generated web.xml file

    and opening localhost:8080/test..%2F..%2F seems to just render a listing of the server's directory files

  3. kares commented on Jul 1, 2025

    @kares
    Member

    this bug relates to the servlet-rack bridge https://github.com/jruby/jruby-rack not the (warbler) packaging tool.

  4. chadlwilson commented on Aug 26, 2025

    @chadlwilson
    Contributor

    @kares if this is indeed the case and is valid for non-jetty, do you want to move this issue to the other project when you have a minute?

  5. transferred this issue fromjruby/warbleron Sep 2, 2025
  6. changed the title [-]facing security issue while creating war file Jruby based rails application[/-] [+]Jruby-rack rails applications may have directory traversal issues in some configurations[/+] on Sep 2, 2025
  7. chadlwilson commented on Sep 2, 2025

    @chadlwilson
    Contributor

    @kares are you able to share any thoughts on which circumstances this would have to be the case to be true? Did you happen to replicate it?

    Is this a rails root problem or some issue with query path parsing before offloading to the application?

  8. headius commented on Sep 2, 2025

    @headius
    Member

    We can transfer this issue to jruby-rack if it is confirmed to still be happening. This was filed a couple of years ago, and I'm not sure what versions of libraries were used.

  9. kares commented on Sep 2, 2025

    @kares
    Member

    my initial thought was that we do something wrong with the RackFilter and jruby-rack's attempt to allow for serving assets (packaged with the .war) as well as dynamic requests using the filter /* mapping.

    no replication or ideas about fixing, would need to sit down a look into it...

  10. chadlwilson commented on Sep 3, 2025

    @chadlwilson
    Contributor

    Ok, thanks! I'll have a play.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions