spring-projects / spring-projects/spring-security

SEC-1922: Improve error-message when user property file has wrong format

Open
#2,150 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: enhancement type: jira
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

David J. M. Karlsen (Migrated from SEC-1922) said:

If the user details file has the wrong format (I had a configline which was "OK" but forgot to chuck in the '"' character) you will get this stacktrace:

Caused by: java.lang.NullPointerException: null
        at org.springframework.security.provisioning.InMemoryUserDetailsManager.<init>(InMemoryUserDetailsManager.java:52) ~[spring-security-core-3.1.0.RELEASE.jar:3.1.0.RELEASE]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.6.0]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56) ~[na:1.6.0]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) ~[na:1.6.0]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:527) ~[na:1.6.0]
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126) ~[spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
        ... 101 common frames omitted

it would be nicer to say that the file has an unexpected format.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in org.springframework.security.provisioning.InMemoryUserDetailsManager at the constructor line shown in the stack trace, and inspect how malformed user-detail configuration is handled. Reproduce the wrong-format input described in the issue; done means it reports an unexpected file format instead of a NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.