jsr342-experts@javaee-spec.java.net

[jsr342-experts] Re: password aliasing proposal

From: David Blevins <david.blevins_at_gmail.com>
Date: Tue, 31 Jan 2012 11:19:08 -0800

I can't quite tell if we're off topic, we definitely are somewhat, but I like the discussion.

There are sort of two camps of thought on this kind of thing. The one camp where you fill in "this can be replaced".

    @DataSourceDefinition(name="${myDataSource}",
        className="com.mysql.jdbc.jdbc2.optional.MysqlDataSource",
        user="${myUserId}",
        password="${password}",
        databaseName="${dbName}",
        serverName="localhost",
        portNumber=3306 )
    
 - myUserId = joe
 - password = cool
 - dbName = peanuts

We'll call it the "variables" approach. In this approach you end up scooping out all the metadata till there is just a shell left. In the extreme case the @DataSourceDefinition doesn't define anything anymore and ultimately serves little purpose aside from providing structure.

The other camp is "anything with simple properties can be replaced"

    @DataSourceDefinition(name="moviesDataSource",
        className="com.mysql.jdbc.jdbc2.optional.MysqlDataSource",
        user="jane",
        password="doe",
        databaseName="films",
        serverName="localhost",
        portNumber=3306 )

 - moviesDataSource.user = joe
 - moviesDataSource.password = cool
 - moviesDataSource.databaseName = peanuts

We'll call it the "override" approach.

The advantages of the override approach:
  - there are defaults
  - all replacement is optional
  - all replacement is possible

Both approaches hinge on you having a unique name. You either guarantee "moviesDataSource" is unique or you need to guarantee "myUserId" is a unique variable. Really the same thing. Slight difference is the number of "unique keys" you have to manage. One vs six using @DataSourceDefinition as an example.

Geronimo uses the variables approach, OpenEJB/TomEE use the override approach.

What I've seen happen is the day you have two datasources, you fall into this with the variables approach:

 - moviesDataSourceUserId = joe
 - moviesDataSourcePassword = cool
 - moviesDataSourceDbName = movies
 - booksDataSourceUserId = arthur
 - booksDataSourcePassword = dent
 - booksDataSourceDbName = books

Only you didn't start with the long "moviesDataSourceUserId" kind of unique key, so you first have to go and rename all your old "myUserId" variables to the long version before you can deal with the new "booksDataSource".

In the override approach where name is the unique key, you get that from day one. The downside is it isn't really easy to deal with complex annotations.

Attempting to be more on topic, I wonder if we need a syntax.

Instead of having to explicitly add a "this is not a password" entry in a deployment descriptor or xml file, why not just leave it out? Do we need to actually a value to say that the value will be handled elsewhere?

As vendors we already have the ability to change any part of the application metadata without the code having to reflect that. The status quo on that seems pretty good. There could be good value in focusing on sections 2 and 3 of the proposal and leaving out the part where application developers have to enable that in the annotations or descriptors.

In the extreme case would really put the entire <data-source> definition in this secure storage.


-David


On Jan 31, 2012, at 5:42 AM, Antonio Goncalves wrote:

> Not sure about the ALIAS= syntax. What about the good old EL ? I agree with Jevgeni, we've already talked about configuration issues in EE. It has to go further not just restricted to passwords. What about :
>
> @DataSourceDefinition(name="${myDataSource}",
> className="com.mysql.jdbc.jdbc2.optional.MysqlDataSource",
> user="${myUserId}",
> password="${password}",
> databaseName="${dbName}",
> serverName="localhost",
> portNumber=3306 )
>
> Sorry if I didn't understand well but passwords are just one of the many possible configuration on an EE app. The fact that it's encrypted makes it slightly different but we could treat it in a different way. Something like password="${aClearPassword}" and password="${encrypted(anEncryptedPassword}".
>
> Antonio
>
> On Tue, Jan 31, 2012 at 09:45, Jevgeni Kabanov <jevgeni_at_zeroturnaround.com> wrote:
> Is there a reason it is limited to passwords? I'm sure a generic ${}
> Ant-style configuration string post-processing would be greatly
> appreciated by the community.
>
> Sent from my iPhone
>
> On 31.01.2012, at 0:49, Bill Shannon <bill.shannon_at_oracle.com> wrote:
>
> > I've uploaded a proposal from our security team for password aliasing
> > support in Java EE 7. Let me know if you have any comments.
> >
> > http://java.net/projects/javaee-spec/downloads/download/password-aliasing-ee7-proposal.pdf
>
>
>
> --
> Antonio Goncalves
> Software architect and Java Champion
>
> Web site | Twitter | Blog | LinkedIn | Paris JUG