Skip to content

Commit 6cd9afc

Browse files
committed
refactor: enforce owner-only access checks in AddTrustedVerifier and RemoveTrustedVerifier methods
1 parent 6350c6c commit 6cd9afc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/r/karma1337/geo-resto/auth.gno

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ func (am *AuthManager) IsTrustedVerifier(addr string) bool {
4040

4141
// AddTrustedVerifier allows the owner to add an address as a trusted verifier
4242
func (am *AuthManager) AddTrustedVerifier(addr string, caller address) bool {
43-
// Try to add via the external authorizable extension. That extension
44-
// enforces owner-only access internally; we call it and mirror the
45-
// change locally so we can query membership efficiently.
43+
// Owner-only check
44+
if am.Authorizable.Owner() != caller {
45+
return false
46+
}
47+
48+
// Add via the authorizable extension and mirror locally.
4649
err := am.Authorizable.AddToAuthList(address(addr))
4750
if err != nil {
4851
return false
@@ -53,6 +56,11 @@ func (am *AuthManager) AddTrustedVerifier(addr string, caller address) bool {
5356

5457
// RemoveTrustedVerifier allows the owner to remove a trusted verifier
5558
func (am *AuthManager) RemoveTrustedVerifier(addr string, caller address) bool {
59+
// Owner-only check
60+
if am.Authorizable.Owner() != caller {
61+
return false
62+
}
63+
5664
err := am.Authorizable.DeleteFromAuthList(address(addr))
5765
if err != nil {
5866
return false

0 commit comments

Comments
 (0)