elastic/elasticsearch
在 GitHub 查看migrate tool throws a NPE when user exists without role
Open
#29,837 创建于 2017年11月13日
:Security/Authentication>bugTeam:Securityhelp wanted
仓库指标
- Star
- (76,700 star)
- PR 合并指标
- (平均合并 2天) (30 天内合并 1,000 个 PR)
描述
Original comment by @PhaedrusTheGreek:
Pretty easy to reproduce:
$ bin/x-pack/users useradd testguy
$ bin/x-pack/users useradd testguy2 -r admin
$ bin/x-pack/migrate native -U http://localhost:9200 -u elastic -p changeme
starting migration of users and roles...
importing users from [/Users/jay/workspace/elasticsearch-5.6.4/config/x-pack/users]...
found existing users: [logstash, logstash_system, elsearch_watcher, elastic, es_admin, kibanaadmin, kibana]
migrating user [testguy2]
{"user":{"created":true}}
migrating user [testguy]
Exception in thread "main" ElasticsearchException[failed to migrate user [testguy] with body: n/a]; nested: NullPointerException;
at org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool$MigrateUserOrRoles.importUsers(ESNativeRealmMigrateTool.java:289)
at org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool$MigrateUserOrRoles.execute(ESNativeRealmMigrateTool.java:143)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:69)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool.main(ESNativeRealmMigrateTool.java:91)
Caused by: java.lang.NullPointerException
at org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool$MigrateUserOrRoles.createUserJson(ESNativeRealmMigrateTool.java:240)
at org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool$MigrateUserOrRoles.importUsers(ESNativeRealmMigrateTool.java:284)
... 7 more