Skip to content

Commit 462d7b3

Browse files
remove verify mandate tool (#3)
* remove verify mandate tool * add LICENSE file * finish publish action for API MCP server
1 parent e72ab42 commit 462d7b3

File tree

14 files changed

+196
-152
lines changed

14 files changed

+196
-152
lines changed

.github/workflows/ci.yml

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
name: CI
22

33
on:
4-
push:
54
pull_request:
6-
5+
push:
6+
branches:
7+
- master
8+
79
jobs:
810
build:
911
name: Build and Test
1012
runs-on: ubuntu-latest
13+
permissions:
14+
actions: read
15+
contents: read
16+
security-events: write
1117
strategy:
1218
matrix:
1319
node-version: [22.x]
@@ -41,3 +47,84 @@ jobs:
4147
- name: Run tests (mcp-shared)
4248
run: npm run test -- --run
4349
working-directory: packages/mcp-shared
50+
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v3
53+
54+
- name: Build truvera-api image for scanning
55+
uses: docker/build-push-action@v6
56+
with:
57+
context: .
58+
file: ./apps/truvera-api/Dockerfile
59+
load: true
60+
tags: truvera-api-mcp:ci
61+
build-args: |
62+
BUILD_NUMBER=${{ github.run_number }}
63+
64+
- name: Scan truvera-api image for HIGH and CRITICAL vulnerabilities
65+
id: trivy_scan
66+
continue-on-error: true
67+
uses: aquasecurity/trivy-action@v0.35.0
68+
with:
69+
image-ref: truvera-api-mcp:ci
70+
format: table
71+
output: trivy-results.txt
72+
ignore-unfixed: true
73+
severity: HIGH,CRITICAL
74+
exit-code: '1'
75+
76+
- name: Add Trivy report to job summary
77+
if: always()
78+
run: |
79+
{
80+
echo "## Trivy Image Scan"
81+
echo
82+
if [ "${{ steps.trivy_scan.outcome }}" = "failure" ]; then
83+
echo "**Status:** FAILED (HIGH/CRITICAL vulnerabilities found)"
84+
else
85+
echo "**Status:** PASSED (no HIGH/CRITICAL vulnerabilities found)"
86+
fi
87+
echo
88+
echo "<details><summary>Full Trivy output</summary>"
89+
echo
90+
echo '```text'
91+
cat trivy-results.txt
92+
echo '```'
93+
echo "</details>"
94+
} >> "$GITHUB_STEP_SUMMARY"
95+
96+
- name: Generate Trivy SARIF report
97+
if: always()
98+
uses: aquasecurity/trivy-action@v0.35.0
99+
with:
100+
image-ref: truvera-api-mcp:ci
101+
format: sarif
102+
output: trivy-results.sarif
103+
ignore-unfixed: true
104+
severity: HIGH,CRITICAL
105+
exit-code: '0'
106+
107+
- name: Upload Trivy SARIF to GitHub Security
108+
id: trivy_sarif_upload
109+
continue-on-error: true
110+
if: always()
111+
uses: github/codeql-action/upload-sarif@v4
112+
with:
113+
sarif_file: trivy-results.sarif
114+
category: trivy-container-scan
115+
116+
- name: Add SARIF upload status to job summary
117+
if: always()
118+
run: |
119+
if [ "${{ steps.trivy_sarif_upload.outcome }}" = "failure" ]; then
120+
echo >> "$GITHUB_STEP_SUMMARY"
121+
echo "## SARIF Upload" >> "$GITHUB_STEP_SUMMARY"
122+
echo >> "$GITHUB_STEP_SUMMARY"
123+
echo "SARIF upload was skipped or failed. GitHub code scanning may not be enabled for this repository." >> "$GITHUB_STEP_SUMMARY"
124+
fi
125+
126+
- name: Fail job if Trivy found HIGH/CRITICAL issues
127+
if: steps.trivy_scan.outcome == 'failure'
128+
run: |
129+
echo "Trivy detected HIGH/CRITICAL vulnerabilities. See job summary and Security tab for details."
130+
exit 1

.github/workflows/docker-publish.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ name: Build and Push Docker Images
33
on:
44
push:
55
branches:
6-
- main
6+
- master
77
paths:
88
- 'apps/truvera-api/**'
99
- 'packages/mcp-shared/**'
1010
- '.github/workflows/docker-publish.yml'
11+
1112
release:
1213
types: [published]
1314

@@ -23,9 +24,13 @@ jobs:
2324
build-and-push:
2425
name: Build and Push truvera-api-mcp
2526
runs-on: ubuntu-latest
27+
env:
28+
SHOULD_PUSH: ${{ github.event_name != 'workflow_dispatch' || inputs.push }}
29+
DOCKER_IMAGE: docknetwork/truvera-api-mcp
2630
permissions:
2731
contents: read
2832
packages: write
33+
id-token: write
2934

3035
steps:
3136
- name: Checkout repository
@@ -34,15 +39,21 @@ jobs:
3439
- name: Read build number
3540
id: build_number
3641
run: |
37-
BUILD_NUM=$(cat apps/truvera-api/.buildnumber)
42+
if [ -f apps/truvera-api/.buildnumber ]; then
43+
BUILD_NUM=$(cat apps/truvera-api/.buildnumber)
44+
echo "Using apps/truvera-api/.buildnumber"
45+
else
46+
BUILD_NUM="${{ github.run_number }}"
47+
echo "apps/truvera-api/.buildnumber not found; using GitHub run number"
48+
fi
3849
echo "build_number=$BUILD_NUM" >> $GITHUB_OUTPUT
3950
echo "Build number: $BUILD_NUM"
4051
4152
- name: Set up Docker Buildx
4253
uses: docker/setup-buildx-action@v3
4354

4455
- name: Log in to DockerHub
45-
if: github.event_name != 'pull_request'
56+
if: ${{ env.SHOULD_PUSH == 'true' }}
4657
uses: docker/login-action@v3
4758
with:
4859
username: ${{ secrets.DOCKER_HUB_USERNAME }}
@@ -53,27 +64,34 @@ jobs:
5364
uses: docker/metadata-action@v5
5465
with:
5566
images: |
56-
${{ secrets.DOCKER_HUB_USERNAME }}/truvera-api-mcp
67+
${{ env.DOCKER_IMAGE }}
5768
tags: |
5869
type=raw,value=latest,enable={{is_default_branch}}
5970
type=raw,value=${{ steps.build_number.outputs.build_number }}
60-
type=semver,pattern={{version}}
61-
type=semver,pattern={{major}}.{{minor}}
62-
type=sha,prefix={{branch}}-
71+
labels: |
72+
org.opencontainers.image.licenses=LicenseRef-DL-NPL
6373
64-
- name: Build and push Docker image
65-
uses: docker/build-push-action@v5
74+
- name: Build and push API Docker image
75+
id: docker_build
76+
uses: docker/build-push-action@v6
6677
with:
6778
context: .
6879
file: ./apps/truvera-api/Dockerfile
69-
push: ${{ github.event_name != 'pull_request' && (github.event.inputs.push == 'true' || github.event.inputs.push == null) }}
80+
push: ${{ env.SHOULD_PUSH == 'true' }}
7081
tags: ${{ steps.meta.outputs.tags }}
7182
labels: ${{ steps.meta.outputs.labels }}
83+
sbom: ${{ env.SHOULD_PUSH == 'true' }}
84+
provenance: ${{ env.SHOULD_PUSH == 'true' }}
7285
build-args: |
7386
BUILD_NUMBER=${{ steps.build_number.outputs.build_number }}
7487
cache-from: type=gha
7588
cache-to: type=gha,mode=max
7689
platforms: linux/amd64,linux/arm64
7790

7891
- name: Image digest
92+
if: ${{ env.SHOULD_PUSH == 'true' }}
7993
run: echo "Image pushed with digest ${{ steps.docker_build.outputs.digest }}"
94+
95+
- name: Image build only
96+
if: ${{ env.SHOULD_PUSH != 'true' }}
97+
run: echo "Image built without push because workflow_dispatch input 'push' was false"

LICENSE

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
The Dock Labs Non-Production License (the “DL-NPL”)
2+
Copyright (c) 2024 Dock Labs AG.
3+
4+
This software and associated documentation files (the "Software") may only be
5+
used in production, if you (and any entity that you represent) have agreed to,
6+
and are in compliance with, the Dock Labs Subscription Master Services Agreement
7+
(MSA), available at https://www.dock.io/master-services-agreement (the “Dock
8+
Terms”), or other agreement governing the use of the Software, as agreed by you
9+
and Dock Labs, and otherwise have a valid Dock Labs subscription that is being
10+
utilized as intended and for its designated purposes.
11+
12+
Subject to the foregoing sentence, you are free to modify this Software and
13+
publish patches to the Software. You agree that Dock Labs and/or its licensors
14+
(as applicable) retain all right, title and interest in and to all such
15+
modifications and/or patches, and all such modifications and/or patches may only
16+
be used, copied, modified, displayed, distributed, or otherwise exploited with a
17+
valid Dock Labs subscription that is being utilized as intended and for its
18+
designated purposes. Notwithstanding the foregoing, you may copy and modify the
19+
Software without obtaining a subscription only for non-production development
20+
and testing purposes. For the avoidance of doubt, non-production use solely
21+
consists of internal use of this software within a non-production development or
22+
test environment which uses fictitious data in non-durable identity credentials.
23+
You are not granted any other rights beyond what is expressly stated herein.
24+
Subject to the foregoing, it is forbidden to copy, merge, publish, distribute,
25+
sublicense, and/or sell the Software.
26+
27+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
29+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
30+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
31+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33+
34+
For all third party components incorporated into the Dock Labs Software, those
35+
components are licensed under the original license provided by the owner of the
36+
applicable component.
37+
38+
If you have any questions or need further assistance, please contact
39+
support@dock.io.

