Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e7a7300
remove unused function tableName from db package
jakedoublev Mar 1, 2024
810a9ba
new protos and gen code/docs
jakedoublev Mar 1, 2024
8d9129c
store ACTIONS as JSONB instead of VARCHAR array to support oneof stan…
jakedoublev Mar 1, 2024
5c1e3ed
checkpoint after schema relation update to remove pivot table and uti…
jakedoublev Mar 4, 2024
d546c4d
cleanup and diagram notes update
jakedoublev Mar 4, 2024
42415e4
make sure to always close rows
jakedoublev Mar 5, 2024
0ed6cbc
sync up new create/update behavior with policy api norms
jakedoublev Mar 5, 2024
1e3cfe3
map to new types
jakedoublev Mar 5, 2024
1303e2d
db layer and integration tests so far (passing)
jakedoublev Mar 5, 2024
2d147b9
fully working integration tests for subjectmappings and subject condi…
jakedoublev Mar 6, 2024
8aa4351
remove extraneous error check
jakedoublev Mar 6, 2024
1e24496
follow new policy proto norms for subject condition sets
jakedoublev Mar 6, 2024
4def80e
Merge branch 'main' into policy/subject-sets
jakedoublev Mar 6, 2024
1a55c66
provide back active state of attribute values with attributes when ge…
jakedoublev Mar 6, 2024
25e87e1
cleanup
jakedoublev Mar 6, 2024
f9db1b2
clean subjectmappings proto comments
jakedoublev Mar 6, 2024
ab555ce
remove name as a column and proto field on subject condition sets, st…
jakedoublev Mar 6, 2024
32cd6ae
cleanup
jakedoublev Mar 6, 2024
71f46dd
make delete, update, create only return id for subject mappings and s…
jakedoublev Mar 6, 2024
d1c26f3
Merge branch 'main' into policy/subject-sets
jakedoublev Mar 6, 2024
d9fcafc
fix test
jakedoublev Mar 6, 2024
03bce8e
cleanup
jakedoublev Mar 6, 2024
7d92289
move policy tables into policy db package and out of main internal db…
jakedoublev Mar 6, 2024
e698be0
Merge branch 'main' into policy/subject-sets
jakedoublev Mar 6, 2024
10756da
move kasr db out of internal db package
jakedoublev Mar 6, 2024
3f726f3
one more test
jakedoublev Mar 7, 2024
1a08410
Merge branch 'main' into policy/subject-sets
jakedoublev Mar 7, 2024
46feb88
add working group blue scenario
jakedoublev Mar 8, 2024
8df7c6a
update fixtures.yaml to be policy_fixtures.yaml
jakedoublev Mar 8, 2024
618e744
checkpoint getentitlements tests working
jakedoublev Mar 8, 2024
ac2310e
unify subject mappings naming throughout
jakedoublev Mar 8, 2024
865b067
Merge branch 'main' into policy/subject-sets
jakedoublev Mar 8, 2024
73862aa
Merge branch 'policy/subject-sets' into feat/entitlements-unscoped
jakedoublev Mar 8, 2024
c122774
Merge branch 'main' into policy/subject-sets
jakedoublev Mar 11, 2024
d2cd8f5
sync up create/update/delete response with rest of policy API updates…
jakedoublev Mar 11, 2024
77bf8ba
sync up subject condition set RPCs as well
jakedoublev Mar 11, 2024
a871c40
match rpc handlers to proto expectations
jakedoublev Mar 11, 2024
795e626
tiny test fixes to namespaces after merging
jakedoublev Mar 11, 2024
b781aac
further sync up with Policy API proto/rpc behavior
jakedoublev Mar 11, 2024
025e113
return all values on create, id on update/delete, unify comments and …
jakedoublev Mar 11, 2024
592ab92
update tests and fix potential nil pointer exception where the metada…
jakedoublev Mar 11, 2024
96ca42f
fix conflict around migration names and add the timestamp columns to …
jakedoublev Mar 11, 2024
92cc666
Merge branch 'main' into policy/subject-sets
jakedoublev Mar 11, 2024
327c1f4
remove extraneous comment
jakedoublev Mar 11, 2024
5983a52
Merge branch 'policy/subject-sets' into feat/entitlements-unscoped
jakedoublev Mar 11, 2024
b70e5e3
fix test and undefined values post-merge
jakedoublev Mar 11, 2024
13704d1
tiny fix
jakedoublev Mar 11, 2024
ef50138
handle key not in fixtures map edge case
jakedoublev Mar 11, 2024
f7e8c24
Merge branch 'policy/subject-sets' into feat/entitlements-unscoped
jakedoublev Mar 11, 2024
d25248c
Merge branch 'main' into feat/entitlements-unscoped
jakedoublev Mar 11, 2024
5352abb
Merge branch 'main' into feat/entitlements-unscoped
jakedoublev Mar 11, 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
2 changes: 1 addition & 1 deletion cmd/provisionFixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You can clear/recycle your database with 'docker-compose down' and 'docker-compo

