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
51 changes: 51 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CodeQL
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
schedule:
- cron: '21 3 * * 3'

permissions: read-all

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write
packages: read
actions: read
contents: read

strategy:
fail-fast: false
matrix:
language: ['go']

steps:
- name: checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.26.5

- name: Initialize CodeQL
uses: github/codeql-action/init@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
with:
languages: ${{ matrix.language }}

- name: Build
# Autobuild's heuristic only traced a fraction of the module (79 of 189 files per the
# code-scanning diagnostic). Build the whole module explicitly so CodeQL sees every package.
run: go build ./...

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
with:
category: "/language:${{ matrix.language }}"
10 changes: 5 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: 1.26.4
go-version: 1.26.5
- name: Build
run: make build
- name: FMT
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: 1.26.4
go-version: 1.26.5
- name: ut
run: make test
env:
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: 1.26.4
go-version: 1.26.5
- name: fv
run: make create-cluster fv
env:
Expand All @@ -62,7 +62,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: 1.26.4
go-version: 1.26.5
- name: fv
run: make create-cluster fv-sharding
env:
Expand All @@ -75,7 +75,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: 1.26.4
go-version: 1.26.5
- name: fv
run: make create-cluster-pullmode fv-pullmode
env:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/scorecard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Scorecard supply-chain security
on:
branch_protection_rule:
schedule:
- cron: '30 2 * * 1'
push:
branches:
- 'main'

permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
security-events: write
id-token: write
contents: read
actions: read

steps:
- name: checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Run analysis
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: SARIF file
path: results.sarif
retention-days: 5

- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.26.4 AS builder
FROM golang:1.26.5 AS builder