apps/truvera-api/Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Multi-stage build for Truvera MCP Service
22
ARG BUILD_NUMBER=1
33

4-
FROM node:22-alpine3.21 AS builder
4+
FROM node:22-alpine3.23 AS builder
55

66
ARG BUILD_NUMBER
77

@@ -11,9 +11,6 @@ WORKDIR /app
1111
RUN apk update && apk upgrade --no-cache && \
1212
apk add --no-cache openssl
1313

14-
# Upgrade npm
15-
RUN npm install -g npm@11.6.4 --no-fund --no-audit
16-
1714
# Copy root package files for workspace
1815
COPY package*.json ./
1916

@@ -39,26 +36,31 @@ COPY apps/truvera-api/tsconfig.json ./apps/truvera-api/
3936
RUN BUILD_NUMBER=$BUILD_NUMBER npm run build --workspace=apps/truvera-api
4037

4138
# Runtime stage
42-
FROM node:22-alpine3.21
39+
FROM node:22-alpine3.23
4340

4441
WORKDIR /app
4542

4643
# Upgrade system packages to fix security vulnerabilities
4744
RUN apk update && apk upgrade --no-cache && \
4845
apk add --no-cache openssl
4946

50-
# Upgrade npm in the runtime image too (keeps logs consistent)
51-
RUN npm install -g npm@11.6.4 --no-fund --no-audit
52-
5347
# Copy root package files
5448
COPY package*.json ./
5549