dbI := fixtures.NewDBInterface(*cfg)
f := fixtures.NewFixture(dbI)
fixtures.LoadFixtureData("./internal/fixtures/fixtures.yaml")
fixtures.LoadFixtureData("./internal/fixtures/policy_fixtures.yaml")
f.Provision()

fmt.Print("fixtures provision fully applied")
Expand Down
75 changes: 41 additions & 34 deletions docs/grpc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -755,10 +755,6 @@ <h2>Table of Contents</h2>
<a href="#policy.subjectmapping.MatchSubjectMappingsResponse"><span class="badge">M</span>MatchSubjectMappingsResponse</a>
</li>

<li>
<a href="#policy.subjectmapping.Subject"><span class="badge">M</span>Subject</a>
</li>

<li>
<a href="#policy.subjectmapping.SubjectConditionSet"><span class="badge">M</span>SubjectConditionSet</a>
</li>
Expand All @@ -771,6 +767,10 @@ <h2>Table of Contents</h2>
<a href="#policy.subjectmapping.SubjectMapping"><span class="badge">M</span>SubjectMapping</a>
</li>

<li>
<a href="#policy.subjectmapping.SubjectProperty"><span class="badge">M</span>SubjectProperty</a>
</li>

<li>
<a href="#policy.subjectmapping.SubjectSet"><span class="badge">M</span>SubjectSet</a>
</li>
Expand Down Expand Up @@ -5297,7 +5297,7 @@ <h3 id="policy.subjectmapping.ListSubjectMappingsResponse">ListSubjectMappingsRe


<h3 id="policy.subjectmapping.MatchSubjectMappingsRequest">MatchSubjectMappingsRequest</h3>
<p></p>
<p>MatchSubjectMappingsRequest liberally returns a list of SubjectMappings based on the provided SubjectProperties. The SubjectMappings are returned</p><p>if there is any single condition found among the structures that matches for one of the provided properties:</p><p>1. The external field, external value, and an IN operator</p><p>2. The external field, _no_ external value, and a NOT_IN operator</p><p>Without this filtering, if a field was something like 'emailAddress' or 'username', every Subject is probably going to relate to that mapping</p><p>in some way or another, potentially matching every single attribute in the DB if a policy admin has relied heavily on that field. There is no</p><p>logic applied beyond a single condition within the query to avoid business logic interpreting the supplied conditions beyond the bare minimum</p><p>initial filter.</p><p>NOTE: if you have any issues, debug logs are available within the service to help identify why a mapping was or was not returned.</p>


<table class="field-table">
Expand All @@ -5307,10 +5307,10 @@ <h3 id="policy.subjectmapping.MatchSubjectMappingsRequest">MatchSubjectMappingsR
<tbody>

<tr>
<td>subject</td>
<td><a href="#policy.subjectmapping.Subject">Subject</a></td>
<td></td>
<td><p>Required </p></td>
<td>subject_properties</td>
<td><a href="#policy.subjectmapping.SubjectProperty">SubjectProperty</a></td>
<td>repeated</td>
<td><p> </p></td>
</tr>

</tbody>
Expand Down Expand Up @@ -5344,30 +5344,6 @@ <h3 id="policy.subjectmapping.MatchSubjectMappingsResponse">MatchSubjectMappings



<h3 id="policy.subjectmapping.Subject">Subject</h3>
<p>A Representation of a subject as attribute->value pairs. This would mirror user attributes retrieved</p><p>from an authoritative source such as an IDP (Identity Provider) or User Store. Examples include such ADFS/LDAP, OKTA, etc.</p>


