-
Notifications
You must be signed in to change notification settings - Fork 901
chore: change sql parameter for custom roles to be a (name,org)
tuple
#13480
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
Changes from 1 commit
8e98cea
4356f53
7f37232
a305e70
8da3601
dc7fe77
a1a42b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,17 +160,13 @@ func (*NameOrganizationPair) Scan(_ interface{}) error { | |
// shell. | ||
// | ||
// SELECT ('customrole'::text,'ece79dac-926e-44ca-9790-2ff7c5eb6e0c'::uuid); | ||
// To see 'null' option | ||
// SELECT ('customrole',null); | ||
// To see 'null' option. Using the nil uuid as null to avoid empty string literals for null. | ||
// SELECT ('customrole',00000000-0000-0000-0000-000000000000); | ||
// | ||
// This value is usually used as an array, NameOrganizationPair[]. You can see | ||
// what that literal is as well, with proper quoting. | ||
// | ||
// SELECT ARRAY[('customrole'::text,'ece79dac-926e-44ca-9790-2ff7c5eb6e0c'::uuid)]; | ||
func (a NameOrganizationPair) Value() (driver.Value, error) { | ||
if a.OrganizationID == uuid.Nil { | ||
return fmt.Sprintf(`('%s',)`, a.Name), nil | ||
} | ||
|
||
return fmt.Sprintf(`(%s,%s)`, a.Name, a.OrganizationID.String()), nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the name here probably want to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It cannot be quoted, I was trying that before. This is a parameter argument still, so it will replace I had considered a sql injection, but can a sql injection happen at a parameter substitution? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good point actually. This is fine, sry There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just tried to send in some invalid sql with The That is the function behavior I am overriding. 👍 |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can bring
NULL
back, but for the life of me I could not get it to work. I think it has to do with my understanding of representingNULL
as a literal