Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: skip OpenAPI SQL endpoint in ACL middleware (#3506)

ecmadaoebcf3117fafe
diff --git a/server/acl.go b/server/acl.go
index 0b677a0a20..286110fa45 100644
--- a/server/acl.go
+++ b/server/acl.go
@@ -170,6 +170,11 @@ func aclMiddleware(s *Server, pathPrefix string, ce *casbin.Enforcer, next echo.
return next(c)
}
+ // Skips OpenAPI SQL endpoint
+ if common.HasPrefixes(c.Path(), fmt.Sprintf("%s/sql", openAPIPrefix)) {
+ return next(c)
+ }
+
method := c.Request().Method
// Skip GET /subscription request
if common.HasPrefixes(path, "/subscription") && method == "GET" {
diff --git a/store/environment.go b/store/environment.go
index 446861874e..7b3523273c 100644
--- a/store/environment.go
+++ b/store/environment.go
@@ -266,6 +266,7 @@ func (Store) createEnvironmentImpl(ctx context.Context, tx *Tx, create *api.Envi
}
return nil, FormatError(err)
}
+ order++
}
// Insert row into database.
@@ -284,7 +285,7 @@ func (Store) createEnvironmentImpl(ctx context.Context, tx *Tx, create *api.Envi
create.CreatorID,
create.CreatorID,
create.Name,
- order+1,
+ order,
).Scan(
&envRaw.ID,
&envRaw.RowStatus,