ROX-13326: Use UUID columns for roles, permissionsets and simpleaccessscopes (PermissionSet and SimpleAccessScope identifiers) in postgres mode.#3725
Conversation
|
Skipping CI for Draft Pull Request. |
c696624 to
caab356
Compare
|
/test all |
|
/test all |
|
Images are ready for the commit at 1d580ea. To use with deploy scripts, first |
5e750b0 to
ce4d71b
Compare
ce4d71b to
51d2029
Compare
|
/test all |
|
/test all |
migrator/migrations/n_52_to_n_53_postgres_simple_access_scopes/migration.go
Outdated
Show resolved
Hide resolved
migrator/migrations/n_52_to_n_53_postgres_simple_access_scopes/migration.go
Outdated
Show resolved
Hide resolved
| for _, pk := range q.Schema.PrimaryKeys() { | ||
| primaryKeyPaths = append(primaryKeyPaths, qualifyColumn(pk.Schema.Table, pk.ColumnName)) | ||
| var cast string | ||
| if pk.SQLType == "uuid" { |
There was a problem hiding this comment.
How about re-using postgres/walker/types.go here instead of using the string representation?
I haven't looked too deep into it, but I saw that you already import postgres/walker, so I would assume that we do not end up in a circular dependency.
However, if it's not possible, we should create an unexported const for this within this file.
| switch subBQ := q.GetBaseQuery().Query.(type) { | ||
| case *v1.BaseQuery_DocIdQuery: | ||
| cast := "::text[]" | ||
| if schema.ID().SQLType == "uuid" { |
There was a problem hiding this comment.
Why are we not mapping it to text[] here in case of uuid?
| if queryModifiers[0] == pkgSearch.AtLeastOne { | ||
| panic("I dont think this is used") | ||
| } |
There was a problem hiding this comment.
Should we handle this more graceful instead of this panic and return an error here?
I'm not sure whether this is a pattern within the postgres code, I certainly know it's not for the rest of the stackrox code 😛
| err := fmt.Errorf("unknown query modifier: %s", queryModifiers[0]) | ||
| utils.Should(err) |
There was a problem hiding this comment.
Since we already use the switch case, let's use this within a default case.
| err := fmt.Errorf("unknown query modifier: %s", queryModifiers[0]) | |
| utils.Should(err) | |
| default: | |
| err := fmt.Errorf("unknown query modifier: %s", queryModifiers[0]) | |
| utils.Should(err) | |
| return WhereClause{}, err |
There was a problem hiding this comment.
I recently learned that we should use utils.Should only in case or programatic errors that are not tied to user input. In this case, I'm not sure we should use it (since its bound on the query modifier parameter from the consumer of the function) - so it might be just sufficient enough to log within the default case and return an error here instead of using utils.Should.
f025c70 to
05cff82
Compare
|
/test all |
1 similar comment
|
/test all |
6a1cbb9 to
1da346c
Compare
…sscopes (PermissionSet and SimpleAccessScope identifiers) in postgres mode.
…ers do not get regenerated
534473b to
85c6d50
Compare
|
/retest |
|
/test gke-postgres-nongroovy-e2e-tests |
|
/test gke-postgres-qa-e2e-tests |
central/role/accessscope_ids.go
Outdated
| // The values are UUIDs taken in descending order from ffffffff-ffff-fff4-f5ff-ffffffffffff | ||
| // Next ID: ffffffff-ffff-fff4-f5ff-fffffffffffd | ||
| const ( | ||
| denyAllAccessScopeID = "ffffffff-ffff-fff4-f5ff-fffffffffffe" |
There was a problem hiding this comment.
nit: would it make sense to order these in descending order like was done with permission sets?
…sscopes (PermissionSet and SimpleAccessScope identifiers) in postgres mode. (#3725)
Description
The relation between roles and the associated permission sets as well as access scopes used to be done relying on decorated UUIDs (generated UUIDs prefixed with human-readable strings).
These object are candidate to conversion to UUIDs.
Some of the UUID base work is needed for this change to work (PRs #3679 and #3681 ).
PR stack:
#3802 (server support code)
+- #3725 (data migration)
... +- #3818 (UI code)
Checklist
- [ ] Evaluated and added CHANGELOG entry if required- [ ] Determined and documented upgrade steps- [ ] Documented user facing changes (create PR based on openshift/openshift-docs and merge into rhacs-docs)If any of these don't apply, please comment below.
Testing Performed
CI is a good first step.
Manual testing performed:
One observation during the manual test was that the
Unrestrictedaccess scope page failed to open. A pull request has been opened in order to fix the UI part as a consequence (#3818).