Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4711dbb
feat(policy): add unsafe attribute RPC db connectivity
jakedoublev Jun 21, 2024
8c4ce93
allow reordering attribute values unsafely
jakedoublev Jun 21, 2024
d759609
wip
jakedoublev Jun 21, 2024
d36c10e
lint fix
jakedoublev Jun 21, 2024
45b3000
clarify support for unsafe behaviors and that values replacement on a…
jakedoublev Jun 21, 2024
018ce1b
add new fqn test around active status
jakedoublev Jun 21, 2024
98c0048
Merge branch 'main' into feat/unsafe-attr
jakedoublev Jun 21, 2024
8db7462
remove defunc tests
jakedoublev Jun 21, 2024
d1eb25f
Merge branch 'main' into feat/unsafe-attr
jakedoublev Jun 21, 2024
3c8c4aa
more tests and cleanup
jakedoublev Jun 21, 2024
151bf0d
wrap not found error in not found case of GetAttributesByValuesFqns
jakedoublev Jun 21, 2024
66d80f4
lint fix
jakedoublev Jun 21, 2024
a80b0fe
lint fix
jakedoublev Jun 21, 2024
b2e845e
update tests
jakedoublev Jun 21, 2024
c34b786
lint fix
jakedoublev Jun 21, 2024
b74fdea
fixes
jakedoublev Jun 21, 2024
914cb25
fix test
jakedoublev Jun 21, 2024
360ac84
test fix
jakedoublev Jun 21, 2024
ca02a44
move fqn validation on delete of ns and attr down into db handlers an…
jakedoublev Jun 21, 2024
e2661a8
test improvements
jakedoublev Jun 21, 2024
1024d53
normalize casing
jakedoublev Jun 21, 2024
08608a2
fixes
jakedoublev Jun 21, 2024
4f3c458
test reordering that is not vanilla reversal
jakedoublev Jun 21, 2024
ed9445d
add migration with triggers
jakedoublev Jun 24, 2024
8c849a4
remove migration with triggers
jakedoublev Jun 24, 2024
58016b3
add sqlc
jakedoublev Jun 24, 2024
11777ec
document sqlc
jakedoublev Jun 24, 2024
7bbd75f
add sqlc gen code in queries package
jakedoublev Jun 24, 2024
465f087
update docs for sqlc
jakedoublev Jun 24, 2024
a494eeb
add sqlc queries to db struct
jakedoublev Jun 24, 2024
8ca0c96
make corrected upsert call
jakedoublev Jun 24, 2024
2f5511a
Merge branch 'main' into feat/unsafe-attr
jakedoublev Jun 24, 2024
dc91bbb
log upsert results and continue to swallow errors
jakedoublev Jun 24, 2024
20ab6bc
remove sqlc and pass all fqn tests thus far
jakedoublev Jun 24, 2024
425a2e9
lint fix
jakedoublev Jun 24, 2024
a98a6be
remove sqlc.yaml
jakedoublev Jun 24, 2024
f091ede
test cleanup
jakedoublev Jun 24, 2024
ddbb139
Merge branch 'main' into feat/unsafe-attr
jakedoublev Jun 24, 2024
fa71eef
cleanup of todo comment
jakedoublev Jun 25, 2024
01e81e3
improve tests
jakedoublev Jun 25, 2024
05a91f0
Merge branch 'main' into feat/unsafe-attr
jakedoublev Jun 26, 2024
e09872d
Merge branch 'main' into feat/unsafe-attr
jakedoublev Jul 1, 2024
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
10 changes: 10 additions & 0 deletions docs/grpc/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions docs/openapi/policy/unsafe/unsafe.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

326 changes: 170 additions & 156 deletions protocol/go/policy/unsafe/unsafe.pb.go

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions service/integration/attribute_fqns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,57 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithDeactivatedAt
s.Require().ErrorIs(err, db.ErrNotFound)
}

func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithDeactivatedAttributeValue() {
// create a new namespace
ns, err := s.db.PolicyClient.CreateNamespace(s.ctx, &namespaces.CreateNamespaceRequest{
Name: "test_fqn_namespace.goodbye",
})
s.Require().NoError(err)

// give it an attribute with two values
attr, err := s.db.PolicyClient.CreateAttribute(s.ctx, &attributes.CreateAttributeRequest{
NamespaceId: ns.GetId(),
Name: "deactivating_attr",
Rule: policy.AttributeRuleTypeEnum_ATTRIBUTE_RULE_TYPE_ENUM_ANY_OF,
})
s.Require().NoError(err)

v1, err := s.db.PolicyClient.CreateAttributeValue(s.ctx, attr.GetId(), &attributes.CreateAttributeValueRequest{
Value: "value1",
})
s.Require().NoError(err)

v2, err := s.db.PolicyClient.CreateAttributeValue(s.ctx, attr.GetId(), &attributes.CreateAttributeValueRequest{
Value: "value2",
})
s.Require().NoError(err)

// deactivate the first attribute value only
_, err = s.db.PolicyClient.DeactivateAttributeValue(s.ctx, v1.GetId())
s.Require().NoError(err)

// get the attribute by the value fqn for v1
v, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v1.GetValue())},
WithValue: &policy.AttributeValueSelector{
WithSubjectMaps: true,
},
})
s.Require().Error(err)
s.Nil(v)
s.Require().ErrorIs(err, db.ErrNotFound)

// get the attribute by the value fqn for v2
v, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v2.GetValue())},
WithValue: &policy.AttributeValueSelector{
WithSubjectMaps: true,
},
})
s.Require().NoError(err)
s.Len(v, 1)
}

func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithNonValueFqns() {
nsFqn := fqnBuilder("example.com", "", "")
attrFqn := fqnBuilder("example.com", "attr1", "")
Expand Down
Loading