Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6838617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:37:07+00:00 2026-05-26T23:37:07+00:00

A product I work on got a tough security audit by a potential customer

  • 0

A product I work on got a tough security audit by a potential customer and they are upset that Tomcat sets a JSESSIONID cookie before authentication has happened. That is, Tomcat sets this cookie when our stateless Login Page loads, but before login.

They suggest either of the following:

  1. issue a new JSESSIONID cookie after login
  2. prevent a JSESSIONID cookie from being set in the first place on the Login Page (i.e., before authentication has happened)

I have been poring through everything JSESSIONID-related on this site and can find no easy answer. I’m just hoping for some ideas. My best solutions for each are:

  1. right after login, clone the Session (minus the id) by copying all the attributes, invalidating the old session, creating a new one, copying the values, associating it with the request, and hoping that works.
  2. create a servlet Filter at the very end of the chain that strips out the JSESSIONID cookie before the Login Page is initially loaded. And then hope the login request works out without a JSESSIONID set.

I’ve got to get some sleep, but will be attempting these in the morning. It would be awesome to get some feedback or better suggestions from people much smarter than myself — like you!

Regardless, I’ll post my results here because it seems like a lot of other people have been wanting to do something similar.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:37:07+00:00Added an answer on May 26, 2026 at 11:37 pm

    You will not refresh after but just before. When executing the login action first do:

    HttpSession session = request.getSession(false);
    if (session!=null && !session.isNew()) {
        session.invalidate();
    }
    

    Then do:

    HttpSession session = request.getSession(true); // create the session
    // do the login (store the user in the session, or whatever)
    

    FYI what you are solving with this trick is http://www.owasp.org/index.php/Session_Fixation

    Lastly you can disable automatic session creation and only create the session when you really need it. If you use JSP you do that by:

    <%@page contentType="text/html"
            pageEncoding="UTF-8"
            session="false"%>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work for a small company with a .NET product that was acquired by
I work on an Internet-facing, ASP.NET-based product that uses SQL Server 2005. Most customers
In our main product, we've got a feature request that's been around for a
I work for a tech company that does more prototyping than product shipment. I
I have the code for various versions of a software product I work on
I'm in the process of writing a visualization library for a product I work
I work on an open source product called EVEMon written in C# targeting the
I work for a ISV. Our product can use both SQL Server and Oracle
Part of a new product I have been assigned to work on involves server-side
Our company has a product which relies on local database to work (it allows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.