Compare commits

...
3 Commits
Author SHA1 Message Date
Hein c7178e0a2b fix(parameters): increase default limit for requests
Tests / Integration Tests (push) Failing after 3m24s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in 4m13s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in 3m17s
Build , Vet Test, and Lint / Lint Code (push) Failing after 4m51s
Tests / Unit Tests (push) Failing after 5m23s
Build , Vet Test, and Lint / Build (push) Successful in 4m14s
2026-08-25 15:50:09 +02:00
warkanum 0261f121e8 fix(security): change types for template and hasBlock
Tests / Unit Tests (push) Failing after 19s
Tests / Integration Tests (push) Failing after 30s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Failing after 39s
Build , Vet Test, and Lint / Build (push) Successful in 3m47s
Build , Vet Test, and Lint / Lint Code (push) Successful in 3m45s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in 3m47s
2026-08-10 20:46:40 +02:00
warkanum 93dc1008ee fix(security): unwrap userRef for non-DB providers 2026-08-10 20:34:06 +02:00
2 changed files with 17 additions and 5 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ func (h *Handler) ParseParameters(r *http.Request) *RequestParameters {
FieldFilters: make(map[string]string), FieldFilters: make(map[string]string),
SearchFilters: make(map[string]string), SearchFilters: make(map[string]string),
SearchOps: make(map[string]FilterOperator), SearchOps: make(map[string]FilterOperator),
Limit: 20, // Default limit Limit: 100000, // Default limit
Offset: 0, // Default offset Offset: 0, // Default offset
ResponseFormat: "simple", // Default format ResponseFormat: "simple", // Default format
ComplexAPI: false, // Default to simple API ComplexAPI: false, // Default to simple API
+16 -4
View File
@@ -912,8 +912,20 @@ func (p *DatabaseRowSecurityProvider) GetRowSecurity(ctx context.Context, userRe
return RowSecurity{}, ErrDirectModeUnsupported return RowSecurity{}, ErrDirectModeUnsupported
} }
var template string // resolvespec_row_security's p_user_id is a scalar integer. GetUserRef() may
var hasBlock bool // hand back the full *UserContext so non-DB providers can inspect claims;
// unwrap it here before it reaches the SQL args.
switch v := userRef.(type) {
case *UserContext:
if v != nil {
userRef = v.UserID
}
case UserContext:
userRef = v.UserID
}
var template sql.NullString
var hasBlock sql.NullBool
runQuery := func() error { runQuery := func() error {
query := fmt.Sprintf(`SELECT p_template, p_block FROM %s($1, $2, $3)`, p.sqlNames.RowSecurity) query := fmt.Sprintf(`SELECT p_template, p_block FROM %s($1, $2, $3)`, p.sqlNames.RowSecurity)
@@ -933,8 +945,8 @@ func (p *DatabaseRowSecurityProvider) GetRowSecurity(ctx context.Context, userRe
Schema: schema, Schema: schema,
Tablename: table, Tablename: table,
UserID: userRef, UserID: userRef,
Template: template, Template: template.String,
HasBlock: hasBlock, HasBlock: hasBlock.Bool,
}, nil }, nil
} }