Skip to content

fix(dashboards): check access only for non-empty namespace (#141) #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
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
1 change: 1 addition & 0 deletions src/main/java/io/kestra/plugin/git/PushDashboards.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public Object globs() {

@Override
public Property<String> fetchedNamespace() {
// Dashboards are not linked to namespaces
return Property.of("");
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/kestra/plugin/git/SyncDashboards.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ private DashboardRepositoryInterface repository(RunContext runContext) {

@Override
public Property<String> fetchedNamespace() {
// Dashboards are not linked to namespaces
return Property.of("");
}

Expand Down
15 changes: 9 additions & 6 deletions src/main/java/io/kestra/plugin/git/services/GitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@ public String getHttpUrl(String gitUrl) {
public void namespaceAccessGuard(RunContext runContext, Property<String> namespaceToAccess) throws IllegalVariableEvaluationException {
FlowService flowService = ((DefaultRunContext)runContext).getApplicationContext().getBean(FlowService.class);
RunContext.FlowInfo flowInfo = runContext.flowInfo();
flowService.checkAllowedNamespace(
runContext.flowInfo().tenantId(),
runContext.render(namespaceToAccess).as(String.class).orElse(null),
flowInfo.tenantId(),
flowInfo.namespace()
);
String namespace = runContext.render(namespaceToAccess).as(String.class).orElse(null);
if (namespace != null && !namespace.isBlank()) {
flowService.checkAllowedNamespace(
runContext.flowInfo().tenantId(),
namespace,
flowInfo.tenantId(),
flowInfo.namespace()
);
}
}
}
Loading