50+
# Include repository license in the published runtime image
51+
COPY LICENSE /licenses/LICENSE
52+
5653
# Copy workspace package.json files
5754
COPY packages/mcp-shared/package*.json ./packages/mcp-shared/
5855
COPY apps/truvera-api/package*.json ./apps/truvera-api/
5956

6057
# Install production dependencies only
61-
RUN npm ci --workspaces --only=production
58+
RUN npm ci --workspaces --omit=dev
59+
60+
# Runtime image does not need package managers; remove them to reduce attack surface
61+
# and avoid scanner findings from npm's bundled transitive dependencies.
62+
RUN rm -rf /usr/local/lib/node_modules/npm \
63+
&& rm -f /usr/local/bin/npm /usr/local/bin/npx
6264

6365
# Copy built shared package from builder
6466
COPY --from=builder /app/packages/mcp-shared/dist ./packages/mcp-shared/dist

apps/truvera-api/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ The server exposes 31 tools across these areas:
162162
- `issue_cart_mandate` — issue a Cart Mandate for human-present transactions
163163
- `issue_intent_mandate` — issue an Intent Mandate for human-not-present transactions
164164
- `issue_payment_mandate` — issue a Payment Mandate for payment network visibility
165-
- `verify_mandate` — verify any AP2 mandate credential
166165

