Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 7 additions & 6 deletions opentdf-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ services:
entityresolution:
enabled: true
url: http://localhost:8888/auth
clientid: "tdf-entity-resolution"
clientsecret: "secret"
realm: "opentdf"
clientid: 'tdf-entity-resolution'
clientsecret: 'secret'
realm: 'opentdf'
legacykeycloak: true
server:
auth:
enabled: true
enforceDPoP: false
audience: "http://localhost:8080"
audience: 'http://localhost:8080'
issuer: http://localhost:8888/auth/realms/opentdf
policy:
## Default policy for all requests
Expand All @@ -61,6 +61,7 @@ server:
# p, role:org-admin, policy:subject-mappings, *, *, allow
# p, role:org-admin, policy:resource-mappings, *, *, allow
# p, role:org-admin, policy:kas-registry, *, *, allow
# p, role:org-admin, policy:unsafe, *, *, allow

## Custom model (see https://casbin.org/docs/syntax-for-models/)
model: #|
Expand All @@ -81,8 +82,8 @@ server:
cors:
enabled: false
# '*' to allow any origin or a specific domain like 'https://yourdomain.com'
allowedorigins:
- "*"
allowedorigins:
- '*'
# List of methods. Examples: 'GET,POST,PUT'
allowedmethods:
- GET
Expand Down
1 change: 1 addition & 0 deletions opentdf-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ server:
# p, role:org-admin, policy:subject-mappings, *, *, allow
# p, role:org-admin, policy:resource-mappings, *, *, allow
# p, role:org-admin, policy:kas-registry, *, *, allow
# p, role:org-admin, policy:unsafe, *, *, allow
## Custom model (see https://casbin.org/docs/syntax-for-models/)
model: #|
# [request_definition]
Expand Down
1 change: 1 addition & 0 deletions opentdf-with-hsm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ server:
# p, role:org-admin, policy:subject-mappings, *, *, allow
# p, role:org-admin, policy:resource-mappings, *, *, allow
# p, role:org-admin, policy:kas-registry, *, *, allow
# p, role:org-admin, policy:unsafe, *, *, allow
## Custom model (see https://casbin.org/docs/syntax-for-models/)
model: #|
# [request_definition]
Expand Down
484 changes: 250 additions & 234 deletions protocol/go/policy/unsafe/unsafe.pb.go

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions service/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ breaking:
- PACKAGE
- WIRE_JSON
- WIRE
ignore:
- policy/unsafe/unsafe.proto
lint:
allow_comment_ignores: true
use:
Expand Down
5 changes: 3 additions & 2 deletions service/internal/auth/casbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ p, role:org-admin, /unsafe*, *, allow

# Role: Admin
## gRPC routes
p, role:admin, policy.*, *, allow
p, role:admin, policy.*, read, allow
p, role:admin, policy.*, write, allow
p, role:admin, policy.*, delete, allow
p, role:admin, kasregistry.*, *, allow
p, role:admin, kas.AccessService/Rewrap, *, allow
p, role:admin, authorization.*, *, allow
Expand All @@ -73,7 +75,6 @@ p, role:admin, /kas/v2/rewrap, *, allow

## Role: Standard
## gRPC routes
p, role:standard, policy.unsafe.*, *, deny
p, role:standard, policy.*, read, allow
p, role:standard, kasregistry.*, read, allow
p, role:standard, kas.AccessService/Rewrap, *, allow
Expand Down
7 changes: 1 addition & 6 deletions service/policy/db/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,7 @@ func (c PolicyDBClient) GetNamespace(ctx context.Context, id string) (*policy.Na
return nil, err
}

n, err := hydrateNamespaceItem(row, opts)
if err != nil {
return nil, err
}

return n, nil
return hydrateNamespaceItem(row, opts)
}

func listNamespacesSQL(opts namespaceSelectOptions) (string, []interface{}, error) {
Expand Down
4 changes: 2 additions & 2 deletions service/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/opentdf/platform/service/policy/namespaces"
"github.com/opentdf/platform/service/policy/resourcemapping"
"github.com/opentdf/platform/service/policy/subjectmapping"
// "github.com/opentdf/platform/service/policy/unsafe"
"github.com/opentdf/platform/service/policy/unsafe"
)

var Migrations *embed.FS
Expand All @@ -33,7 +33,7 @@ func NewRegistrations() []serviceregistry.Registration {
resourcemapping.NewRegistration(),
subjectmapping.NewRegistration(),
kasregistry.NewRegistration(),
// unsafe.NewRegistration(),
unsafe.NewRegistration(),
} {
r.Namespace = namespace
r.DB = dbRegister
Expand Down
4 changes: 2 additions & 2 deletions service/policy/unsafe/unsafe.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ message UnsafeUpdateNamespaceRequest {
(buf.validate.field).string.max_len = 253,
(buf.validate.field).cel = {
id: "namespace_name_format",
message: "Namespace name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored namespace name will be normalized to lower case.",
expression: "this.matches('^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$')"
message: "Namespace must be a valid hostname. It should include at least one dot, with each segment (label) starting and ending with an alphanumeric character. Each label must be 1 to 63 characters long, allowing hyphens but not as the first or last character. The top-level domain (the last segment after the final dot) must consist of at least two alphabetic characters. The stored namespace will be normalized to lower case.",
expression: "this.matches('^([a-zA-Z0-9]([a-zA-Z0-9\\\\-]{0,61}[a-zA-Z0-9])?\\\\.)+[a-zA-Z]{2,}$')"
}
];
}
Expand Down