Skip to content

Commit a859c1a

Browse files
committed
fix connection nats
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
1 parent 413499b commit a859c1a

File tree

12 files changed

+13
-42
lines changed

12 files changed

+13
-42
lines changed

app/artifact-cas/api/buf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ deps:
77
- buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0
88
lint:
99
use:
10-
- DEFAULT
10+
- STANDARD

app/artifact-cas/internal/conf/buf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ deps:
77
- buf.build/bufbuild/protovalidate:b983156c5e994cc9892e0ce3e64e17e0
88
lint:
99
use:
10-
- DEFAULT
10+
- STANDARD
1111
ignore_only:
1212
PACKAGE_DEFINED:
1313
- ./conf.proto

app/controlplane/api/buf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ deps:
99
- buf.build/grpc-ecosystem/grpc-gateway:v2.26.3
1010
lint:
1111
use:
12-
- DEFAULT
12+
- STANDARD
1313
ignore_only:
1414
ENUM_ZERO_VALUE_SUFFIX:
1515
- controlplane/v1/pagination.proto

app/controlplane/cmd/wire.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func wireApp(*conf.Bootstrap, credentials.ReaderWriter, log.Logger, sdk.Availabl
7171
}
7272

7373
func authzConfig(conf *conf.Bootstrap) *authz.Config {
74-
return &authz.Config{ManagedResources: authz.ManagedResources, RolesMap: authz.RolesMap, RestrictOrgCreation: conf.RestrictOrgCreation}
74+
return &authz.Config{RolesMap: authz.RolesMap, RestrictOrgCreation: conf.RestrictOrgCreation}
7575
}
7676

7777
func newJWTConfig(conf *conf.Auth) *biz.APITokenJWTConfig {

app/controlplane/cmd/wire_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/internal/conf/buf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ deps:
88
- buf.build/kratos-go/kratos:e1d52e944e3845c6862a566db322432d
99
lint:
1010
use:
11-
- DEFAULT
11+
- STANDARD
1212
ignore_only:
1313
PACKAGE_DEFINED:
1414
- ./conf.proto

app/controlplane/pkg/authz/authz.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,6 @@ const (
100100
RoleProductAdmin Role = "role:product:admin"
101101
)
102102

103-
// ManagedResources are the resources that are managed by Chainloop, considered during permissions sync
104-
var ManagedResources = []string{
105-
ResourceWorkflowContract,
106-
ResourceCASArtifact,
107-
ResourceCASBackend,
108-
ResourceReferrer,
109-
ResourceAvailableIntegration,
110-
ResourceRegisteredIntegration,
111-
ResourceAttachedIntegration,
112-
ResourceOrgMetric,
113-
ResourceRobotAccount,
114-
ResourceWorkflowRun,
115-
ResourceWorkflow,
116-
ResourceProject,
117-
Organization,
118-
OrganizationMemberships,
119-
ResourceGroup,
120-
ResourceGroupMembership,
121-
ResourceAPIToken,
122-
ResourceProjectMembership,
123-
ResourceOrganizationInvitations,
124-
}
125-
126103
var (
127104
// Referrer
128105
PolicyReferrerRead = &Policy{ResourceReferrer, ActionRead}

app/controlplane/pkg/authz/authz_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestDoSync(t *testing.T) {
9292
},
9393
}
9494

95-
err = doSync(e, &Config{RolesMap: policiesM, ManagedResources: []string{ResourceWorkflowContract, ResourceCASArtifact}})
95+
err = doSync(e, &Config{RolesMap: policiesM})
9696
assert.NoError(t, err)
9797
got, err = e.GetPolicy()
9898
assert.NoError(t, err)
@@ -105,7 +105,7 @@ func TestDoSync(t *testing.T) {
105105
},
106106
}
107107

108-
err = doSync(e, &Config{RolesMap: policiesM, ManagedResources: []string{ResourceWorkflowContract, ResourceCASArtifact}})
108+
err = doSync(e, &Config{RolesMap: policiesM})
109109
assert.NoError(t, err)
110110
got, err = e.GetPolicy()
111111
assert.NoError(t, err)
@@ -125,7 +125,6 @@ func TestDoSync(t *testing.T) {
125125
assert.Len(t, got, 2)
126126
}
127127

128-
129128
func testEnforcer(t *testing.T) (*Enforcer, io.Closer) {
130129
f, err := os.CreateTemp(t.TempDir(), "policy*.csv")
131130
if err != nil {

app/controlplane/pkg/authz/enforcer.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func (t *SubjectAPIToken) String() string {
3838
var modelFile []byte
3939

4040
type Config struct {
41-
ManagedResources []string
4241
RolesMap map[Role][]*Policy
4342
RestrictOrgCreation bool
4443
}
@@ -57,7 +56,8 @@ func (e *Enforcer) Enforce(sub string, p *Policy) (bool, error) {
5756
// EnforceWithPolicies checks if the required policy exists in the provided list of allowed policies.
5857
// This is used for ACL-based authorization (e.g., API tokens) where policies are stored in the database
5958
// rather than in Casbin. Returns true if the required policy is found in the allowed list.
60-
func (e *Enforcer) EnforceWithPolicies(sub string, p *Policy, allowedPolicies []*Policy) (bool, error) {
59+
// in the future we will use this function to check if the policy is allowed for the subject by running the enforcer with the subject
60+
func (e *Enforcer) EnforceWithPolicies(_ string, p *Policy, allowedPolicies []*Policy) (bool, error) {
6161
for _, allowed := range allowedPolicies {
6262
if allowed.Resource == p.Resource && allowed.Action == p.Action {
6363
return true, nil
@@ -171,11 +171,6 @@ func doSync(e *Enforcer, c *Config) error {
171171
resource := p[1]
172172
action := p[2]
173173

174-
// if it's not a managed resource, skip deletion
175-
if !slices.Contains(conf.ManagedResources, resource) {
176-
continue
177-
}
178-
179174
wantPolicies, ok := conf.RolesMap[Role(role)]
180175
// if the role does not exist in the map, we can delete the policy
181176
if !ok {

app/controlplane/pkg/biz/testhelpers/wire.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func WireTestData(*TestDatabase, *testing.T, log.Logger, credentials.ReaderWrite
6868
}
6969

7070
func authzConfig() *authz.Config {
71-
return &authz.Config{ManagedResources: authz.ManagedResources, RolesMap: authz.RolesMap}
71+
return &authz.Config{RolesMap: authz.RolesMap}
7272
}
7373

7474
func newJWTConfig(conf *conf.Auth) *biz.APITokenJWTConfig {

0 commit comments

Comments
 (0)