<table class="field-table">
<thead>
<tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
</thead>
<tbody>

<tr>
<td>attributes</td>
<td><a href="#google.protobuf.Struct">google.protobuf.Struct</a></td>
<td></td>
<td><p> </p></td>
</tr>

</tbody>
</table>





<h3 id="policy.subjectmapping.SubjectConditionSet">SubjectConditionSet</h3>
<p>A container for multiple Subject Sets, each containing Condition Groups, each containing Conditions. Multiple Subject Sets in a SubjectConditionSet</p><p>are evaluated with AND logic. As each Subject Mapping has only one Attribute Value, the SubjectConditionSet is reusable across multiple</p><p>Subject Mappings / Attribute Values and is an independent unit.</p>

Expand Down Expand Up @@ -5490,6 +5466,37 @@ <h3 id="policy.subjectmapping.SubjectMapping">SubjectMapping</h3>



<h3 id="policy.subjectmapping.SubjectProperty">SubjectProperty</h3>
<p>A property of a Subject/Entity as a field->value pair. This would mirror external user attributes retrieved</p><p>from an authoritative source such as an IDP (Identity Provider) or User Store. Examples include such ADFS/LDAP, OKTA, etc.</p><p>For now, a valid property must contain both field & value.</p>


<table class="field-table">
<thead>
<tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
</thead>
<tbody>

<tr>
<td>external_field</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>

<tr>
<td>external_value</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>

</tbody>
</table>





<h3 id="policy.subjectmapping.SubjectSet">SubjectSet</h3>
<p>A collection of Condition Groups</p>

Expand Down Expand Up @@ -5834,7 +5841,7 @@ <h4>Methods with HTTP bindings</h4>
<td>MatchSubjectMappings</td>
<td>POST</td>
<td>/subject-mappings/match</td>
<td>subject</td>
<td>subject_properties</td>
</tr>


Expand Down
38 changes: 18 additions & 20 deletions docs/openapi/policy/subjectmapping/subject_mapping.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,15 @@
},
"parameters": [
{
"name": "subject",
"description": "Required",
"name": "subjectProperties",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/subjectmappingSubject"
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/subjectmappingSubjectProperty"
}
}
}
],
Expand Down Expand Up @@ -615,14 +618,6 @@
"additionalProperties": {},
"description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }"
},
"protobufNullValue": {
"type": "string",
"enum": [
"NULL_VALUE"
],
"default": "NULL_VALUE",
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
},
"rpcStatus": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -822,15 +817,6 @@
}
}
},
"subjectmappingSubject": {
"type": "object",
"properties": {
"attributes": {
"type": "object"
}
},
"description": "A Representation of a subject as attribute-\u003evalue pairs. This would mirror user attributes retrieved\nfrom an authoritative source such as an IDP (Identity Provider) or User Store. Examples include such ADFS/LDAP, OKTA, etc."
},
"subjectmappingSubjectConditionSet": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -906,6 +892,18 @@
"default": "SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED",
"title": "buflint ENUM_VALUE_PREFIX: to make sure that C++ scoping rules aren't violated when users add new enum values to an enum in a given package"
},
"subjectmappingSubjectProperty": {
"type": "object",
"properties": {
"externalField": {
"type": "string"
},
"externalValue": {
"type": "string"
}
},
"description": "A property of a Subject/Entity as a field-\u003evalue pair. This would mirror external user attributes retrieved\nfrom an authoritative source such as an IDP (Identity Provider) or User Store. Examples include such ADFS/LDAP, OKTA, etc.\nFor now, a valid property must contain both field \u0026 value."
},
"subjectmappingSubjectSet": {
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func TestMain(m *testing.M) {
slog.Info("🚚 applied migrations", slog.Int("count", applied))

slog.Info("🏠 loading fixtures")
fixtures.LoadFixtureData("../internal/fixtures/fixtures.yaml")
fixtures.LoadFixtureData("../internal/fixtures/policy_fixtures.yaml")

slog.Info("📚 indexing FQNs for test fixtures")
db.PolicyClient.AttrFqnReindex()
Expand Down
Loading