Skip to content

Commit 1572690

Browse files
authored
Add proof of concept publisher content CVE dashboard (#174)
1 parent e8047b0 commit 1572690

Some content is hidden

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

41 files changed

+3650
-1
lines changed

.github/workflows/extensions.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ jobs:
185185
# e.g. `extension-name: ${{ steps.changes.outputs.extension-name }}`
186186
# Be sure the extension name and directory name it is in are the same
187187
publisher-command-center: ${{ steps.changes.outputs.publisher-command-center }}
188+
publisher-cves: ${{ steps.changes.outputs.publisher-cves }}
188189

189190
steps:
190191
- uses: actions/checkout@v4
@@ -198,6 +199,7 @@ jobs:
198199
# e.g. `extension-name: extensions/extension-name/**`
199200
filters: |
200201
publisher-command-center: extensions/publisher-command-center/**
202+
publisher-cves: extensions/publisher-cves/**
201203
202204
# Creates and releases the Publisher Command Center extension using a custom
203205
# workflow
@@ -209,6 +211,15 @@ jobs:
209211
uses: ./.github/workflows/publisher-command-center.yml
210212
secrets: inherit
211213

214+
# Creates and releases the Publisher CVEs extension using a custom workflow
215+
publisher-cves:
216+
needs: [complex-extension-changes]
217+
# Only runs if the `complex-extension-changes` job detects changes in the
218+
# publisher-cves extension directory
219+
if: ${{ needs.complex-extension-changes.outputs.publisher-cves == 'true' }}
220+
uses: ./.github/workflows/publisher-cves.yml
221+
secrets: inherit
222+
212223
# All extensions have been linted, packaged, and released, if necessary
213224
# Continuing to update the extension list with the latest release data
214225

@@ -219,7 +230,7 @@ jobs:
219230
runs-on: ubuntu-latest
220231
# Requires that the `simple-extensions` and all custom workflow jobs are
221232
# completed before running this job
222-
needs: [simple-extension-release, publisher-command-center]
233+
needs: [simple-extension-release, publisher-command-center, publisher-cves]
223234
if: ${{ always() }}
224235
outputs:
225236
releases: ${{ steps.fetch-releases.outputs.releases }}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publisher CVEs Extension
2+
3+
on:
4+
workflow_call:
5+
6+
# Setup the environment with the extension name for easy re-use
7+
# Also need the GH_TOKEN for the release-extension action to be able to use gh
8+
env:
9+
EXTENSION_NAME: publisher-cves
10+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
12+
jobs:
13+
extension:
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: ./extensions/${{ env.EXTENSION_NAME }}
18+
19+
steps:
20+
# Checkout the repository so the rest of the actions can run with no issue
21+
- uses: actions/checkout@v4
22+
23+
# We want to fail quickly if the linting fails, do that first
24+
- uses: ./.github/actions/lint-extension
25+
with:
26+
extension-name: ${{ env.EXTENSION_NAME }}
27+
28+
# Publisher Command Center needs to setup node, install dependencies, and
29+
# build to make the files needed for the extension
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: "lts/*"
33+
cache: "npm"
34+
cache-dependency-path: extensions/${{ env.EXTENSION_NAME }}/package-lock.json
35+
36+
- run: npm ci
37+
- run: npm run build
38+
39+
# Now that the extension is built we need to upload an artifact to pass
40+
# to the package-extension action that contains the files we want to be
41+
# included in the extension
42+
# This only includes necessary files for the extension to run leaving out
43+
# the files that were used to build the /dist/ directory
44+
- name: Upload built extension
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: ${{ env.EXTENSION_NAME }}
48+
path: |
49+
extensions/${{ env.EXTENSION_NAME }}/dist/
50+
extensions/${{ env.EXTENSION_NAME }}/requirements.txt
51+
extensions/${{ env.EXTENSION_NAME }}/main.py
52+
extensions/${{ env.EXTENSION_NAME }}/manifest.json
53+
54+
# Package up the extension into a TAR using the generalized
55+
# package-extension action
56+
- uses: ./.github/actions/package-extension
57+
with:
58+
extension-name: ${{ env.EXTENSION_NAME }}
59+
artifact-name: ${{ env.EXTENSION_NAME }}
60+
61+
connect-integration-tests:
62+
needs: extension
63+
uses: ./.github/workflows/connect-integration-tests.yml
64+
secrets: inherit
65+
with:
66+
extensions: '["publisher-cves"]' # JSON array format to match the workflow input schema
67+
68+
release:
69+
runs-on: ubuntu-latest
70+
needs: [extension, connect-integration-tests]
71+
# Release the extension using the release-extension action
72+
# Will only create a GitHub release if merged to `main` and the semver
73+
# version has been updated
74+
steps:
75+
# Checkout the repository so the rest of the actions can run with no issue
76+
- uses: actions/checkout@v4
77+
78+
- uses: ./.github/actions/release-extension
79+
with:
80+
extension-name: ${{ env.EXTENSION_NAME }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
# Posit Publisher files
27+
.posit/*
28+
29+
# Claude
30+
.claude/settings.local.json
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore artifacts:
2+
dist
3+
build
4+
coverage
5+
6+
# Ignore virtual environments:
7+
.venv
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar"]
3+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Contributing to Publisher CVEs
2+
3+
## Prerequisites
4+
5+
- Python 3.11 or higher
6+
- [Node.js](https://nodejs.org/en) 20 or higher
7+
- [uv](https://docs.astral.sh/uv/)
8+
9+
It is recommended to use [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm)
10+
to manage Node.js versions.
11+
12+
## Setup
13+
14+
1. Run `uv sync` to install dependencies for the FastAPI server.
15+
2. Run `npm install` to install frontend dependencies.
16+
17+
## Development
18+
19+
1. Run `uv run fastapi dev main.py` to start the FastAPI server.
20+
2. Run the frontend development server with `npm run dev`.
21+
22+
## Deploy
23+
24+
Run `npm run build` to generate the frontend JS and CSS files in the `dist`
25+
directory.
26+
27+
From there the required files to be sent in the bundle are:
28+
29+
- `main.py',
30+
- 'requirements.txt'
31+
- `dist/**`
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Publisher CVEs
2+
3+
Shows the vulnerabilities affecting the content you have published to Posit
4+
Connect.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + Vue + TS</title>
8+
</head>
9+
<body class="min-h-svh antialiased">
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)