ARG BUILDOS
ARG TARGETARCH
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ARCH ?= amd64
OS ?= $(shell uname -s | tr A-Z a-z)
K8S_LATEST_VER ?= $(shell curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
export CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
TAG ?= v1.12.0
TAG ?= main

.PHONY: all
all: build
Expand Down Expand Up @@ -68,7 +68,7 @@ KUBECTL := $(TOOLS_BIN_DIR)/kubectl
CLUSTERCTL := $(TOOLS_BIN_DIR)/clusterctl

GOLANGCI_LINT_VERSION := "v2.12.2"
CLUSTERCTL_VERSION := v1.13.3
CLUSTERCTL_VERSION := v1.13.4

KUSTOMIZE_VER := v5.8.0
KUSTOMIZE_BIN := kustomize
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![CI](https://github.com/projectsveltos/access-manager/actions/workflows/main.yaml/badge.svg)](https://github.com/projectsveltos/access-manager/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/projectsveltos/access-manager)](https://goreportcard.com/report/github.com/projectsveltos/accesss-manager)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/projectsveltos/access-manager/badge)](https://scorecard.dev/viewer/?uri=github.com/projectsveltos/access-manager)
[![CodeQL](https://github.com/projectsveltos/access-manager/actions/workflows/codeql.yaml/badge.svg)](https://github.com/projectsveltos/access-manager/actions/workflows/codeql.yaml)
[![Slack](https://img.shields.io/badge/join%20slack-%23projectsveltos-brighteen)](https://join.slack.com/t/projectsveltos/shared_invite/zt-1hraownbr-W8NTs6LTimxLPB8Erj8Q6Q)
[![License](https://img.shields.io/badge/license-Apache-blue.svg)](LICENSE)
[![Twitter Follow](https://img.shields.io/twitter/follow/projectsveltos?style=social)](https://twitter.com/projectsveltos)
Expand All @@ -17,14 +18,14 @@ Access manager is a projectsveltos service whose goals are:
RoleRequest are used by platform admin to grant permissions to tenant admins in one or more managed clusters.

AccessRequests are used for sveltos services deployed in the managed clusters that need to access back management cluster.
Any other service can request a kubeconfig by creating an AccessRequest.
Any other service can request a kubeconfig by creating an AccessRequest.
Access manager then:
1. generates kubeconfig;
2. stores in a secret;
3. updates AccessRequest Status with the information on the Secret containing the kubeconfig;
4. continuosly regenerate the token (whose expiration is set to 10 minutes)

## Contributing
## Contributing

❤️ Your contributions are always welcome! If you want to contribute, have questions, noticed any bug or want to get the latest project news, you can connect with us in the following ways:

Expand Down
47 changes: 47 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Security Policy

## Supported Versions

We release security fixes for the latest minor version. We encourage all users to stay on the latest release.

| Version | Supported |
|----------------|--------------------|
| latest release | :white_check_mark: |
| older releases | :x: |

## Reporting a Vulnerability

**Please do not report security vulnerabilities through public GitHub issues.**

If you believe you have found a security vulnerability in any Sveltos repository, please report it responsibly by sending an email to:

**support@projectsveltos.io**

Please include as much of the following information as possible to help us understand and resolve the issue quickly:

- A description of the vulnerability and its potential impact
- The affected component(s) and version(s)
- Step-by-step instructions to reproduce the issue
- Any proof-of-concept or exploit code (if applicable)
- Suggested remediation (if any)

## Response Process

- You will receive an acknowledgement within **2 business days**
- We will investigate and keep you informed of our progress
- Once the issue is confirmed, we will work on a fix and coordinate a release
- We will publicly disclose the vulnerability after a fix is available, giving you credit unless you prefer to remain anonymous

## Scope

This policy covers all projects under the [projectsveltos](https://github.com/projectsveltos) GitHub organization.

## Out of Scope

- Vulnerabilities in dependencies (please report those to the upstream project)
- Issues in non-production branches or unreleased code
- Social engineering attacks

## Thank You

We appreciate responsible disclosure and the work of the security community in keeping Sveltos and its users safe.
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: docker.io/projectsveltos/access-manager:v1.12.0
- image: docker.io/projectsveltos/access-manager:main
name: manager
10 changes: 7 additions & 3 deletions controllers/rolerequest_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (

"github.com/projectsveltos/access-manager/pkg/scope"
libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1"
"github.com/projectsveltos/libsveltos/lib/clustercache"
"github.com/projectsveltos/libsveltos/lib/clusterproxy"
"github.com/projectsveltos/libsveltos/lib/deployer"
"github.com/projectsveltos/libsveltos/lib/k8s_utils"
Expand Down Expand Up @@ -261,6 +262,9 @@ func (r *RoleRequestReconciler) proceedProcessingRoleRequest(ctx context.Context
var errorMessage string
if result.Err != nil {
errorMessage = result.Err.Error()

clustercache.GetManager().InvalidateOnAuthError(cluster.Namespace, cluster.Name,
clusterproxy.GetClusterType(cluster), result.Err)
}
clusterInfo := &libsveltosv1beta1.ClusterInfo{
Cluster: *cluster,
Expand Down Expand Up @@ -723,15 +727,15 @@ func proceedDeployingRoleRequestInCluster(ctx context.Context, c client.Client,
clusterType libsveltosv1beta1.ClusterType, logger logr.Logger,
) error {

remoteClient, err := clusterproxy.GetKubernetesClient(ctx, c, clusterNamespace, clusterName, "", "",
remoteClient, err := clustercache.GetManager().GetKubernetesClient(ctx, c, clusterNamespace, clusterName, "", "",
clusterType, logger)
if err != nil {
logger.V(logs.LogInfo).Info(fmt.Sprintf("failed to get remote client: %v", err))
return err
}

var remoteRestConfig *rest.Config
remoteRestConfig, err = clusterproxy.GetKubernetesRestConfig(ctx, c, clusterNamespace, clusterName, "", "",
remoteRestConfig, err = clustercache.GetManager().GetKubernetesRestConfig(ctx, c, clusterNamespace, clusterName, "", "",
clusterType, logger)
if err != nil {
logger.V(logs.LogInfo).Info(fmt.Sprintf("failed to get remote restConfig: %v", err))
Expand Down Expand Up @@ -1019,7 +1023,7 @@ func undeployRoleRequestFromCluster(ctx context.Context, c client.Client,
return undeployRoleRequestInPullMode(ctx, c, clusterNamespace, clusterName, roleRequest, logger)
}

remoteClient, err := clusterproxy.GetKubernetesClient(ctx, c, clusterNamespace, clusterName, "", "",
remoteClient, err := clustercache.GetManager().GetKubernetesClient(ctx, c, clusterNamespace, clusterName, "", "",
clusterType, logger)
if err != nil {
logger.V(logs.LogInfo).Info(fmt.Sprintf("failed to get remote client: %v", err))
Expand Down
42 changes: 21 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
module github.com/projectsveltos/access-manager

go 1.26.4
go 1.26.5

require (
github.com/TwiN/go-color v1.4.1
github.com/gdexlab/go-render v1.0.1
github.com/go-logr/logr v1.4.3
github.com/go-logr/logr v1.4.4
github.com/onsi/ginkgo/v2 v2.32.0
github.com/onsi/gomega v1.42.1
github.com/pkg/errors v0.9.1
github.com/projectsveltos/libsveltos v1.12.0
github.com/projectsveltos/libsveltos v1.12.1-0.20260723073052-095dee392300
github.com/prometheus/client_golang v1.23.2
github.com/spf13/pflag v1.0.10
golang.org/x/text v0.38.0
k8s.io/api v0.36.2
golang.org/x/text v0.40.0
k8s.io/api v0.36.3
k8s.io/apiextensions-apiserver v0.36.2
k8s.io/apimachinery v0.36.2
k8s.io/client-go v0.36.2
k8s.io/component-base v0.36.2
k8s.io/apimachinery v0.36.3
k8s.io/client-go v0.36.3
k8s.io/component-base v0.36.3
k8s.io/klog/v2 v2.140.0
k8s.io/utils v0.0.0-20260626114624-be93311217bd
sigs.k8s.io/cluster-api v1.13.3
k8s.io/utils v0.0.0-20260707023825-cf1189d6abe3
sigs.k8s.io/cluster-api v1.13.4
sigs.k8s.io/controller-runtime v0.24.1
)

Expand All @@ -38,18 +38,18 @@ require (
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/aws/aws-sdk-go-v2 v1.42.1 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.27 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.26 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.30 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.29 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.31 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.13 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.30 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.2.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.31.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.43.5 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.4.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.32.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.37.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.44.1 // indirect
github.com/aws/smithy-go v1.27.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
Expand All @@ -69,7 +69,7 @@ require (
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gobuffalo/flect v1.0.3 // indirect
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/google/cel-go v0.28.1 // indirect
github.com/google/cel-go v0.29.2 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 // indirect
Expand Down Expand Up @@ -111,14 +111,14 @@ require (
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.53.0 // indirect
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect
golang.org/x/mod v0.36.0 // indirect
golang.org/x/mod v0.37.0 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.21.0 // indirect
golang.org/x/sync v0.22.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/term v0.44.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/tools v0.45.0 // indirect
golang.org/x/tools v0.47.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
Expand All @@ -130,7 +130,7 @@ require (
k8s.io/apiserver v0.36.2 // indirect
k8s.io/cluster-bootstrap v0.36.0 // indirect
k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199 // indirect
k8s.io/streaming v0.36.2 // indirect
k8s.io/streaming v0.36.3 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/kustomize/api v0.21.1 // indirect
Expand Down
Loading