167166
See [src/features/ap2/README.md](src/features/ap2/README.md) for full AP2 documentation.
168167

apps/truvera-api/src/build-info.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Auto-generated build information
22
export const BUILD_INFO = {
3-
timestamp: '2026-03-25T20:03:44.614Z',
4-
buildNumber: 38,
5-
version: '1.0.0-build.38',
3+
timestamp: '2026-04-02T20:53:22.032Z',
4+
buildNumber: 40,
5+
version: '1.0.0-build.40',
66
};

apps/truvera-api/src/features/ap2/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,6 @@ Note: This tool currently emits the repository's bundled Payment Mandate profile
150150
- `refund_period_days`: Refund eligibility period
151151
- `user_authorization`: Optional user authorization signature/token. If omitted, the server currently inserts a placeholder string so the credential matches the published Payment Mandate schema.
152152

153-
### `verify_mandate`
154-
Verify an AP2 mandate credential.
155-
156-
**Required Parameters:**
157-
- `credential_id`: ID of the mandate credential to verify
158-
159153
## Architecture
160154

161155
### Features
@@ -185,7 +179,6 @@ ap2/
185179
2. **Tool Registration**: AP2 tools are registered with dynamic descriptions including schema URLs
186180
3. **Issuance**: When a tool is called, AP2Client constructs the mandate structure and issues it as a VC via Truvera API
187181
4. **Storage**: The issued VC (mandate) can be stored in wallet-server like any other credential
188-
5. **Verification**: Mandates can be verified using the `verify_mandate` tool
189182

190183
## Testing
191184

apps/truvera-api/src/features/ap2/client.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -450,16 +450,4 @@ export class AP2Client {
450450
return this.routeIssuance(credentialData, request.subject_did);
451451
}
452452

453-
/**
454-
* Verify a mandate credential
455-
* @param credential - The full W3C Verifiable Credential document (not just the ID)
456-
*/
457-
async verifyMandate(credential: unknown) {
458-
// Verify the credential directly
459-
return this.truveraClient.request({
460-
method: "POST",
461-
endpoint: "/verify",
462-
body: credential,
463-
});
464-
}
465453
}

apps/truvera-api/src/features/ap2/schemas.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,6 @@ export const components = {
225225
],
226226
},
227227

228-
/**
229-
* Verify Mandate Request
230-
*/
231-
VerifyMandateRequest: {
232-
type: "object",
233-
description: "Verify an AP2 mandate credential using the Truvera API",
234-
properties: {
235-
credential_id: {
236-
type: "string",
237-
description: "ID of the mandate credential to verify",
238-
},
239-
},
240-
required: ["credential_id"],
241-
},
242228
},
243229
};
244230

0 commit comments

Comments
 (0)