casdoor / casdoor

An open-source UI-first Identity and Access Management (IAM) / Single-Sign-On (SSO) platform with web UI supporting OAuth 2.0, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, RADIUS, Google Workspace, Active Directory and Kerberos
https://casdoor.org
Apache License 2.0
10.09k stars 1.19k forks source link

Bug: When add or modifying permissions, an exception will be thrown #1195

Closed cjhqyz closed 2 years ago

cjhqyz commented 2 years ago

I tested two docker image casbin/casdoor-all-in-one:latest and casbin/casdoor:latest Same problem with both images.

  1. Add new organization
  2. Add new application
  3. Add new user
  4. Add new model
  5. Add new role
  6. Add new permission with new Adapter named 'jike_rule'
  7. Throw this exception: Snipaste_2022-10-08_22-14-26
casdoor:runtime error: invalid memory address or nil pointer dereference
Request Method: POST
Request URL:    /api/update-permission?id=organization_jk/get-orders
RemoteAddr: 192.168.50.131
Stack
/usr/local/go/src/runtime/panic.go:1038
/usr/local/go/src/runtime/panic.go:221
/usr/local/go/src/runtime/signal_unix.go:735
/go/pkg/mod/github.com/casbin/casbin/v2@v2.30.1/model/policy.go:130
/go/pkg/mod/github.com/casbin/casbin/v2@v2.30.1/model/policy.go:137
/go/pkg/mod/github.com/casbin/casbin/v2@v2.30.1/internal_api.go:233
/go/pkg/mod/github.com/casbin/casbin/v2@v2.30.1/management_api.go:314
/go/pkg/mod/github.com/casbin/casbin/v2@v2.30.1/management_api.go:286
/go/src/casdoor/object/permission_enforcer.go:143
/go/src/casdoor/object/permission.go:127
/go/src/casdoor/controllers/permission.go:100
/usr/local/go/src/reflect/value.go:543
/usr/local/go/src/reflect/value.go:339
/go/pkg/mod/github.com/beego/beego@v1.12.11/router.go:897
/usr/local/go/src/net/http/server.go:2879
/usr/local/go/src/net/http/server.go:1930
/usr/local/go/src/runtime/asm_amd64.s:1581
beego 1.12.3 (beego framework)

golang version: go1.17.5
casbin-bot commented 2 years ago

@seriouszyx @ComradeProgrammer @Resulte

cjhqyz commented 2 years ago

docker ENV: dataSourceName user=aaa_dev password=aaa_dev host=192.168.50.11 port=5432 sslmode=disable dbname=JiKeDev_Auth dbName
driverName postgres PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin runmode dev

hsluoyz commented 2 years ago

@forestmgy

forestmgy commented 2 years ago

I suppose that you use an incorrect model definition. You can read docs, there are many model definition examples, this may works fine. But you can explore more

cjhqyz commented 2 years ago

@forestmgy Thank you. It would be better if no exception was thrown, but with specific error content