Skip to content

Commit bfdd00a

Browse files
authored
Merge pull request #224 from aojea/policies
feat(security): transition from static policies.yaml to dynamic relat…
2 parents 66544e8 + b335b50 commit bfdd00a

85 files changed

Lines changed: 3957 additions & 2141 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/k8s/sam-control-plane-template.yaml‎

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ spec:
123123
- "--db-dsn=postgres://sam:sam-secret-password@sam-db-${ENV_NAME}:5432/sam_mesh?sslmode=disable"
124124
- "--issuer=https://auth.sam-mesh.dev,https://container.googleapis.com/v1/projects/${GCP_PROJECT_ID}/locations/${CLUSTER_REGION}/clusters/${CLUSTER_NAME}"
125125
- "--allowed-audiences=sam-mesh-audience,sam-hub-audience"
126-
- "--policy-file=/etc/sam/policies/policies.yaml"
127126
- "--admin-token=$(ADMIN_TOKEN)"
128127
- "--auto-approve-enrollment"
129128
resources:
@@ -133,53 +132,6 @@ spec:
133132
limits:
134133
cpu: 500m
135134
memory: 512Mi
136-
volumeMounts:
137-
- name: policies-volume
138-
mountPath: /etc/sam/policies
139-
readOnly: true
140-
volumes:
141-
- name: policies-volume
142-
configMap:
143-
name: sam-control-plane-policies-${ENV_NAME}
144-
---
145-
apiVersion: v1
146-
kind: ConfigMap
147-
metadata:
148-
name: sam-control-plane-policies-${ENV_NAME}
149-
namespace: ${NAMESPACE}
150-
data:
151-
policies.yaml: |
152-
version: "v1alpha1"
153-
bindings:
154-
- members: ["user:system:serviceaccount:sam-canary-${ENV_NAME}:sam-node-sa"]
155-
role: "sam-canary"
156-
- members: ["user:system:serviceaccount:sam-canary-${ENV_NAME}:sam-box-sa"]
157-
role: "sam:role:sambox"
158-
- members: ["group:routers", "user:system:serviceaccount:${NAMESPACE}:sam-router-sa"]
159-
role: "sam:role:router"
160-
- members: ["sam:system:authenticated"]
161-
role: "public-mesh"
162-
roles:
163-
sam-canary:
164-
allowed_services:
165-
- "*"
166-
allowed_targets:
167-
- "*"
168-
"sam:role:sambox":
169-
allowed_services:
170-
- "*"
171-
allowed_targets:
172-
- "*"
173-
"sam:role:router":
174-
allowed_services:
175-
- "*"
176-
allowed_targets:
177-
- "*"
178-
public-mesh:
179-
allowed_services:
180-
- "*"
181-
allowed_targets:
182-
- "*"
183135
---
184136
apiVersion: networking.gke.io/v1
185137
kind: HealthCheckPolicy

‎.github/workflows/deploy-github-pages.yml‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ on:
1717

1818
permissions:
1919
contents: read
20-
pages: write
21-
id-token: write
2220

2321
env:
2422
REPO_NAME: ${{ github.event.repository.name }}
@@ -28,18 +26,19 @@ jobs:
2826
build:
2927
runs-on: ubuntu-latest
3028
steps:
31-
- uses: actions/checkout@v7
29+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
3230
with:
3331
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
3432
submodules: recursive # Fetch any git submodules if configured
33+
persist-credentials: false
3534

3635
- name: Setup Hugo
37-
uses: peaceiris/actions-hugo@v3
36+
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
3837
with:
3938
hugo-version: '0.136.5' # Matching local Hugo version
4039
extended: true
4140

42-
- uses: actions/setup-node@v7
41+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
4342
with:
4443
node-version: '20'
4544
check-latest: true
@@ -58,13 +57,17 @@ jobs:
5857
run: echo "sam-mesh.dev" > ./site/public/CNAME
5958

6059
- name: Upload artifact
61-
uses: actions/upload-pages-artifact@v5
60+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
6261
with:
6362
path: ./site/public
6463

6564
deploy:
6665
needs: build
6766
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
67+
permissions:
68+
contents: read
69+
pages: write
70+
id-token: write
6871
environment:
6972
name: github-pages
7073
url: ${{ steps.deployment.outputs.page_url }}
@@ -74,4 +77,4 @@ jobs:
7477
steps:
7578
- name: Deploy to GitHub Pages
7679
id: deployment
77-
uses: actions/deploy-pages@v5
80+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

0 commit comments

Comments
 (0)