Ensure permission checks don’t create subsequent checks

This commit is contained in:
Tobie Morgan Hitchcock 2017-12-06 13:20:34 +00:00
parent e9b44c3cf2
commit 6d8686138a
2 changed files with 21 additions and 0 deletions

View file

@ -60,6 +60,13 @@ func (d *document) grant(ctx context.Context, when method) (ok bool, err error)
return false, err return false, err
} }
// Once we have the table we reset the
// context to DB level so that no other
// embedded permissions are checked on
// records within these permissions.
ctx = context.WithValue(ctx, ctxKeyKind, cnf.AuthDB)
// We then try to process the relevant // We then try to process the relevant
// permissions dependent on the query // permissions dependent on the query
// that we are currently processing. If // that we are currently processing. If
@ -123,6 +130,13 @@ func (d *document) allow(ctx context.Context, when method) (ok bool, err error)
return false, err return false, err
} }
// Once we have the table we reset the
// context to DB level so that no other
// embedded permissions are checked on
// records within these permissions.
ctx = context.WithValue(ctx, ctxKeyKind, cnf.AuthDB)
// We then try to process the relevant // We then try to process the relevant
// permissions dependent on the query // permissions dependent on the query
// that we are currently processing. If // that we are currently processing. If

View file

@ -500,6 +500,13 @@ func (i *iterator) processPerms(ctx context.Context, nsv, dbv, tbv string) {
} }
} }
// If the table does exist we reset the
// context to DB level so that no other
// embedded permissions are checked on
// records within these permissions.
ctx = context.WithValue(ctx, ctxKeyKind, cnf.AuthDB)
// If the table does exist we then try // If the table does exist we then try
// to process the relevant permissions // to process the relevant permissions
// expression, but only if they don't // expression, but only if they don't