Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixing persister_grant_jwk having an OR statement without bracket leading to not using the last part of the query #3499

Merged
merged 1 commit into from
Apr 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions persistence/sql/persister_grant_jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (p *Persister) GetPublicKey(ctx context.Context, issuer string, subject str
var data trust.SQLData
query := p.QueryWithNetwork(ctx).
Where("issuer = ?", issuer).
Where("subject = ? OR allow_any_subject IS TRUE", subject).
Where("(subject = ? OR allow_any_subject IS TRUE)", subject).
Where("key_id = ?", keyId).
Where("nid = ?", p.NetworkID(ctx))
if err := query.First(&data); err != nil {
Expand All @@ -135,7 +135,7 @@ func (p *Persister) GetPublicKeys(ctx context.Context, issuer string, subject st
grantsData := make([]trust.SQLData, 0)
query := p.QueryWithNetwork(ctx).
Where("issuer = ?", issuer).
Where("subject = ? OR allow_any_subject IS TRUE", subject).
Where("(subject = ? OR allow_any_subject IS TRUE)", subject).
Where("nid = ?", p.NetworkID(ctx))

if err := query.All(&grantsData); err != nil {
Expand Down Expand Up @@ -170,7 +170,7 @@ func (p *Persister) GetPublicKeyScopes(ctx context.Context, issuer string, subje
var data trust.SQLData
query := p.QueryWithNetwork(ctx).
Where("issuer = ?", issuer).
Where("subject = ? OR allow_any_subject IS TRUE", subject).
Where("(subject = ? OR allow_any_subject IS TRUE)", subject).
Where("key_id = ?", keyId).
Where("nid = ?", p.NetworkID(ctx))

Expand Down