mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-16 19:14:41 -07:00
bug fix for _SYS.
This commit is contained in:
@@ -876,8 +876,9 @@ func (c *client) processMsg(msg []byte) {
|
||||
}
|
||||
|
||||
// Disallow publish to _SYS.>, these are reserved for internals.
|
||||
if c.pa.subject[0] == '_' && c.pa.subject[1] == 'S' &&
|
||||
c.pa.subject[2] == 'Y' && c.pa.subject[3] == 'S' {
|
||||
if c.pa.subject[0] == '_' && len(c.pa.subject) > 4 &&
|
||||
c.pa.subject[1] == 'S' && c.pa.subject[2] == 'Y' &&
|
||||
c.pa.subject[3] == 'S' && c.pa.subject[4] == '.' {
|
||||
c.pubPermissionViolation(c.pa.subject)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@ func TestUserAuthorizationProto(t *testing.T) {
|
||||
// Check that we now reserve _SYS.> though for internal, so no clients.
|
||||
sendProto(t, c, "PUB _SYS.HB 2\r\nok\r\n")
|
||||
expectResult(t, c, permErrRe)
|
||||
|
||||
// Check that _ is ok
|
||||
sendProto(t, c, "PUB _ 2\r\nok\r\n")
|
||||
expectResult(t, c, okRe)
|
||||
|
||||
c.Close()
|
||||
|
||||
// Bob is a requestor only, e.g. req.foo, req.bar for publish, subscribe only to INBOXes.
|
||||
|
||||
Reference in New Issue
Block a user