Skip to content

Commit bc556b3

Browse files
Align PMG integration: use PMG_PUBLIC_REPOS_TOKEN/PMG_TENANT_ID + add pmg-test.yml
1 parent 05bee20 commit bc556b3

3 files changed

Lines changed: 60 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
uses: safedep/pmg@v1
2020
with:
2121
server-mode: true
22-
api-key: ${{ secrets.SAFEDEP_API_KEY }}
23-
tenant-id: ${{ secrets.SAFEDEP_TENANT_ID }}
22+
api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }}
23+
tenant-id: ${{ secrets.PMG_TENANT_ID }}
2424
- name: Set up Ruby
2525
uses: ruby/setup-ruby@v1
2626
with:
@@ -51,8 +51,8 @@ jobs:
5151
uses: safedep/pmg@v1
5252
with:
5353
server-mode: true
54-
api-key: ${{ secrets.SAFEDEP_API_KEY }}
55-
tenant-id: ${{ secrets.SAFEDEP_TENANT_ID }}
54+
api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }}
55+
tenant-id: ${{ secrets.PMG_TENANT_ID }}
5656
- name: Set up Ruby latest
5757
uses: ruby/setup-ruby@v1
5858
with:
@@ -80,8 +80,8 @@ jobs:
8080
uses: safedep/pmg@v1
8181
with:
8282
server-mode: true
83-
api-key: ${{ secrets.SAFEDEP_API_KEY }}
84-
tenant-id: ${{ secrets.SAFEDEP_TENANT_ID }}
83+
api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }}
84+
tenant-id: ${{ secrets.PMG_TENANT_ID }}
8585
- run: sudo apt-get install -y oathtool
8686
- name: Download all workflow run artifacts
8787
uses: actions/download-artifact@v3

.github/workflows/pmg-test.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: PMG Proxy Test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
8+
jobs:
9+
test-pmg-allows-clean-install:
10+
name: PMG - Clean package should not be blocked
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup PMG proxy
14+
uses: safedep/pmg@v1
15+
with:
16+
server-mode: true
17+
api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }}
18+
tenant-id: ${{ secrets.PMG_TENANT_ID }}
19+
20+
- uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: "3.2"
23+
24+
- name: Install clean package (should succeed)
25+
run: gem install rake
26+
27+
- name: Enforce PMG policy
28+
if: always()
29+
run: pmg proxy stop --fail-on-violation
30+
31+
test-pmg-blocks-malicious-package:
32+
name: PMG - Malicious package should be blocked
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Setup PMG proxy
36+
uses: safedep/pmg@v1
37+
with:
38+
server-mode: true
39+
api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }}
40+
tenant-id: ${{ secrets.PMG_TENANT_ID }}
41+
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: "20"
45+
46+
- name: Install flagged test package (PMG should block this)
47+
continue-on-error: true
48+
run: npm install --no-cache --prefer-online safedep-test-pkg@0.1.3
49+
50+
- name: Enforce PMG policy (expect failure — violation recorded)
51+
if: always()
52+
run: pmg proxy stop --fail-on-violation

.github/workflows/ruby.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
uses: safedep/pmg@v1
3131
with:
3232
server-mode: true
33-
api-key: ${{ secrets.SAFEDEP_API_KEY }}
34-
tenant-id: ${{ secrets.SAFEDEP_TENANT_ID }}
33+
api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }}
34+
tenant-id: ${{ secrets.PMG_TENANT_ID }}
3535
- name: Set up Ruby
3636
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
3737
# change this to (see https://github.com/ruby/setup-ruby#versioning):

0 commit comments

Comments
 (0)