-
Notifications
You must be signed in to change notification settings - Fork 104
Gotobeta #262
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
Gotobeta #262
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ec0560a
add ttl on the sam console
aojea 24408b6
fix mobile console
aojea 025b8d8
add security actions
aojea d011856
safe helm defaults
aojea e70a549
better unauth mcp error
aojea 663b1e8
fix vuln jobs
aojea 052ad44
fix helm jobs
aojea 7bed0b8
update readme
aojea d51501a
fix zizmor errors
aojea 5f3f807
Merge branch 'main' into gotobeta
aojea ca78dd2
address comments
aojea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Govulncheck | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - 'main' | ||
| tags: | ||
| - 'v*' | ||
| pull_request: | ||
| branches: [ main ] | ||
| schedule: | ||
| - cron: '0 6 * * 1' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| GO_VERSION: "1.26" | ||
|
|
||
| jobs: | ||
| govulncheck: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - id: govulncheck | ||
| continue-on-error: true | ||
| uses: golang/govulncheck-action@032d45514ae346b1db93c04b0c90b841c370344f # v1.1.0 | ||
| with: | ||
| go-version-input: ${{ env.GO_VERSION }} | ||
| go-package: ./... | ||
| output-file: govulncheck.txt | ||
| - name: Fail only on vulnerabilities we haven't explicitly accepted | ||
| env: | ||
| GOVULNCHECK_OUTCOME: ${{ steps.govulncheck.outcome }} | ||
| run: | | ||
| set -euo pipefail | ||
| cat govulncheck.txt | ||
|
|
||
| # GO-2024-3218 (CVE-2023-26248): content-censorship risk inherent to | ||
| # Kademlia DHT routing in github.com/libp2p/go-libp2p-kad-dht. | ||
| # Upstream advisory lists "no known fixed" version, since it's a | ||
| # structural property of Kademlia DHTs, not a patchable bug. SAM's | ||
| # mesh transport depends fundamentally on this module. | ||
| # See https://pkg.go.dev/vuln/GO-2024-3218. Re-evaluate if this ever | ||
| # gets a fixed version upstream. | ||
| accepted=("GO-2024-3218") | ||
|
|
||
| found=$(grep -oE '^Vulnerability #[0-9]+: GO-[0-9]{4}-[0-9]+' govulncheck.txt | awk '{print $3}' | sort -u || true) | ||
|
|
||
| unaccepted="" | ||
| for id in $found; do | ||
| skip=false | ||
| for a in "${accepted[@]}"; do | ||
| [ "$a" = "$id" ] && skip=true && break | ||
| done | ||
| if [ "$skip" = false ]; then | ||
| unaccepted="$unaccepted $id" | ||
| fi | ||
| done | ||
|
|
||
| if [ -n "$unaccepted" ]; then | ||
| echo "::error::New/unaccepted vulnerabilities found:$unaccepted" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$GOVULNCHECK_OUTCOME" = "failure" ] && [ -z "$found" ]; then | ||
| echo "::error::govulncheck failed for a reason other than a detected vulnerability; see output above." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "OK - vulnerabilities found (all accepted): ${found:-none}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # sam-mesh Helm chart | ||
|
|
||
| Deploys a self-contained SAM mesh (control plane, router, console, and | ||
| optionally an in-cluster Postgres + Dex) for local development, testing, or | ||
| self-hosting your own hub. | ||
|
|
||
| > For large-scale production deployments (GKE/EKS/AKS) using externally | ||
| > managed Postgres/DNS/OIDC, see the | ||
| > [Production Kubernetes Deployment guide](https://sam-mesh.dev/docs/user/kubernetes-deployment/), | ||
| > which uses plain manifests instead of this chart. | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| helm upgrade --install sam-mesh ./charts/sam-mesh --namespace sam --create-namespace | ||
| ``` | ||
|
|
||
| At the end of `helm install`/`helm upgrade`, the chart prints the exact | ||
| `kubectl` command to retrieve your generated secrets (see below) — read the | ||
| NOTES output before doing anything else. | ||
|
|
||
| ## Secrets: `controlPlane.adminToken` and `database.postgres.password` | ||
|
|
||
| Both default to `""` in [values.yaml](values.yaml). When left blank, the chart | ||
| **auto-generates** a random 32-character secret on first install and stores it | ||
| in the `<release>-secrets` Kubernetes Secret; the same value is reused on | ||
| `helm upgrade` (it is not rotated on every upgrade). Retrieve the admin token | ||
| with: | ||
|
|
||
| ```bash | ||
| kubectl get secret --namespace <namespace> <release>-secrets -o jsonpath='{.data.admin-token}' | base64 -d; echo | ||
| ``` | ||
|
|
||
| You can also pin either value explicitly instead of letting the chart | ||
| generate one, e.g. for reproducible dev environments or to match an | ||
| existing secret: | ||
|
|
||
| ```bash | ||
| helm upgrade --install sam-mesh ./charts/sam-mesh \ | ||
| --set controlPlane.adminToken="$(openssl rand -hex 32)" \ | ||
| --set database.postgres.password="$(openssl rand -hex 32)" | ||
| ``` | ||
|
|
||
| ## `controlPlane.insecureSkipTlsVerify` | ||
|
|
||
| Defaults to `false`. Only set this to `true` when `controlPlane.oidcIssuer` | ||
| points at an OIDC issuer served with a self-signed or otherwise untrusted | ||
| certificate — for example the Kubernetes API server's own issuer | ||
| (`https://kubernetes.default.svc.cluster.local`) used for ServiceAccount | ||
| Workload Identity Federation in local `kind` clusters, or a local Dex/mock | ||
| OIDC instance without a real cert. Leave it `false` for any real-world OIDC | ||
| provider (Google, Okta, Dex behind a real TLS certificate, etc.). | ||
|
|
||
| ## `controlPlane.autoApproveEnrollment` | ||
|
|
||
| Defaults to `true` (any node/router presenting a valid identity token is | ||
| enrolled immediately, no manual step). Set to `false` if you want an | ||
| administrator to approve each enrollment via `/admin/enrollments` before a | ||
| node can join — see the | ||
| [Control Plane Configuration guide](https://sam-mesh.dev/docs/user/control-plane-configuration/#6-headless-node-enrollment-bootstrap-token-flow). | ||
|
|
||
| ## Dex (`dex.enabled`) | ||
|
|
||
| Disabled by default. The bundled Dex is only meant for local/dev OIDC login | ||
| (username/password test users); real deployments should point | ||
| `controlPlane.oidcIssuer` at your own identity provider instead of enabling | ||
| this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| SAM Mesh has been deployed as release "{{ .Release.Name }}" in namespace "{{ .Release.Namespace }}". | ||
|
|
||
| {{- if not .Values.controlPlane.adminToken }} | ||
|
|
||
| A random admin token was generated for you (nothing is set in values.yaml). | ||
| Retrieve it before you try to call any /admin/* endpoint or log into the | ||
| console as root admin: | ||
|
|
||
| kubectl get secret --namespace {{ .Release.Namespace }} {{ include "sam-mesh.fullname" . }}-secrets -o jsonpath='{.data.admin-token}' | base64 -d; echo | ||
| {{- else }} | ||
|
|
||
| Using the admin token you provided via values (controlPlane.adminToken). | ||
| {{- end }} | ||
|
|
||
| {{- if not .Values.database.postgres.password }} | ||
|
|
||
| A random database password was also generated and stored in the same secret | ||
| (key "db-password"); you shouldn't need it directly unless connecting to | ||
| Postgres yourself. | ||
| {{- end }} | ||
|
|
||
| Control plane service: {{ include "sam-mesh.fullname" . }}-control-plane:{{ .Values.controlPlane.service.port }} | ||
| {{- if .Values.console.enabled }} | ||
| Console service: {{ include "sam-mesh.fullname" . }}-console:{{ .Values.console.service.port }} | ||
| {{- end }} | ||
|
|
||
| {{- if .Values.controlPlane.autoApproveEnrollment }} | ||
|
|
||
| Note: controlPlane.autoApproveEnrollment=true - any node/router presenting a | ||
| valid identity is enrolled automatically without manual admin approval. Set | ||
| it to false for production deployments where you want to review enrollments. | ||
| {{- end }} | ||
|
|
||
| See charts/sam-mesh/README.md for more details on configuring OIDC, TLS, and | ||
| production values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,28 @@ | ||
| {{- $secretName := printf "%s-secrets" (include "sam-mesh.fullname" .) }} | ||
| {{- $existing := lookup "v1" "Secret" .Release.Namespace $secretName }} | ||
| {{- $adminToken := .Values.controlPlane.adminToken }} | ||
| {{- if not $adminToken }} | ||
| {{- if and $existing (hasKey $existing "data") (hasKey $existing.data "admin-token") }} | ||
| {{- $adminToken = index $existing.data "admin-token" | b64dec }} | ||
| {{- else }} | ||
| {{- $adminToken = randAlphaNum 32 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- $dbPassword := .Values.database.postgres.password }} | ||
| {{- if not $dbPassword }} | ||
| {{- if and $existing (hasKey $existing "data") (hasKey $existing.data "db-password") }} | ||
| {{- $dbPassword = index $existing.data "db-password" | b64dec }} | ||
| {{- else }} | ||
| {{- $dbPassword = randAlphaNum 32 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ include "sam-mesh.fullname" . }}-secrets | ||
| name: {{ $secretName }} | ||
| labels: | ||
| {{- include "sam-mesh.labels" . | nindent 4 }} | ||
| type: Opaque | ||
| data: | ||
| admin-token: {{ .Values.controlPlane.adminToken | b64enc | quote }} | ||
| db-password: {{ .Values.database.postgres.password | b64enc | quote }} | ||
| admin-token: {{ $adminToken | b64enc | quote }} | ||
| db-password: {{ $dbPassword | b64enc | quote }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.