This is an automated email from the ASF dual-hosted git repository.
jerryshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new d47a47f733 [#13751] improvement(build): Add a scheduled Trivy scan for
release artifacts (#14778)
d47a47f733 is described below
commit d47a47f73354e3c845755a5f35a9f372688d27ea
Author: geyanggang <[email protected]>
AuthorDate: Fri Nov 13 18:11:13 2026 +0800
[#13751] improvement(build): Add a scheduled Trivy scan for release
artifacts (#14778)
### What changes were proposed in this pull request?
Add a `CVE Scan` workflow that runs weekly and on manual dispatch. It
builds the artifacts Gravitino ships and scans each one with Trivy
0.76.1:
- the server distribution and the Iceberg REST and Lance REST server
packages
- 19 shaded jars: the cloud and Iceberg bundles, the client and GVFS
runtimes, the maintenance jobs, and the Flink and Spark runtimes
- the 6 Trino connector ranges
- the lock files of the MCP server, the two web UIs and the Python
client
Trivy runs from a digest-pinned image in a hardened container without
network access. The Trivy DBs are downloaded once per run and shared
with the scan jobs through a cache. No third-party action is used.
A target fails when a HIGH or CRITICAL finding remains after the
exemptions, when no valid report is produced, or when an exemption has
expired or does not follow the policy. The JSON and SARIF reports are
uploaded as workflow artifacts and, on the main branch of
apache/gravitino, to code scanning.
Pre-existing findings are exempted in `.github/trivy/trivyignore.yaml`,
each scoped to a versioned purl with a tracking issue (#14777, #14712)
and a 90-day expiry. `.github/trivy/vex.openvex.json` is reserved for
findings proven not to be exploitable. `.github/trivy/README.md`
describes the policy and how to run the same scan locally.
### Why are the changes needed?
Gravitino ships a large transitive dependency tree inside its packages
and fat jars, and nothing checks it today, so problems are only found
when someone reports them (for example #14435). This follows the Trivy
scan used by Apache Iceberg, with two changes for Gravitino: it runs on
a schedule rather than on every PR, because PR CI now runs in Fork CI,
and it starts from an exemption baseline so it can be enabled before
every pre-existing finding is fixed.
Fix: #13751
### Does this PR introduce _any_ user-facing change?
No. This only adds a CI workflow and its configuration.
### How was this patch tested?
- Built all 32 targets locally on main and ran the same
`.github/trivy/scan.sh` the workflow uses: 0 remaining findings with the
baseline exemptions.
- Negative checks: a removed or expired exemption, a missing jar, an
invalid report and a failed SARIF conversion each fail the run.
- actionlint, shellcheck, the ASF allowlist check, `node --test
.github/scripts/tests/*.test.cjs` and RAT pass.
- Ran the workflow end to end on GitHub-hosted runners in a fork
([run](https://github.com/geyanggang/gravitino/actions/runs/42582393756)):
every job passed, a run takes about 10 minutes with the scan jobs in
parallel, and the Trivy DB cache entry is about 1 GB. The code scanning
upload only runs on apache/gravitino and was skipped there.
---
.github/scripts/cve-scan-notify.cjs | 86 +++
.github/scripts/tests/cve-scan-exemptions.test.cjs | 199 +++++
.github/scripts/tests/cve-scan-notify.test.cjs | 158 ++++
.../scripts/tests/cve-scan-stage-python.test.cjs | 255 +++++++
.github/trivy/README.md | 153 ++++
.github/trivy/scan.sh | 602 +++++++++++++++
.github/trivy/trivyignore.yaml | 845 +++++++++++++++++++++
.github/trivy/vex.openvex.json | 8 +
.github/workflows/cve-scan.yml | 401 ++++++++++
CONTRIBUTING.md | 1 +
10 files changed, 2708 insertions(+)
diff --git a/.github/scripts/cve-scan-notify.cjs
b/.github/scripts/cve-scan-notify.cjs
new file mode 100644
index 0000000000..d69436bf71
--- /dev/null
+++ b/.github/scripts/cve-scan-notify.cjs
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+// Keeps one tracking issue for the scheduled release artifact scan
(.github/workflows/cve-scan.yml):
+// a failed run opens or updates it, and the first passing scheduled run
closes it again.
+// The title is the only key, so it must stay stable. Only issues opened by
the bot count.
+const ISSUE_TITLE = 'Scheduled release artifact scan failed';
+const ISSUE_AUTHOR = 'github-actions[bot]';
+const README_PATH = '.github/trivy/README.md';
+const FAILED_RESULTS = ['failure', 'cancelled'];
+// Returns the names of the jobs that did not pass. A run in which no job
succeeded verified nothing,
+// so it counts as failed with every job listed.
+function failedJobs(needs) {
+ const entries = Object.entries(needs || {});
+ const failed = entries.filter(([, job]) => FAILED_RESULTS.includes(job &&
job.result)).map(([name]) => name);
+ if (failed.length === 0 && !entries.some(([, job]) => job && job.result ===
'success')) {
+ return entries.map(([name]) => name);
+ }
+ return failed.sort();
+}
+function parseNeeds(raw) {
+ const needs = JSON.parse(raw);
+ if (!needs || typeof needs !== 'object' || Array.isArray(needs)) throw new
Error('NEEDS is not a JSON object');
+ return needs;
+}
+async function findOpenIssue({ github, owner, repo }) {
+ // Only issues created by the bot are fetched, so a busy repository does not
page through every open issue.
+ const issues = await github.paginate(github.rest.issues.listForRepo,
+ { owner, repo, state: 'open', creator: ISSUE_AUTHOR, per_page: 100 });
+ return issues.find((issue) => !issue.pull_request && issue.title ===
ISSUE_TITLE &&
+ issue.user && issue.user.login === ISSUE_AUTHOR);
+}
+function runUrl(context) {
+ const server = context.serverUrl || 'https://github.com';
+ return
`${server}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
+}
+function failureComment(context, failed, today) {
+ return `The scheduled run failed on ${today} (UTC).\n\nRun:
${runUrl(context)}\n\n` +
+ `Failed jobs: ${failed.map((name) => `\`${name}\``).join(', ')}`;
+}
+function issueBody(context, failed, today) {
+ const readme = `${context.serverUrl ||
'https://github.com'}/${context.repo.owner}/${context.repo.repo}/blob/main/${README_PATH}`;
+ return `${failureComment(context, failed, today)}\n\n` +
+ 'The scheduled run builds the artifacts Gravitino ships and scans them for
known HIGH and CRITICAL ' +
+ 'problems in their dependencies. Open the run, check the job summaries,
then either fix the ' +
+ 'finding by upgrading the dependency or re-triage the exemptions that
expired.\n\n' +
+ `See the [scan documentation](${readme}) for how to reproduce the scan and
for the exemption rules.\n\n` +
+ 'This issue is updated by every failed scheduled run and closed by the
first one that passes.';
+}
+async function notify({ github, context, core, needs }) {
+ const { owner, repo } = context.repo;
+ const today = new Date().toISOString().slice(0, 10);
+ try {
+ const jobs = needs || parseNeeds(process.env.NEEDS);
+ const failed = failedJobs(jobs);
+ const open = await findOpenIssue({ github, owner, repo });
+ if (failed.length > 0) {
+ if (open) {
+ await github.rest.issues.createComment({ owner, repo, issue_number:
open.number,
+ body: failureComment(context, failed, today) });
+ } else {
+ await github.rest.issues.create({ owner, repo, title: ISSUE_TITLE,
body: issueBody(context, failed, today) });
+ }
+ } else if (open) {
+ await github.rest.issues.createComment({ owner, repo, issue_number:
open.number,
+ body: `The scheduled run passed on ${today} (UTC).\n\nRun:
${runUrl(context)}` });
+ await github.rest.issues.update({ owner, repo, issue_number:
open.number, state: 'closed',
+ state_reason: 'completed' });
+ }
+ } catch (error) {
+ core.setFailed(`Could not update the tracking issue "${ISSUE_TITLE}":
${error.message}`);
+ }
+}
+module.exports = { ISSUE_AUTHOR, ISSUE_TITLE, failedJobs, notify };
diff --git a/.github/scripts/tests/cve-scan-exemptions.test.cjs
b/.github/scripts/tests/cve-scan-exemptions.test.cjs
new file mode 100644
index 0000000000..2cc587cf1c
--- /dev/null
+++ b/.github/scripts/tests/cve-scan-exemptions.test.cjs
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+// Offline tests of 'scan.sh check-exemptions' and 'scan.sh unused'. Each test
runs the script
+// against a fixture policy directory (TRIVY_POLICY_DIR) and, for 'unused', a
fixture report directory.
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const os = require('node:os');
+const path = require('node:path');
+const { spawnSync } = require('node:child_process');
+const scan = path.join(__dirname, '..', '..', 'trivy', 'scan.sh');
+// yq and jq are needed by the commands under test. Locally a missing tool
skips the tests, on
+// GitHub Actions it fails them, so that CI never skips silently.
+const missing = ['yq', 'jq'].filter((tool) => spawnSync(tool,
['--version']).status !== 0);
+if (missing.length > 0 && process.env.GITHUB_ACTIONS === 'true') {
+ test('required tools are installed', () => assert.fail(`missing tools:
${missing.join(', ')}`));
+}
+const skip = missing.length > 0 ? `missing tools: ${missing.join(', ')}` :
false;
+const DAY = 86400000;
+// A UTC date (YYYY-MM-DD) the given number of days from today.
+const date = (days) => new Date(Math.floor(Date.now() / DAY) * DAY + days *
DAY).toISOString().slice(0, 10);
+const PURL = 'pkg:maven/com.example/[email protected]';
+const STATEMENT = 'Pre-existing finding, tracked in apache/gravitino#14777.';
+// Renders one entry of trivyignore.yaml. Fields set to undefined are left out.
+function entry(over = {}) {
+ const fields = { id: 'CVE-2026-0001', purls: [PURL], expired_at: date(30),
statement: STATEMENT, ...over };
+ const lines = [];
+ for (const [key, value] of Object.entries(fields)) {
+ if (value === undefined) continue;
+ if (key === 'purls') {
+ lines.push(' purls:', ...value.map((purl) => ` - ${purl}`));
+ } else {
+ lines.push(` ${key}: ${value}`);
+ }
+ }
+ lines[0] = ` - ${lines[0].trim()}`;
+ return lines.join('\n');
+}
+const ignoreFile = (...entries) => `vulnerabilities:\n${entries.join('\n')}\n`;
+const VEX_ENTRY = {
+ vulnerability: { name: 'CVE-2026-0002' },
+ products: [{ '@id': 'pkg:maven/com.example/[email protected]' }],
+ status: 'not_affected',
+ justification: 'vulnerable_code_not_in_execute_path',
+ impact_statement: 'The class is never loaded, see Foo.java.',
+};
+const vexFile = (...statements) => JSON.stringify({
+ '@context': 'https://openvex.dev/ns/v0.2.0', '@id':
'https://example.org/vex', author: 'Test',
+ timestamp: '2026-01-01T00:00:00Z', version: 1, statements,
+});
+// Creates a policy directory; ignore and vex are the file contents.
+function policy(ignore, vex = vexFile()) {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'exemptions-'));
+ fs.writeFileSync(path.join(dir, 'trivyignore.yaml'), ignore);
+ fs.writeFileSync(path.join(dir, 'vex.openvex.json'), vex);
+ return dir;
+}
+function run(args, dir) {
+ const result = spawnSync('bash', [scan, ...args], { encoding: 'utf8', env: {
...process.env, TRIVY_POLICY_DIR: dir,
+ GITHUB_STEP_SUMMARY: '' } });
+ fs.rmSync(dir, { recursive: true, force: true });
+ return { status: result.status, output: `${result.stdout}\n${result.stderr}`
};
+}
+const check = (ignore, vex) => run(['check-exemptions'], policy(ignore, vex));
+function assertFails(result, pattern) {
+ assert.equal(result.status, 1, result.output);
+ assert.match(result.output, pattern);
+}
+test('a valid policy passes', { skip }, () => {
+ const result = check(ignoreFile(entry()), vexFile(VEX_ENTRY));
+ assert.equal(result.status, 0, result.output);
+ assert.match(result.output, /All exemptions follow the policy/);
+});
+test('an entry without id, purls, expired_at or statement fails', { skip }, ()
=> {
+ assertFails(check(ignoreFile(entry({ id: undefined }))), /missing id/);
+ assertFails(check(ignoreFile(entry({ purls: undefined }))), /purls must be a
non-empty list/);
+ assertFails(check(ignoreFile(entry({ expired_at: undefined }))), /missing
expired_at/);
+ assertFails(check(ignoreFile(entry({ statement: undefined }))), /missing
statement/);
+});
+test('a purl without a version fails', { skip }, () => {
+ assertFails(check(ignoreFile(entry({ purls: ['pkg:maven/com.example/lib']
}))), /exact version/);
+});
+test('a malformed or impossible date fails', { skip }, () => {
+ assertFails(check(ignoreFile(entry({ expired_at: '2027/01/31' }))),
/malformed expired_at/);
+ assertFails(check(ignoreFile(entry({ expired_at: 'soon' }))), /malformed
expired_at/);
+});
+test('a quoted date fails because Trivy ignores it', { skip }, () => {
+ assertFails(check(ignoreFile(entry({ expired_at: `"${date(30)}"` }))), /must
be an unquoted date/);
+});
+test('a date that is today or in the past fails', { skip }, () => {
+ assertFails(check(ignoreFile(entry({ expired_at: date(0) }))), /is not in
the future/);
+ assertFails(check(ignoreFile(entry({ expired_at: date(-5) }))), /is not in
the future/);
+});
+test('the expiry limit is 90 days ahead', { skip }, () => {
+ assertFails(check(ignoreFile(entry({ expired_at: date(91) }))), /more than
90 days ahead/);
+ const result = check(ignoreFile(entry({ expired_at: date(89) })));
+ assert.equal(result.status, 0, result.output);
+});
+test('a statement needs a tracking issue', { skip }, () => {
+ assertFails(check(ignoreFile(entry({ statement: 'Not analysed yet.' }))),
/apache\/gravitino#<number>/);
+ assertFails(check(ignoreFile(entry({ statement: 'Tracked in
apache/gravitino#TRACKING_ISSUE.' }))),
+ /TRACKING_ISSUE placeholder/);
+});
+test('an empty ignore file fails', { skip }, () => {
+ assertFails(check('vulnerabilities: []\n'), /has no entries/);
+});
+test('an empty VEX file passes', { skip }, () => {
+ const result = check(ignoreFile(entry()), vexFile());
+ assert.equal(result.status, 0, result.output);
+});
+test('an invalid VEX file fails', { skip }, () => {
+ assertFails(check(ignoreFile(entry()), '{ not json'), /not valid JSON/);
+});
+test('a not_affected statement needs a justification and an impact statement',
{ skip }, () => {
+ const without = (key, value) => vexFile({ ...VEX_ENTRY, [key]: value });
+ assertFails(check(ignoreFile(entry()), without('justification', undefined)),
/needs a justification/);
+ assertFails(check(ignoreFile(entry()), without('justification', 'because')),
/needs a justification/);
+ assertFails(check(ignoreFile(entry()), without('impact_statement',
undefined)), /needs an impact_statement/);
+ assertFails(check(ignoreFile(entry()), without('impact_statement', ' ')),
/needs an impact_statement/);
+});
+test('every OpenVEX justification is accepted', { skip }, () => {
+ for (const justification of ['component_not_present',
'vulnerable_code_not_present',
+ 'vulnerable_code_not_in_execute_path',
'vulnerable_code_cannot_be_controlled_by_adversary',
+ 'inline_mitigations_already_exist']) {
+ const result = check(ignoreFile(entry()), vexFile({ ...VEX_ENTRY,
justification }));
+ assert.equal(result.status, 0, `${justification}: ${result.output}`);
+ }
+});
+test('statuses other than not_affected are rejected', { skip }, () => {
+ const statement = (status) => vexFile({ vulnerability:
VEX_ENTRY.vulnerability, products: VEX_ENTRY.products, status,
+ action_statement: 'Upgrade.' });
+ assertFails(check(ignoreFile(entry()), statement('fixed')), /status fixed is
not allowed/);
+ assertFails(check(ignoreFile(entry()), statement('affected')), /status
affected is not allowed/);
+ assertFails(check(ignoreFile(entry()), statement('under_investigation')),
/status under_investigation is not allowed/);
+ assertFails(check(ignoreFile(entry()), statement('unknown')), /unknown
status/);
+});
+// A Trivy report with one suppressed finding per [id, purl] pair.
+function reportDir(...findings) {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'reports-'));
+ const modified = findings.map(([id, purl]) => ({ Status: 'ignored',
+ Finding: { VulnerabilityID: id, PkgIdentifier: { PURL: purl } } }));
+ fs.writeFileSync(path.join(dir, 'target.json'), JSON.stringify({ Results: [{
ExperimentalModifiedFindings: modified }] }));
+ return dir;
+}
+function unused(reports, ...entries) {
+ const result = run(['unused', reports], policy(ignoreFile(...entries)));
+ fs.rmSync(reports, { recursive: true, force: true });
+ return result;
+}
+test('unused: an exemption that matched a finding is not reported', { skip },
() => {
+ const result = unused(reportDir(['CVE-2026-0001', PURL]), entry());
+ assert.equal(result.status, 0, result.output);
+ assert.doesNotMatch(result.output, /::warning/);
+ assert.match(result.output, /Every exemption .* matched a finding/);
+});
+test('unused: an exemption that matched nothing only warns', { skip }, () => {
+ const result = unused(reportDir(['CVE-2026-0001', PURL]), entry(),
+ entry({ id: 'CVE-2026-0003', purls: ['pkg:maven/com.example/[email protected]']
}));
+ assert.equal(result.status, 0, result.output);
+ assert.match(result.output, /::warning title=Unused exemption::CVE-2026-0003
pkg:maven\/com.example\/[email protected]/);
+ assert.doesNotMatch(result.output, /Unused exemption::CVE-2026-0001/);
+});
+test('unused: the same id with another version counts as unused', { skip }, ()
=> {
+ const result = unused(reportDir(['CVE-2026-0001',
'pkg:maven/com.example/[email protected]']), entry());
+ assert.equal(result.status, 0, result.output);
+ assert.match(result.output, /::warning title=Unused
exemption::CVE-2026-0001/);
+});
+// The time limit of one scan comes from the environment and must be a plain
duration.
+function withTimeout(value) {
+ const result = spawnSync('bash', [scan, 'check-exemptions'], { encoding:
'utf8',
+ env: { ...process.env, TRIVY_POLICY_DIR: policy(ignoreFile(entry())),
TRIVY_SCAN_TIMEOUT: value, GITHUB_STEP_SUMMARY: '' } });
+ return { status: result.status, output: `${result.stdout}\n${result.stderr}`
};
+}
+test('TRIVY_SCAN_TIMEOUT: a malformed value is rejected', () => {
+ for (const value of ['abc', '10', '0m', '-5m', '10m; echo x', '1.5h']) {
+ const result = withTimeout(value);
+ assert.equal(result.status, 2, `${value}: ${result.output}`);
+ assert.match(result.output, /TRIVY_SCAN_TIMEOUT must be a duration/);
+ }
+});
+test('TRIVY_SCAN_TIMEOUT: a duration is accepted', { skip }, () => {
+ for (const value of ['90s', '3m', '10m', '2h']) {
+ const result = withTimeout(value);
+ assert.equal(result.status, 0, `${value}: ${result.output}`);
+ }
+});
diff --git a/.github/scripts/tests/cve-scan-notify.test.cjs
b/.github/scripts/tests/cve-scan-notify.test.cjs
new file mode 100644
index 0000000000..5afad0a2a7
--- /dev/null
+++ b/.github/scripts/tests/cve-scan-notify.test.cjs
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const { ISSUE_AUTHOR, ISSUE_TITLE, failedJobs, notify } =
require('../cve-scan-notify.cjs');
+
+const context = { repo: { owner: 'apache', repo: 'gravitino' }, runId: 4242,
serverUrl: 'https://github.com' };
+const PASSING = { 'trivy-db': { result: 'success' }, server: { result:
'success' }, jars: { result: 'success' } };
+const FAILING = { ...PASSING, jars: { result: 'failure' }, trino: { result:
'failure' } };
+
+// A mocked github object: 'pages' are returned by paginate, other calls are
recorded in 'calls'.
+function mock({ issues = [], fail = null } = {}) {
+ const calls = [];
+ const record = (name) => async (args) => {
+ if (fail === name) throw new Error(`boom in ${name}`);
+ calls.push({ name, args });
+ return { data: { number: 99 } };
+ };
+ const github = {
+ paginate: async (fn, args) => {
+ if (fail === 'paginate') throw new Error('boom in paginate');
+ calls.push({ name: 'paginate', args });
+ return issues;
+ },
+ rest: { issues: { listForRepo: () => {}, create: record('create'),
createComment: record('createComment'),
+ update: record('update') } },
+ };
+ const failures = [];
+ const core = { setFailed: (message) => failures.push(message) };
+ return { github, core, calls, failures };
+}
+const issue = (over = {}) => ({ number: 7, title: ISSUE_TITLE, user: { login:
ISSUE_AUTHOR }, ...over });
+const names = (calls) => calls.map((call) => call.name);
+const forbidden = /cve|vulnerab|security|@/i;
+
+test('failedJobs lists failed and cancelled jobs, sorted, and ignores skipped
ones', () => {
+ assert.deepEqual(failedJobs(FAILING), ['jars', 'trino']);
+ assert.deepEqual(failedJobs({ a: { result: 'cancelled' }, b: { result:
'skipped' }, c: { result: 'success' } }), ['a']);
+ assert.deepEqual(failedJobs(PASSING), []);
+});
+
+test('failedJobs treats a run without any successful job as failed', () => {
+ assert.deepEqual(failedJobs({ a: { result: 'skipped' }, b: { result:
'skipped' } }), ['a', 'b']);
+ assert.deepEqual(failedJobs({}), []);
+});
+
+test('creates the issue when a job failed and none is open', async () => {
+ const { github, core, calls, failures } = mock();
+ await notify({ github, context, core, needs: FAILING });
+ assert.deepEqual(names(calls), ['paginate', 'create']);
+ const { title, body, owner, repo } = calls[1].args;
+ assert.equal(title, ISSUE_TITLE);
+ assert.deepEqual([owner, repo], ['apache', 'gravitino']);
+ assert.match(body, /actions\/runs\/4242/);
+ assert.match(body, /`jars`, `trino`/);
+ assert.match(body, /\.github\/trivy\/README\.md/);
+ assert.match(body, /\d{4}-\d{2}-\d{2}/);
+ assert.doesNotMatch(`${title}\n${body}`, forbidden);
+ assert.deepEqual(failures, []);
+});
+
+test('comments on the open issue instead of creating another one', async () =>
{
+ const { github, core, calls } = mock({ issues: [issue()] });
+ await notify({ github, context, core, needs: FAILING });
+ assert.deepEqual(names(calls), ['paginate', 'createComment']);
+ assert.equal(calls[1].args.issue_number, 7);
+ assert.match(calls[1].args.body, /actions\/runs\/4242/);
+ assert.match(calls[1].args.body, /`jars`, `trino`/);
+ assert.doesNotMatch(calls[1].args.body, forbidden);
+});
+
+test('only open issues of the bot with the exact title count', async () => {
+ const others = [
+ issue({ number: 1, title: `${ISSUE_TITLE} again` }),
+ issue({ number: 2, user: { login: 'someone' } }),
+ issue({ number: 3, pull_request: {} }),
+ issue({ number: 4, user: null }),
+ ];
+ const { github, core, calls } = mock({ issues: others });
+ await notify({ github, context, core, needs: FAILING });
+ assert.deepEqual(names(calls), ['paginate', 'create']);
+});
+
+test('paginates the open issues created by the bot only', async () => {
+ const { github, core, calls } = mock();
+ await notify({ github, context, core, needs: FAILING });
+ assert.equal(calls[0].args.state, 'open');
+ assert.equal(calls[0].args.creator, ISSUE_AUTHOR);
+ assert.equal(calls[0].args.per_page, 100);
+});
+
+test('closes the open issue with a comment when the run passes', async () => {
+ const { github, core, calls, failures } = mock({ issues: [issue()] });
+ await notify({ github, context, core, needs: PASSING });
+ assert.deepEqual(names(calls), ['paginate', 'createComment', 'update']);
+ assert.match(calls[1].args.body, /passed/);
+ assert.match(calls[1].args.body, /actions\/runs\/4242/);
+ assert.doesNotMatch(calls[1].args.body, forbidden);
+ assert.equal(calls[2].args.issue_number, 7);
+ assert.equal(calls[2].args.state, 'closed');
+ assert.equal(calls[2].args.state_reason, 'completed');
+ assert.deepEqual(failures, []);
+});
+
+test('does nothing when the run passes and no issue is open', async () => {
+ const { github, core, calls, failures } = mock();
+ await notify({ github, context, core, needs: PASSING });
+ assert.deepEqual(names(calls), ['paginate']);
+ assert.deepEqual(failures, []);
+});
+
+test('reads the needs from the NEEDS environment variable', async () => {
+ const { github, core, calls } = mock();
+ process.env.NEEDS = JSON.stringify(FAILING);
+ try {
+ await notify({ github, context, core });
+ } finally {
+ delete process.env.NEEDS;
+ }
+ assert.deepEqual(names(calls), ['paginate', 'create']);
+});
+
+test('fails the job when NEEDS is not valid', async () => {
+ for (const raw of ['not json', '[]', 'null']) {
+ const { github, core, calls, failures } = mock();
+ process.env.NEEDS = raw;
+ try {
+ await notify({ github, context, core });
+ } finally {
+ delete process.env.NEEDS;
+ }
+ assert.equal(failures.length, 1, raw);
+ assert.deepEqual(calls, []);
+ }
+});
+
+test('fails the job with a clear message when the API fails', async () => {
+ for (const [fail, needs, issues] of [['paginate', FAILING, []], ['create',
FAILING, []],
+ ['createComment', FAILING, [issue()]], ['createComment', PASSING,
[issue()]], ['update', PASSING, [issue()]]]) {
+ const { github, core, failures } = mock({ fail, issues });
+ await notify({ github, context, core, needs });
+ assert.equal(failures.length, 1, `${fail}`);
+ assert.match(failures[0], new RegExp(`Could not update the tracking
issue.*boom in ${fail}`));
+ }
+});
diff --git a/.github/scripts/tests/cve-scan-stage-python.test.cjs
b/.github/scripts/tests/cve-scan-stage-python.test.cjs
new file mode 100644
index 0000000000..9805477e3c
--- /dev/null
+++ b/.github/scripts/tests/cve-scan-stage-python.test.cjs
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+// Offline tests of 'scan.sh pip-report-to-requirements' and 'scan.sh
stage-python'. The staging tests
+// use a fake Python interpreter that writes canned pip reports, so nothing is
downloaded.
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const os = require('node:os');
+const path = require('node:path');
+const { spawnSync } = require('node:child_process');
+
+const scan = path.join(__dirname, '..', '..', 'trivy', 'scan.sh');
+
+// jq is needed by the commands under test. Locally a missing tool skips the
tests, on GitHub Actions
+// it fails them, so that CI never skips silently.
+const missing = ['jq'].filter((tool) => spawnSync(tool, ['--version']).status
!== 0);
+if (missing.length > 0 && process.env.GITHUB_ACTIONS === 'true') {
+ test('required tools are installed', () => assert.fail(`missing tools:
${missing.join(', ')}`));
+}
+const skip = missing.length > 0 ? `missing tools: ${missing.join(', ')}` :
false;
+
+const item = (name, version, extra = {}) => ({ metadata: { name, version },
...extra });
+const ROOT = item('Apache_Gravitino', '1.0.0', { is_direct: true });
+ROOT.metadata.provides_extra = ['dev', 's3', 'gcs', 'Storage'];
+const report = (...install) => ({ version: '1', install });
+
+function tmpdir() {
+ return fs.mkdtempSync(path.join(os.tmpdir(), 'stage-python-'));
+}
+
+// Runs 'pip-report-to-requirements' on the given report (an object, or a
string written as is).
+function convert(content, rootName = 'apache-gravitino') {
+ const root = tmpdir();
+ const file = path.join(root, 'report.json');
+ fs.writeFileSync(file, typeof content === 'string' ? content :
JSON.stringify(content));
+ const dest = path.join(root, 'out', 'client-python');
+ const result = spawnSync('bash', [scan, 'pip-report-to-requirements', file,
dest, rootName], { encoding: 'utf8' });
+ const out = path.join(dest, 'requirements.txt');
+ return { result, dest, lines: fs.existsSync(out) ? fs.readFileSync(out,
'utf8').trimEnd().split('\n') : null, root };
+}
+
+test('converts a report to sorted name==version lines without the root
package', { skip }, () => {
+ const { result, lines, root } = convert(report(item('requests', '2.34.2'),
ROOT, item('Cachetools', '7.3.0'),
+ item('fsspec', '2026.9.0')));
+ assert.equal(result.status, 0, result.stderr);
+ assert.deepEqual(lines, ['Cachetools==7.3.0', 'fsspec==2026.9.0',
'requests==2.34.2']);
+ fs.rmSync(root, { recursive: true });
+});
+
+test('excludes the root whatever its case or separators are', { skip }, () => {
+ for (const [reportName, rootName] of [['Apache_Gravitino',
'apache-gravitino'], ['apache.gravitino', 'APACHE_GRAVITINO'],
+ ['apache-gravitino', 'Apache.Gravitino'], ['Apache__Gravitino',
'apache-gravitino']]) {
+ const { result, lines, root } = convert(report(item(reportName, '1.0.0', {
is_direct: true }), item('requests', '2.0.0')),
+ rootName);
+ assert.equal(result.status, 0, `${reportName} / ${rootName}:
${result.stderr}`);
+ assert.deepEqual(lines, ['requests==2.0.0']);
+ fs.rmSync(root, { recursive: true });
+ }
+});
+
+test('removes duplicates', { skip }, () => {
+ const { result, lines, root } = convert(report(item('six', '1.17.0'),
item('six', '1.17.0'), item('attrs', '26.1.0')));
+ assert.equal(result.status, 0, result.stderr);
+ assert.deepEqual(lines, ['attrs==26.1.0', 'six==1.17.0']);
+ fs.rmSync(root, { recursive: true });
+});
+
+test('fails when only the root package is installed', { skip }, () => {
+ const { result, dest, root } = convert(report(ROOT));
+ assert.equal(result.status, 1);
+ assert.match(result.stderr, /no dependency/);
+ assert.equal(fs.existsSync(dest), false);
+ fs.rmSync(root, { recursive: true });
+});
+
+test('fails when an item has no version or no name', { skip }, () => {
+ for (const bad of [{ metadata: { name: 'requests' } }, item('requests', ''),
{ metadata: { version: '1.0' } }, {}]) {
+ const { result, dest, root } = convert(report(item('six', '1.17.0'), bad));
+ assert.equal(result.status, 1, JSON.stringify(bad));
+ assert.match(result.stderr, /no name or version/);
+ assert.equal(fs.existsSync(dest), false);
+ fs.rmSync(root, { recursive: true });
+ }
+});
+
+test('fails on invalid JSON, a report without install list and an empty root
name', { skip }, () => {
+ for (const content of ['not json', '', '{}', '{"install": {}}']) {
+ const { result, dest, root } = convert(content);
+ assert.equal(result.status, 1, content);
+ assert.match(result.stderr, /Invalid pip report/);
+ assert.equal(fs.existsSync(dest), false);
+ fs.rmSync(root, { recursive: true });
+ }
+ const { result, root } = convert(report(item('six', '1.17.0')), '');
+ assert.equal(result.status, 1);
+ assert.match(result.stderr, /name of the root package is empty/);
+ fs.rmSync(root, { recursive: true });
+});
+
+// A fake interpreter: 'python -m venv DIR' creates DIR/bin/python (a link to
the fake itself),
+// 'python -m pip --version' prints FAKE_PIP_VERSION, and 'python -m pip
install ... --report FILE SPEC'
+// copies FAKE_BASE or, when SPEC has extras, FAKE_FULL to FILE.
FAKE_FAIL_PASS=base|full makes that pass fail.
+const FAKE_PYTHON = `#!/usr/bin/env bash
+echo "$* | PIP_DISABLE_PIP_VERSION_CHECK=\${PIP_DISABLE_PIP_VERSION_CHECK:-}
PIP_NO_INPUT=\${PIP_NO_INPUT:-}" >> "$FAKE_LOG"
+if [[ "$1 $2" == "-m venv" ]]; then
+ [[ -z "\${FAKE_VENV_FAIL:-}" ]] || exit 1
+ mkdir -p "$3/bin" && ln -s "$0" "$3/bin/python"
+ exit 0
+fi
+if [[ "$1 $2 $3" == "-m pip --version" ]]; then
+ echo "pip \${FAKE_PIP_VERSION:-24.0} from /fake/pip (python 3.12)"
+ exit 0
+fi
+if [[ "$1 $2 $3" == "-m pip install" ]]; then
+ shift 3
+ while [[ $# -gt 1 ]]; do
+ [[ "$1" == "--report" ]] && report="$2"
+ shift
+ done
+ spec="$1"
+ if [[ "$spec" == *"["* ]]; then
+ [[ "\${FAKE_FAIL_PASS:-}" != full ]] || exit 1
+ cp "$FAKE_FULL" "$report"
+ else
+ [[ "\${FAKE_FAIL_PASS:-}" != base ]] || exit 1
+ cp "$FAKE_BASE" "$report"
+ fi
+ exit 0
+fi
+exit 1
+`;
+
+const FULL = report(ROOT, item('requests', '2.34.2'), item('fsspec',
'2026.9.0'), item('fsspec', '2026.9.0'));
+
+// Runs 'stage-python' with the fake interpreter found through PATH (so PYTHON
is just a name).
+function stage(env = {}, base = report(ROOT), full = FULL) {
+ const root = tmpdir();
+ const bin = path.join(root, 'bin');
+ fs.mkdirSync(bin);
+ fs.writeFileSync(path.join(bin, 'fakepython'), FAKE_PYTHON, { mode: 0o755 });
+ const src = path.join(root, 'src');
+ fs.mkdirSync(src);
+ fs.writeFileSync(path.join(src, 'setup.py'), '');
+ fs.writeFileSync(path.join(root, 'base.json'), JSON.stringify(base));
+ fs.writeFileSync(path.join(root, 'full.json'), JSON.stringify(full));
+ const log = path.join(root, 'fake.log');
+ const dest = path.join(root, 'out', 'client-python');
+ const result = spawnSync('bash', [scan, 'stage-python', src, dest], {
+ encoding: 'utf8',
+ env: { ...process.env, PATH: `${bin}:${process.env.PATH}`, PYTHON:
'fakepython', FAKE_LOG: log,
+ FAKE_BASE: path.join(root, 'base.json'), FAKE_FULL: path.join(root,
'full.json'), ...env },
+ });
+ const out = path.join(dest, 'requirements.txt');
+ return { result, dest, root, src,
+ lines: fs.existsSync(out) ? fs.readFileSync(out,
'utf8').trimEnd().split('\n') : null,
+ log: fs.existsSync(log) ? fs.readFileSync(log,
'utf8').trimEnd().split('\n') : [] };
+}
+const installs = (log) => log.filter((line) => line.startsWith('-m pip
install'));
+
+test('resolves twice, with every extra except dev, and writes the
dependencies', { skip }, () => {
+ const { result, lines, log, root, src } = stage();
+ assert.equal(result.status, 0, result.stderr);
+ assert.deepEqual(lines, ['fsspec==2026.9.0', 'requests==2.34.2']);
+ const runs = installs(log);
+ assert.equal(runs.length, 2, log.join('\n'));
+ for (const run of runs) {
+ assert.match(run, /--dry-run/);
+ assert.match(run, /--ignore-installed/);
+ assert.match(run, /PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_NO_INPUT=1$/);
+ }
+ assert.match(runs[0], /--report \S+base\.json \S+\/src \|/);
+ // The extras come from provides_extra, in sorted order, and dev is left out.
+ assert.match(runs[1], /--report \S+full\.json \S+\/src\[Storage,gcs,s3\]/);
+ assert.doesNotMatch(runs[1], /dev/);
+ assert.match(log[0], /^-m venv /);
+ // The source directory is not touched: pip works on a copy.
+ assert.deepEqual(fs.readdirSync(src), ['setup.py']);
+ fs.rmSync(root, { recursive: true });
+});
+
+test('resolves once more without extras when the package has none besides
dev', { skip }, () => {
+ const onlyDev = item('Apache_Gravitino', '1.0.0', { is_direct: true });
+ onlyDev.metadata.provides_extra = ['dev'];
+ const { result, lines, log, root } = stage({}, report(onlyDev,
item('requests', '2.34.2')));
+ assert.equal(result.status, 0, result.stderr);
+ assert.deepEqual(lines, ['requests==2.34.2']);
+ assert.doesNotMatch(installs(log)[1], /\[/);
+ fs.rmSync(root, { recursive: true });
+});
+
+test('fails and leaves nothing behind when pip fails', { skip }, () => {
+ for (const pass of ['base', 'full']) {
+ const { result, dest, root } = stage({ FAKE_FAIL_PASS: pass });
+ assert.equal(result.status, 1, pass);
+ assert.match(result.stderr, /pip could not resolve/);
+ assert.equal(fs.existsSync(dest), false);
+ fs.rmSync(root, { recursive: true });
+ }
+});
+
+test('fails when the root package is not in the first report', { skip }, () =>
{
+ const { result, dest, root } = stage({}, report(item('requests', '2.0.0')));
+ assert.equal(result.status, 1);
+ assert.match(result.stderr, /Could not find the root package/);
+ assert.equal(fs.existsSync(dest), false);
+ fs.rmSync(root, { recursive: true });
+});
+
+test('fails when the resolution has no dependencies', { skip }, () => {
+ const { result, dest, root } = stage({}, report(ROOT), report(ROOT));
+ assert.equal(result.status, 1);
+ assert.match(result.stderr, /no dependency/);
+ assert.equal(fs.existsSync(dest), false);
+ fs.rmSync(root, { recursive: true });
+});
+
+test('fails with a clear message when the interpreter is missing, too old or
cannot create a virtualenv', { skip }, () => {
+ let run = stage({ PYTHON: 'no-such-python-interpreter' });
+ assert.equal(run.result.status, 1);
+ assert.match(run.result.stderr, /Python interpreter
'no-such-python-interpreter' not found/);
+ fs.rmSync(run.root, { recursive: true });
+
+ run = stage({ FAKE_PIP_VERSION: '22.1.2' });
+ assert.equal(run.result.status, 1);
+ assert.match(run.result.stderr, /pip >= 22\.2/);
+ assert.equal(installs(run.log).length, 0);
+ assert.equal(fs.existsSync(run.dest), false);
+ fs.rmSync(run.root, { recursive: true });
+
+ run = stage({ FAKE_VENV_FAIL: '1' });
+ assert.equal(run.result.status, 1);
+ assert.match(run.result.stderr, /Could not create a virtualenv/);
+ fs.rmSync(run.root, { recursive: true });
+});
+
+test('accepts pip 22.2 and later', { skip }, () => {
+ for (const version of ['22.2', '22.3.1', '23.0', '25.1.1']) {
+ const { result, root } = stage({ FAKE_PIP_VERSION: version });
+ assert.equal(result.status, 0, `${version}: ${result.stderr}`);
+ fs.rmSync(root, { recursive: true });
+ }
+});
diff --git a/.github/trivy/README.md b/.github/trivy/README.md
new file mode 100644
index 0000000000..6f1941f684
--- /dev/null
+++ b/.github/trivy/README.md
@@ -0,0 +1,153 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+# Vulnerability scan of shipped artifacts
+
+The [CVE Scan](../workflows/cve-scan.yml) workflow builds the artifacts
Gravitino ships and scans each
+one with [Trivy](https://trivy.dev) for known HIGH and CRITICAL
vulnerabilities. It runs every Monday
+and can be started by hand from the Actions tab. It does not run on pull
requests.
+
+## What is scanned
+
+Each artifact is a separate target, so a finding is attributed to the artifact
users download.
+
+| Job | Built with | Targets |
+| --- | --- | --- |
+| Server packages | `compileDistribution`, `compileIcebergRESTServer`,
`compileLanceRESTServer` | `server-distribution`, `iceberg-rest-server`,
`lance-rest-server` |
+| Shaded jars | `shadowJar` of each module | the nine `*-bundle` jars,
`client-java-runtime`, `filesystem-hadoop3-runtime`, `jobs`,
`flink-runtime-{1.19,1.20,2.1,2.2}`, `spark-runtime-3.5_2.12`,
`spark-runtime-3.5_2.13`, `spark-runtime-4.0` |
+| Trino connectors | `copyRuntimeLibs` of each version range |
`trino-connector-{469-472,473-477,478-479,480,481,482-483}` |
+| Lock files | none | `mcp-server` (`mcp-server/uv.lock`), `web`
(`web/web/pnpm-lock.yaml`), `web-v2` (`web-v2/web/pnpm-lock.yaml`),
`client-python` (see below) |
+
+Notes:
+
+* The standalone Iceberg and Lance REST server directories contain the same
third-party jars as
+ their copies in `distribution/package`. They are scanned anyway because they
are released on their own.
+* `distribution/package-all` is not scanned: only
`gravitino-<version>-bin.tar.gz` is released.
+* The web UI is not built (`-PskipWeb=true`). Its WAR holds a minified static
export and
+ `WEB-INF/web.xml`, with no `package.json`, lock file or `node_modules`, so
Trivy cannot inspect it.
+ The dependencies compiled into the WARs are scanned through the two
`pnpm-lock.yaml` files instead.
+ Trivy 0.76.1 leaves out the development dependencies of pnpm lock files
unless `--include-dev-deps` is
+ set (`web`: 36 findings without the flag, 86 with it), so only what is
shipped is gated.
+* The Python client is scanned as pip installs it. `scan.sh stage-python
clients/client-python <dir>/client-python`
+ resolves the package with every extra except `dev` (read from the package,
so new extras are covered)
+ in a throwaway virtualenv and writes the result, including transitive
dependencies, as `name==version`
+ lines. This works whether the requirements files pin versions or allow
ranges. The resolution is done
+ for the project's `pythonVersion` (`gradle.properties`) on the Linux runner,
and it can change when a
+ dependency publishes a new release inside an allowed range; a new finding is
then real for new
+ installs. `requirements-ray-iceberg.txt` is not an extra and is not part of
the package. The step
+ fails when pip cannot resolve the package or no dependency is left, so an
empty file cannot pass as a
+ clean scan.
+* The Docker images published by `dev/release` are not scanned yet. That is a
follow-up.
+* The Trino 473 and later modules need JDK 25, which Gradle provisions through
its toolchain resolver.
+
+## How the scan runs
+
+* Trivy runs from a container image pinned by digest (see `scan.sh`),
read-only, without capabilities
+ and, for the scan itself, without network access.
+* One job downloads the vulnerability DB and the Java DB once per run and
caches them under a date key.
+ Scan jobs restore the cache read-only and skip all DB updates, so every
report of a run uses the same DB snapshot.
+* A target fails when a HIGH or CRITICAL finding remains after the exemptions,
or when Trivy did not
+ produce a valid report. All targets are scanned even if one of them fails.
+* One scan of a target is limited by `TRIVY_SCAN_TIMEOUT` (45m by default; a
target that hits the limit
+ fails). A scan takes seconds in practice, so the workflow sets a lower limit
per job (15m for the
+ server packages, 10m for Trino, 3m for jars and lock files). The limits of
all targets of a job
+ add up to less than its `Scan` step limit, so a hanging scan fails that
step, and the reports of
+ the other targets are still uploaded, instead of hitting the limit of the
whole job.
+* Each daily cache entry holds about 1 GB. It counts against the repository's
10 GB Actions cache, which
+ is shared with the Gradle caches of every workflow (least recently used
entries are evicted first), and
+ a manual run on another branch stores its own entry. Start manual runs from
the default branch and
+ avoid repeating them.
+
+## When a scheduled run fails
+
+GitHub notifies only the user who last changed the `cron` line, so the
workflow keeps a tracking issue
+titled `Scheduled release artifact scan failed`. A failed scheduled run opens
it, or adds a comment with
+the run and the failed jobs when it is already open. The first scheduled run
that passes again adds a
+comment and closes it. Manual runs do not touch the issue. Committers triage
the issue: fix the finding,
+or update the exemptions following the rules below.
+
+## Reading the results
+
+* Each target has a section in the run summary: the DB snapshot, the remaining
findings, and a
+ collapsed table of the suppressed findings with the reason for each.
+* The raw JSON, the SARIF and the Markdown report of every target are kept for
30 days as workflow
+ artifacts (`cve-scan-*`).
+* On `apache/gravitino` the SARIF reports are also sent to GitHub code
scanning, when it is enabled.
+* The `Exemptions` job fails when an entry in `trivyignore.yaml` or
`vex.openvex.json` breaks the policy
+ below (`scan.sh check-exemptions`). It also warns about entries that matched
no finding in any target of
+ the run (`scan.sh unused`). Remove those.
+
+## Running the scan locally
+
+You need Docker and `jq`. `yq` (v4) is only needed for `scan.sh unused` and
`scan.sh check-exemptions`,
+and `python3` with pip 22.2 or later plus network access for `scan.sh
stage-python`. These tools are
+preinstalled on the GitHub `ubuntu` runners.
+
+```bash
+# Build what you want to scan, for example the server packages and the AWS
bundle.
+./gradlew compileDistribution :bundles:aws-bundle:shadowJar -PskipWeb=true -x
test
+
+# Download the vulnerability DBs into ~/.cache/trivy (about 1.1 GB to
download, 3.1 GB on disk).
+.github/trivy/scan.sh download-db
+
+# Scan a directory. Reports are written to ./trivy-reports.
+.github/trivy/scan.sh scan server-distribution distribution/package
+
+# A fat jar is scanned from a directory that holds only that jar.
+.github/trivy/scan.sh stage /tmp/targets aws-bundle
'bundles/aws-bundle/build/libs/gravitino-aws-bundle-*.jar'
+.github/trivy/scan.sh scan aws-bundle /tmp/targets/aws-bundle
+```
+
+Set `TRIVY_EXEMPTIONS=off` to see all findings without the exemptions,
`TRIVY_CACHE_DIR` and
+`TRIVY_REPORT_DIR` to change the directories. Run `.github/trivy/scan.sh`
without arguments for the list of commands.
+
+## Exemptions
+
+Fix the vulnerability first: upgrade the dependency, or exclude it if it is
not needed. Add an
+exemption only when that is not possible yet. Exemptions are changed through a
pull request.
+
+Exemptions are global: they are applied to every target of the run and keyed
by the versioned package
+URL, so one entry covers every artifact that carries that exact version. Check
all the places a
+package version appears before pointing an entry at an issue that only fixes
some of them.
+
+There are two kinds:
+
+| | A: not affected (`vex.openvex.json`) | B: not analysed yet
(`trivyignore.yaml`) |
+| --- | --- | --- |
+| Meaning | Gravitino does not execute the vulnerable code | Pre-existing
finding that has not been triaged |
+| Evidence | Required: a `not_affected` statement with one of the OpenVEX
justifications (usually `vulnerable_code_not_in_execute_path`) and an
`impact_statement` that cites the code or analysis, valid for the artifact
where it is reported | None, but a tracking issue is required |
+| Scope | The affected package URL | One entry per vulnerability id,
restricted to the exact package versions found |
+| Expiry | None, reviewed like code | `expired_at`, at most 90 days ahead |
+
+Rules for entries in `trivyignore.yaml`:
+
+* Use the statement `Pre-existing finding, tracked in
apache/gravitino#<issue>.` Point it at an issue that
+ covers every artifact carrying the listed versions.
+* List the package URLs with the version, for example
`pkg:maven/com.google.guava/[email protected]`. A new version of the package is
a new finding.
+* When an entry expires its finding fails the scan again. Renew the date only
after the finding has been
+ looked at again, and only if the tracking issue is still open. Delete
entries whose finding is fixed.
+
+`scan.sh check-exemptions` fails the `Exemptions` job when an entry has no
`id`, `purls`, `expired_at` or
+`statement`, when a purl has no exact version, when `expired_at` is malformed,
quoted, not in the future or
+more than 90 days ahead (UTC), or when the statement does not reference
`apache/gravitino#<number>`. It also
+checks that the VEX file is OpenVEX JSON and that every statement is
`not_affected`, with one of the five
+OpenVEX justifications (`component_not_present`, `vulnerable_code_not_present`,
+`vulnerable_code_not_in_execute_path`,
`vulnerable_code_cannot_be_controlled_by_adversary`,
+`inline_mitigations_already_exist`) and an `impact_statement`. Other statuses
are rejected: Trivy also
+suppresses a finding marked `fixed`, which would need no evidence, and
`affected` or
+`under_investigation` suppress nothing. A fixed dependency is shown by
upgrading it, not by a statement.
+
+The ignore file uses a Trivy feature that is marked experimental, as are
`--vex` and `--show-suppressed`.
diff --git a/.github/trivy/scan.sh b/.github/trivy/scan.sh
new file mode 100755
index 0000000000..6c7ea173c8
--- /dev/null
+++ b/.github/trivy/scan.sh
@@ -0,0 +1,602 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Runs Trivy (in a hardened container) against built Gravitino artifacts. The
same script is used
+# by .github/workflows/cve-scan.yml and by contributors on their machines.
+#
+# Usage:
+# scan.sh pull Pull the pinned Trivy image (with
retries).
+# scan.sh download-db Download the vulnerability and Java DBs
into the cache dir.
+# scan.sh db-info Print the snapshot dates of the cached
DBs (job summary too).
+# scan.sh scan NAME PATH [TYPE] Scan one target directory. TYPE is
rootfs (default) or fs.
+# scan.sh scan-all DIR [TYPE] Scan every sub-directory of DIR as its
own target.
+# scan.sh stage DIR NAME GLOB Copy the one jar matching GLOB (not
*-empty.jar) to DIR/NAME.
+# scan.sh stage-python SRC DEST Resolve the Python package in SRC with
all extras except dev
+# into DEST/requirements.txt
(name==version, with transitive
+# dependencies). Needs python3 with pip
>= 22.2 and network.
+# scan.sh pip-report-to-requirements REPORT DEST ROOT
+# Convert a 'pip install --report' file
into DEST/requirements.txt,
+# leaving out the package ROOT itself.
Works offline.
+# scan.sh unused REPORT_DIR Warn about exemptions that matched
nothing in the reports.
+# scan.sh check-exemptions Fail when an exemption violates the
policy in README.md.
+#
+# A target fails when a HIGH or CRITICAL finding remains after the exemptions
are applied, or when
+# Trivy did not produce a valid report (fail closed). Reports are written to
$TRIVY_REPORT_DIR as
+# NAME.json (raw), NAME.sarif and NAME.md. A target also fails when its SARIF
or Markdown report
+# cannot be produced, in both 'scan' and 'scan-all'. Only 'unused' and
'check-exemptions' need yq (v4).
+#
+# Environment (all optional):
+# TRIVY_IMAGE Pinned scanner image (defaults to the digest pinned
below).
+# TRIVY_CACHE_DIR Vulnerability DB cache directory (default:
$HOME/.cache/trivy).
+# TRIVY_REPORT_DIR Output directory (default: ./trivy-reports).
+# TRIVY_SCAN_TIMEOUT Time limit of one Trivy scan, such as 10m (default:
45m). A target that hits
+# it fails. The workflow sets it per job so that all
targets of a job fit
+# into the job limit.
+# TRIVY_POLICY_DIR Directory holding trivyignore.yaml and vex.openvex.json
+# (default: the directory of this script).
+# TRIVY_EXEMPTIONS Set to "off" to scan without exemptions (used to
generate a baseline).
+# PYTHON Interpreter used by 'stage-python' (default: python3).
+# GITHUB_STEP_SUMMARY When set, the Markdown report is appended to it as
well.
+
+set -euo pipefail
+
+DEFAULT_IMAGE='ghcr.io/aquasecurity/trivy:0.76.1@sha256:790fd66d1697395d8693d1acaa1ea702406a20f109b6fc7bac8db623eca6c06c'
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+IMAGE="${TRIVY_IMAGE:-${DEFAULT_IMAGE}}"
+CACHE_DIR="${TRIVY_CACHE_DIR:-${HOME}/.cache/trivy}"
+REPORT_DIR="${TRIVY_REPORT_DIR:-$(pwd)/trivy-reports}"
+POLICY_DIR="${TRIVY_POLICY_DIR:-${SCRIPT_DIR}}"
+EXEMPTIONS="${TRIVY_EXEMPTIONS:-on}"
+IGNORE_FILE="${POLICY_DIR}/trivyignore.yaml"
+VEX_FILE="${POLICY_DIR}/vex.openvex.json"
+MAX_EXEMPTION_DAYS=90
+SCAN_TIMEOUT="${TRIVY_SCAN_TIMEOUT:-45m}"
+MAX_ROWS=200
+
+# Flags shared by every container: no network is added here, callers decide.
+hardening=(--rm --read-only --cap-drop ALL --security-opt no-new-privileges
+ --user "$(id -u):$(id -g)" --tmpfs /tmp)
+trivy_env=(-e TRIVY_CACHE_DIR=/cache -e TRIVY_SKIP_VERSION_CHECK=true
+ -e TRIVY_DISABLE_TELEMETRY=true -e TRIVY_NO_PROGRESS=true)
+
+log() { printf '%s\n' "$*" >&2; }
+
+if [[ ! "${SCAN_TIMEOUT}" =~ ^[1-9][0-9]*[smh]$ ]]; then
+ log "TRIVY_SCAN_TIMEOUT must be a duration such as 10m, got
'${SCAN_TIMEOUT}'"
+ exit 2
+fi
+
+abs_dir() { (cd "$1" && pwd); }
+
+# Retries a command with exponential backoff: retry ATTEMPTS COMMAND...
+retry() {
+ local attempts=$1 delay=10 n=1
+ shift
+ until "$@"; do
+ if ((n >= attempts)); then
+ log "Command failed after ${attempts} attempts: $*"
+ return 1
+ fi
+ log "Attempt ${n}/${attempts} failed, retrying in ${delay}s: $*"
+ sleep "${delay}"
+ delay=$((delay * 2))
+ n=$((n + 1))
+ done
+}
+
+cmd_pull() {
+ retry 5 docker pull --quiet "${IMAGE}" >/dev/null
+ log "Pulled ${IMAGE}"
+}
+
+download_db() {
+ # The default repository chain (mirror.gcr.io, then ghcr.io) is kept on
purpose.
+ docker run "${hardening[@]}" -v "${CACHE_DIR}:/cache" "${trivy_env[@]}"
"${IMAGE}" \
+ image --download-db-only --no-progress &&
+ docker run "${hardening[@]}" -v "${CACHE_DIR}:/cache" "${trivy_env[@]}"
"${IMAGE}" \
+ image --download-java-db-only --no-progress
+}
+
+cmd_download_db() {
+ mkdir -p "${CACHE_DIR}"
+ retry 4 download_db
+ log "Vulnerability DB: $(db_snapshot)"
+}
+
+# Prints the update time of the trivy DB and the Java DB in the cache.
+db_snapshot() {
+ local vuln java
+ vuln="$(jq -r '.UpdatedAt // "unknown"' "${CACHE_DIR}/db/metadata.json"
2>/dev/null || echo unknown)"
+ java="$(jq -r '.UpdatedAt // "unknown"' "${CACHE_DIR}/java-db/metadata.json"
2>/dev/null || echo unknown)"
+ printf 'trivy-db %s, java-db %s' "${vuln}" "${java}"
+}
+
+cmd_db_info() {
+ local md
+ md="$(mktemp)"
+ printf 'Vulnerability DB snapshot: %s\n\n' "$(db_snapshot)" >"${md}"
+ emit_summary "${md}"
+ rm -f "${md}"
+}
+
+emit_summary() {
+ cat "$1" || return 1
+ if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
+ cat "$1" >>"${GITHUB_STEP_SUMMARY}" || return 1
+ fi
+}
+
+# Writes the Markdown report for one target: write_report NAME JSON OUTPUT.
+# Every step is checked explicitly: the function runs inside '||' lists, where
errexit is off.
+write_report() {
+ local name=$1 json=$2 md=$3 remaining suppressed snapshot
+ remaining="$(jq '[.Results[]?.Vulnerabilities[]?] | length' "${json}")" ||
return 1
+ suppressed="$(jq '[.Results[]?.ExperimentalModifiedFindings[]?] | length'
"${json}")" || return 1
+ snapshot="$(db_snapshot)" || return 1
+ {
+ printf '### %s\n\n' "${name}" &&
+ printf 'DB snapshot: %s. Remaining HIGH/CRITICAL: **%s**. Suppressed:
%s.\n\n' \
+ "${snapshot}" "${remaining}" "${suppressed}" || return 1
+ if ((remaining > 0 || suppressed > 0)); then
+ printf 'Tables are grouped by vulnerability and package and show at most
%s rows. The JSON report has everything.\n\n' "${MAX_ROWS}" || return 1
+ fi
+ if ((remaining > 0)); then
+ printf '#### Remaining findings\n\n' || return 1
+ printf '| Vulnerability | Severity | Package | Installed | Fixed |
Location |\n' || return 1
+ printf '| --- | --- | --- | --- | --- | --- |\n' || return 1
+ jq -r --argjson max "${MAX_ROWS}" '
+ def esc: tostring | gsub("\\|"; "\\|");
+ [.Results[]? | .Target as $t | .Vulnerabilities[]?
+ | {id: .VulnerabilityID, sev: .Severity, pkg: .PkgName, ver:
.InstalledVersion,
+ fix: (.FixedVersion // "-"), url: (.PrimaryURL // ""), path:
(.PkgPath // $t)}]
+ | group_by([.id, .pkg, .ver])
+ | map(.[0] + {paths: (map(.path) | unique)})
+ | sort_by((if .sev == "CRITICAL" then 0 else 1 end), .id) | .[:$max][]
+ | "| " + (if .url != "" then "[\(.id)](\(.url))" else .id end)
+ + " | \(.sev) | \(.pkg | esc) | \(.ver | esc) | \(.fix | esc) | "
+ + ((.paths[:3] | map("`" + esc + "`") | join("<br>"))
+ + (if (.paths | length) > 3 then "<br>(+\((.paths | length) - 3)
more)" else "" end)) + " |"
+ ' "${json}" || return 1
+ printf '\n' || return 1
+ fi
+ if ((suppressed > 0)); then
+ printf '<details><summary>Suppressed findings (%s)</summary>\n\n'
"${suppressed}" || return 1
+ printf '| Vulnerability | Severity | Package | Installed | Status |
Statement | Source | Locations |\n' || return 1
+ printf '| --- | --- | --- | --- | --- | --- | --- | --- |\n' || return 1
+ jq -r --argjson max "${MAX_ROWS}" '
+ def esc: tostring | gsub("\\|"; "\\|");
+ [.Results[]? | .Target as $t | .ExperimentalModifiedFindings[]?
+ | {id: .Finding.VulnerabilityID, sev: .Finding.Severity, pkg:
.Finding.PkgName,
+ ver: .Finding.InstalledVersion, status: .Status,
+ stmt: (.Statement // "-"), src: ((.Source // "-") | split("/") |
last),
+ path: (.Finding.PkgPath // $t)}]
+ | group_by([.id, .pkg, .ver, .status, .stmt, .src])
+ | map(.[0] + {n: length}) | sort_by(.pkg, .id) | .[:$max][]
+ | "| \(.id) | \(.sev) | \(.pkg | esc) | \(.ver | esc) | \(.status) |
\(.stmt | esc) | \(.src | esc) | \(.n) |"
+ ' "${json}" || return 1
+ printf '\n</details>\n\n' || return 1
+ fi
+ } >"${md}" || return 1
+}
+
+# Converts the JSON report to SARIF with one run per target and a unique id:
make_sarif NAME SARIF.
+# The result is only installed when it is valid JSON with at least one run.
+make_sarif() {
+ local name=$1 sarif=$2
+ docker run "${hardening[@]}" --network none -v "$(abs_dir
"${REPORT_DIR}"):/out" \
+ "${IMAGE}" convert --format sarif --output "/out/${name}.sarif"
"/out/${name}.json" || return 1
+ jq --arg id "trivy/${name}/" \
+ '.runs |= map(.automationDetails = {id: $id})' "${sarif}" >"${sarif}.tmp"
|| return 1
+ jq -e '(.runs | type == "array") and (.runs | length >= 1)' "${sarif}.tmp"
>/dev/null || return 1
+ mv "${sarif}.tmp" "${sarif}" || return 1
+}
+
+# Scans one target: scan_target NAME PATH TYPE. Returns non-zero when the
target fails the gate or
+# any step fails. Callers use it in '||' lists, where errexit is off, so every
step is checked.
+scan_target() {
+ local name=$1 path=$2 type=${3:-rootfs} json sarif md
+ json="${REPORT_DIR}/${name}.json"
+ sarif="${REPORT_DIR}/${name}.sarif"
+ md="${REPORT_DIR}/${name}.md"
+
+ if [[ ! -d "${path}" ]] || [[ -z "$(find "${path}" -mindepth 1 -print
-quit)" ]]; then
+ log "::error title=${name}::Scan target '${path}' does not exist or is
empty"
+ return 1
+ fi
+ if [[ ! -f "${CACHE_DIR}/db/trivy.db" || ! -f
"${CACHE_DIR}/java-db/trivy-java.db" ]]; then
+ log "::error title=${name}::Vulnerability DBs are missing in ${CACHE_DIR};
run 'scan.sh download-db'"
+ return 1
+ fi
+ mkdir -p "${REPORT_DIR}" || return 1
+ rm -f "${json}" "${sarif}" "${sarif}.tmp" "${md}" || return 1
+
+ local policy_args=() mounts=()
+ mounts=(-v "$(abs_dir "${path}"):/scan:ro" -v "${CACHE_DIR}:/cache:ro"
+ -v "$(abs_dir "${REPORT_DIR}"):/out")
+ if [[ "${EXEMPTIONS}" != "off" ]]; then
+ mounts+=(-v "$(abs_dir "${POLICY_DIR}"):/policy:ro")
+ policy_args+=(--ignorefile /policy/trivyignore.yaml --vex
/policy/vex.openvex.json)
+ fi
+
+ log "::group::Scan ${name}"
+ local rc=0
+ # The scan itself never needs the network: DBs come from the read-only cache.
+ docker run "${hardening[@]}" --network none "${mounts[@]}" "${trivy_env[@]}"
"${IMAGE}" \
+ "${type}" /scan --scanners vuln --severity HIGH,CRITICAL \
+ --skip-db-update --skip-java-db-update --offline-scan --cache-backend
memory \
+ --show-suppressed --timeout "${SCAN_TIMEOUT}"
${policy_args[@]+"${policy_args[@]}"} \
+ --format json --output "/out/${name}.json" || rc=$?
+ log "::endgroup::"
+
+ if ((rc != 0)) || ! jq -e '.SchemaVersion != null and (.ArtifactName | type
== "string")' \
+ "${json}" >/dev/null 2>&1; then
+ log "::error title=${name}::Trivy did not produce a valid report (exit
code ${rc})"
+ return 1
+ fi
+
+ # SARIF contains the remaining findings only. A target whose SARIF or report
cannot be produced
+ # fails, and no partial file is left behind (the SARIF directory is uploaded
as one unit).
+ if ! make_sarif "${name}" "${sarif}"; then
+ rm -f "${sarif}" "${sarif}.tmp"
+ log "::error title=${name}::Could not produce a valid SARIF report"
+ return 1
+ fi
+ if ! write_report "${name}" "${json}" "${md}" || ! emit_summary "${md}"; then
+ rm -f "${md}"
+ log "::error title=${name}::Could not write the Markdown report"
+ return 1
+ fi
+
+ local remaining
+ remaining="$(jq '[.Results[]?.Vulnerabilities[]?] | length' "${json}")" ||
return 1
+ if [[ ! "${remaining}" =~ ^[0-9]+$ ]]; then
+ log "::error title=${name}::Could not count the remaining findings"
+ return 1
+ fi
+ if ((remaining > 0)); then
+ log "::error title=${name}::${remaining} HIGH/CRITICAL findings remain
after exemptions"
+ return 1
+ fi
+}
+
+# Copies exactly one jar matching GLOB into DEST/NAME so that it is scanned as
its own target.
+cmd_stage() {
+ local dest=$1 name=$2 pattern=$3 file matches=()
+ while IFS= read -r file; do
+ [[ "${file}" == *-empty.jar ]] || matches+=("${file}")
+ done < <(compgen -G "${pattern}" || true)
+ if ((${#matches[@]} != 1)); then
+ log "::error title=${name}::Expected exactly one jar matching
'${pattern}', found ${#matches[@]}"
+ return 1
+ fi
+ mkdir -p "${dest}/${name}"
+ cp "${matches[0]}" "${dest}/${name}/"
+}
+
+# Normalizes a Python package name as in PEP 503: lower case, runs of '-', '_'
and '.' become '-'.
+normalize_name() {
+ printf '%s' "$1" | tr '[:upper:]' '[:lower:]' | sed -E 's/[-_.]+/-/g'
+}
+
+# Converts the report of 'pip install --dry-run --report' into
DEST/requirements.txt, one
+# 'name==version' line per installed package without the root package itself:
+# pip_report_to_requirements REPORT DEST ROOT_NAME. Fails closed (and removes
DEST) when the report
+# is not valid, an item has no name or version, or no dependency is left.
+cmd_pip_report_to_requirements() {
+ local report=$1 dest=$2 root lines
+ root="$(normalize_name "$3")"
+ if [[ -z "${root}" ]]; then
+ log "::error title=client-python::The name of the root package is empty"
+ return 1
+ fi
+ if ! jq -e '(.install | type) == "array"' "${report}" >/dev/null 2>&1; then
+ log "::error title=client-python::Invalid pip report '${report}': it is
not JSON with an install list"
+ return 1
+ fi
+ if ! lines="$(jq -r --arg root "${root}" '
+ def norm: ascii_downcase | gsub("[-_.]+"; "-");
+ .install[]
+ | if ((.metadata.name | type) != "string") or (.metadata.name == "")
+ or ((.metadata.version | type) != "string") or (.metadata.version ==
"")
+ then error("an item has no name or version")
+ else . end
+ | select((.metadata.name | norm) != $root)
+ | .metadata.name + "==" + .metadata.version' "${report}" 2>&1)"; then
+ log "::error title=client-python::Invalid pip report '${report}': ${lines}"
+ return 1
+ fi
+ lines="$(sort -u <<<"${lines}")"
+ if [[ -z "${lines}" ]]; then
+ log "::error title=client-python::The pip report lists no dependency
besides the package itself"
+ return 1
+ fi
+ mkdir -p "${dest}" || return 1
+ printf '%s\n' "${lines}" >"${dest}/requirements.txt" || return 1
+}
+
+# Resolves what 'pip install apache-gravitino[<every extra except dev>]'
installs and writes it as
+# concrete versions to DEST/requirements.txt: stage_python SRC_DIR DEST. A
requirements file would
+# neither hold version ranges nor transitive dependencies, which Trivy needs
to look up.
+# The resolution only downloads metadata and installs nothing. It runs in a
throwaway virtualenv, so
+# no package of the machine leaks into the result.
+cmd_stage_python() {
+ local src=$1 dest=$2 py="${PYTHON:-python3}" tmp rc=0
+ if ! command -v "${py}" >/dev/null 2>&1; then
+ log "::error title=client-python::Python interpreter '${py}' not found;
set PYTHON"
+ return 1
+ fi
+ tmp="$(mktemp -d)" || return 1
+ stage_python_in "${src}" "${dest}" "${py}" "${tmp}" || rc=$?
+ rm -rf "${tmp}"
+ ((rc == 0)) || rm -rf "${dest}"
+ return "${rc}"
+}
+
+stage_python_in() {
+ local src=$1 dest=$2 py=$3 tmp=$4 vpy major minor root extras spec
+ vpy="${tmp}/venv/bin/python"
+ export PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_NO_INPUT=1
+ # pip may build the metadata inside the source tree, so work on a copy.
+ mkdir "${tmp}/src" && cp -R "${src}/." "${tmp}/src/" || return 1
+ if ! "${py}" -m venv "${tmp}/venv"; then
+ log "::error title=client-python::Could not create a virtualenv with
'${py}'"
+ return 1
+ fi
+ read -r major minor < <("${vpy}" -m pip --version 2>/dev/null |
+ sed -nE 's/^pip ([0-9]+)\.([0-9]+).*/\1 \2/p') || true
+ if [[ ! "${major:-}" =~ ^[0-9]+$ || ! "${minor:-}" =~ ^[0-9]+$ ]] ||
+ ((major < 22 || (major == 22 && minor < 2))); then
+ log "::error title=client-python::pip >= 22.2 (for 'pip install --report')
is required, found '${major:-none}.${minor:-}'"
+ return 1
+ fi
+ if ! "${vpy}" -m pip install --dry-run --ignore-installed --quiet \
+ --report "${tmp}/base.json" "${tmp}/src"; then
+ log "::error title=client-python::pip could not resolve '${src}'"
+ return 1
+ fi
+ root="$(jq -r '[.install[]? | select(.is_direct == true)] | if length == 1
then .[0].metadata.name else empty end' \
+ "${tmp}/base.json" 2>/dev/null)" || root=''
+ if [[ -z "${root}" ]]; then
+ log "::error title=client-python::Could not find the root package in the
pip report for '${src}'"
+ return 1
+ fi
+ # Every extra but dev, taken from the package so that new extras are covered
automatically.
+ extras="$(jq -r '[.install[] | select(.is_direct == true) |
.metadata.provides_extra // [] | .[]
+ | select((ascii_downcase) != "dev")] | unique | join(",")'
"${tmp}/base.json")" || return 1
+ spec="${tmp}/src"
+ [[ -z "${extras}" ]] || spec="${tmp}/src[${extras}]"
+ log "Resolving ${root} with extras: ${extras:-none}"
+ if ! "${vpy}" -m pip install --dry-run --ignore-installed --quiet \
+ --report "${tmp}/full.json" "${spec}"; then
+ log "::error title=client-python::pip could not resolve '${src}' with the
extras ${extras:-none}"
+ return 1
+ fi
+ cmd_pip_report_to_requirements "${tmp}/full.json" "${dest}" "${root}"
+}
+
+# Fails when a target fails, and also when there is nothing to scan (fail
closed).
+cmd_scan_all() {
+ local parent=$1 type=${2:-rootfs} dir rc=0 count=0
+ for dir in "${parent}"/*/; do
+ [[ -d "${dir}" ]] || continue
+ count=$((count + 1))
+ scan_target "$(basename "${dir}")" "${dir%/}" "${type}" || rc=1
+ done
+ if ((count == 0)); then
+ log "::error title=Scan::No target directory found in '${parent}'"
+ return 1
+ fi
+ return "${rc}"
+}
+
+require_yq() {
+ command -v yq >/dev/null 2>&1 || { log 'yq (v4) is required for this
command'; return 1; }
+}
+
+# Lists every exemption entry as "ID PURL" (PURL is empty for entries without
purls).
+list_exemptions() {
+ # shellcheck disable=SC2016 # $id is a yq variable, not a shell one.
+ yq -r '.vulnerabilities[]? | .id as $id
+ | (.purls // [""])[] | $id + " " + .' "${IGNORE_FILE}"
+}
+
+cmd_unused() {
+ local dir=$1 used entries count=0 reports
+ require_yq || return 1
+ reports="$(find "${dir}" -maxdepth 1 -name '*.json' | wc -l | tr -d ' ')"
+ if ((reports == 0)); then
+ log "No JSON reports found in ${dir}; skipping the unused exemption check"
+ return 0
+ fi
+ used="$(find "${dir}" -maxdepth 1 -name '*.json' -exec jq -r '
+ .Results[]?.ExperimentalModifiedFindings[]?
+ | select(.Status == "ignored")
+ | .Finding.VulnerabilityID + " " + (.Finding.PkgIdentifier.PURL // "")'
{} + | sort -u)"
+ entries="$(list_exemptions)"
+ local summary=''
+ while read -r id purl; do
+ [[ -n "${id}" ]] || continue
+ if [[ -n "${purl}" ]]; then
+ grep -qxF "${id} ${purl}" <<<"${used}" && continue
+ else
+ grep -q "^${id} " <<<"${used}" && continue
+ fi
+ count=$((count + 1))
+ log "::warning title=Unused exemption::${id} ${purl} matched nothing in
${reports} reports; remove it from trivyignore.yaml"
+ summary+="| ${id} | ${purl:--} |"$'\n'
+ done <<<"${entries}"
+
+ local md="${dir}/unused-exemptions.md"
+ {
+ printf '### Unused exemptions\n\n'
+ if ((count == 0)); then
+ # shellcheck disable=SC2016 # The backticks are Markdown.
+ printf 'Every exemption in `trivyignore.yaml` matched a finding (%s
reports checked).\n\n' "${reports}"
+ else
+ printf '%s exemption(s) matched nothing in %s reports. Remove them if
the finding is fixed.\n\n' \
+ "${count}" "${reports}"
+ printf '| Vulnerability | Package URL |\n| --- | --- |\n%s\n'
"${summary}"
+ fi
+ } >"${md}"
+ emit_summary "${md}"
+}
+
+# Prints one line per violation of the exemption policy in trivyignore.yaml
(see README.md).
+ignore_violations() {
+ local now=$1
+ yq -o=json '.vulnerabilities |= ((. // []) | map(. + {"__expired_at_tag":
(.expired_at | tag)}))' \
+ "${IGNORE_FILE}" | jq -r --argjson now "${now}" --argjson maxdays
"${MAX_EXEMPTION_DAYS}" '
+ def is_date: type == "string" and test("^[0-9]{4}-[0-9]{2}-[0-9]{2}$")
+ and ((try (. + "T00:00:00Z" | fromdateiso8601 | todate | .[0:10]) catch
"") == .);
+ def text: type == "string" and (gsub("\\s"; "") | length) > 0;
+ if (.vulnerabilities | length) == 0 then "trivyignore.yaml has no entries"
else empty end,
+ (.vulnerabilities | to_entries[] | .key as $i | .value as $e
+ | "entry \($i + 1)" + (if ($e.id | text) then " (\($e.id))" else "" end)
as $label
+ | ( if ($e.id | text) | not then "missing id" else empty end,
+ if (($e.purls | type) != "array") or ($e.purls | length) == 0
+ or ($e.purls | any(type != "string" or
(test("^pkg:[^/]+/.+@[^@/]+$") | not)))
+ then "purls must be a non-empty list of package URLs with an exact
version" else empty end,
+ if $e.expired_at == null then "missing expired_at"
+ elif ($e.expired_at | is_date | not) then "malformed expired_at
\($e.expired_at)"
+ elif $e.__expired_at_tag != "!!timestamp" then "expired_at must be
an unquoted date, as Trivy ignores a quoted one"
+ else
+ (($e.expired_at + "T00:00:00Z" | fromdateiso8601) - $now) as $left
+ | if $left <= 0 then "expired_at \($e.expired_at) is not in the
future"
+ elif $left > $maxdays * 86400 then "expired_at \($e.expired_at)
is more than \($maxdays) days ahead"
+ else empty end
+ end,
+ if ($e.statement | text | not) then "missing statement"
+ elif ($e.statement | contains("TRACKING_ISSUE")) then "statement
still contains the TRACKING_ISSUE placeholder"
+ elif ($e.statement | test("apache/gravitino#[0-9]+") | not)
+ then "statement must reference a tracking issue as
apache/gravitino#<number>"
+ else empty end
+ ) | $label + ": " + .)'
+}
+
+# Prints one line per violation of the OpenVEX rules for vex.openvex.json (see
README.md).
+vex_violations() {
+ if ! jq -e . "${VEX_FILE}" >/dev/null 2>&1; then
+ echo "not valid JSON"
+ return 0
+ fi
+ jq -r '
+ def text: type == "string" and (gsub("\\s"; "") | length) > 0;
+ def justifications: ["component_not_present",
"vulnerable_code_not_present",
+ "vulnerable_code_not_in_execute_path",
"vulnerable_code_cannot_be_controlled_by_adversary",
+ "inline_mitigations_already_exist"];
+ if type != "object" then "the document must be a JSON object" else
+ ( if (.["@context"] | type) == "string" and (.["@context"] |
startswith("https://openvex.dev/ns"))
+ then empty else "@context must be an OpenVEX namespace
(https://openvex.dev/ns/...)" end,
+ if (.["@id"] | text) then empty else "missing @id" end,
+ if (.author | text) then empty else "missing author" end,
+ if (.timestamp | text) then empty else "missing timestamp" end,
+ if (.version | type) == "number" and .version >= 1 then empty else
"version must be a number >= 1" end,
+ if (.statements | type) == "array" then empty else "statements must be
a list" end,
+ ( (.statements | if type == "array" then to_entries else [] end)[] |
.key as $i | .value as $s
+ | "statement \($i + 1)" + (if ($s.vulnerability.name | text) then "
(\($s.vulnerability.name))" else "" end) as $label
+ | ( if ($s.vulnerability.name | text) | not then "missing
vulnerability.name" else empty end,
+ if (($s.products | type) != "array") or ($s.products | length)
== 0
+ or ($s.products | any(((.["@id"] // "") | text) | not))
+ then "products must be a non-empty list of products with an @id"
else empty end,
+ if ($s.status | text) | not then "missing status"
+ elif $s.status == "not_affected" then
+ ( if (justifications | index($s.justification)) == null
+ then "not_affected needs a justification from the OpenVEX
list" else empty end,
+ if ($s.impact_statement | text) | not
+ then "not_affected needs an impact_statement that cites the
code or analysis" else empty end )
+ elif $s.status == "fixed" then
+ "status fixed is not allowed: Trivy would suppress the finding
without evidence; upgrade the dependency instead"
+ elif (["affected", "under_investigation"] | index($s.status)) !=
null then
+ "status \($s.status) is not allowed: it does not suppress
anything, so the statement is meaningless here"
+ else "unknown status \($s.status)" end
+ ) | $label + ": " + .)
+ )
+ end' "${VEX_FILE}"
+}
+
+cmd_check_exemptions() {
+ require_yq || return 1
+ local violations rc=0 count
+ if [[ ! -f "${IGNORE_FILE}" || ! -f "${VEX_FILE}" ]]; then
+ log "::error title=Exemption policy::trivyignore.yaml or vex.openvex.json
is missing in ${POLICY_DIR}"
+ return 1
+ fi
+ violations="$(
+ ignore_violations "$(date -u +%s)" | sed 's/^/trivyignore.yaml: /' || echo
'trivyignore.yaml: cannot be parsed'
+ vex_violations | sed 's/^/vex.openvex.json: /' || echo 'vex.openvex.json:
cannot be checked'
+ )"
+ local md
+ md="$(mktemp)"
+ if [[ -z "${violations}" ]]; then
+ printf '### Exemption policy\n\nAll exemptions follow the policy.\n\n'
>"${md}"
+ else
+ count="$(grep -c '' <<<"${violations}")"
+ rc=1
+ log "::error title=Exemption policy::${count} violation(s), see the job
summary and README.md"
+ {
+ printf '### Exemption policy\n\n%s violation(s). Showing at most
%s.\n\n' "${count}" "${MAX_ROWS}"
+ # shellcheck disable=SC2016 # The backticks are Markdown.
+ printf '```\n%s\n```\n\n' "$(head -n "${MAX_ROWS}" <<<"${violations}")"
+ } >"${md}"
+ fi
+ emit_summary "${md}" || rc=1
+ rm -f "${md}"
+ return "${rc}"
+}
+
+main() {
+ local subcommand=${1:-}
+ shift || true
+ case "${subcommand}" in
+ pull) cmd_pull ;;
+ download-db) cmd_download_db ;;
+ db-info) cmd_db_info ;;
+ scan)
+ [[ $# -ge 2 ]] || { log 'usage: scan.sh scan NAME PATH [rootfs|fs]';
exit 2; }
+ scan_target "$@" || exit 1
+ ;;
+ scan-all)
+ [[ $# -ge 1 ]] || { log 'usage: scan.sh scan-all DIR [rootfs|fs]'; exit
2; }
+ cmd_scan_all "$@"
+ ;;
+ stage)
+ [[ $# -eq 3 ]] || { log 'usage: scan.sh stage DIR NAME GLOB'; exit 2; }
+ cmd_stage "$@"
+ ;;
+ stage-python)
+ [[ $# -eq 2 ]] || { log 'usage: scan.sh stage-python SRC_DIR DEST_DIR';
exit 2; }
+ cmd_stage_python "$@"
+ ;;
+ pip-report-to-requirements)
+ [[ $# -eq 3 ]] || { log 'usage: scan.sh pip-report-to-requirements
REPORT DEST_DIR ROOT_NAME'; exit 2; }
+ cmd_pip_report_to_requirements "$@"
+ ;;
+ check-exemptions) cmd_check_exemptions ;;
+ unused)
+ [[ $# -ge 1 ]] || { log 'usage: scan.sh unused REPORT_DIR'; exit 2; }
+ cmd_unused "$@"
+ ;;
+ *)
+ log 'usage: scan.sh
{pull|download-db|db-info|scan|scan-all|stage|stage-python|pip-report-to-requirements|unused|check-exemptions}
...'
+ exit 2
+ ;;
+ esac
+}
+
+main "$@"
diff --git a/.github/trivy/trivyignore.yaml b/.github/trivy/trivyignore.yaml
new file mode 100644
index 0000000000..e3f06de1ad
--- /dev/null
+++ b/.github/trivy/trivyignore.yaml
@@ -0,0 +1,845 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Trivy ignore file for the CVE Scan workflow (passed with --ignorefile).
+# See .github/trivy/README.md for the exemption policy.
+#
+# Every entry below is a pre-existing finding that has not been analysed yet
(category B):
+# it is pinned to the exact package versions that were found, expires 90 days
after it was
+# added and points to the issue that tracks it. When an entry expires its
finding fails the
+# scan again. Renew an entry only after the finding has been re-triaged.
+vulnerabilities:
+ # authlib
+ - id: CVE-2026-114615
+ purls:
+ - pkg:pypi/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-114616
+ purls:
+ - pkg:pypi/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-116672
+ purls:
+ - pkg:pypi/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-96760
+ purls:
+ - pkg:pypi/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # com.fasterxml.jackson.core/jackson-core
+ - id: CVE-2025-52999
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-68494
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14712."
+ - id: CVE-2026-68494
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-89407
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14712."
+ - id: CVE-2026-89407
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-89425
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14712."
+ - id: CVE-2026-89425
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # com.fasterxml.jackson.core/jackson-databind
+ - id: CVE-2026-54512
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14712."
+ - id: CVE-2026-54512
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-54513
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14712."
+ - id: CVE-2026-54513
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-68497
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14712."
+ - id: CVE-2026-68497
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-91776
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14712."
+ - id: CVE-2026-91776
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-91777
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14712."
+ - id: CVE-2026-91777
+ purls:
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ - pkg:maven/com.fasterxml.jackson.core/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # com.google.guava/guava
+ - id: CVE-2026-102554
+ purls:
+ - pkg:maven/com.google.guava/[email protected]
+ - pkg:maven/com.google.guava/[email protected]
+ - pkg:maven/com.google.guava/[email protected]
+ - pkg:maven/com.google.guava/[email protected]
+ - pkg:maven/com.google.guava/[email protected]
+ - pkg:maven/com.google.guava/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # com.google.protobuf/protobuf-java
+ - id: CVE-2021-22569
+ purls:
+ - pkg:maven/com.google.protobuf/[email protected]
+ - pkg:maven/com.google.protobuf/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2022-3509
+ purls:
+ - pkg:maven/com.google.protobuf/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2022-3510
+ purls:
+ - pkg:maven/com.google.protobuf/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2024-7254
+ purls:
+ - pkg:maven/com.google.protobuf/[email protected]
+ - pkg:maven/com.google.protobuf/[email protected]
+ - pkg:maven/com.google.protobuf/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # com.nimbusds/nimbus-jose-jwt
+ - id: CVE-2023-52428
+ purls:
+ - pkg:maven/com.nimbusds/[email protected]
+ - pkg:maven/com.nimbusds/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # com.squareup.okhttp3/okhttp
+ - id: CVE-2021-0341
+ purls:
+ - pkg:maven/com.squareup.okhttp3/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # commons-beanutils/commons-beanutils
+ - id: CVE-2025-48734
+ purls:
+ - pkg:maven/commons-beanutils/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # commons-io/commons-io
+ - id: CVE-2024-47554
+ purls:
+ - pkg:maven/commons-io/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # dnsjava/dnsjava
+ - id: CVE-2024-25638
+ purls:
+ - pkg:maven/dnsjava/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # dnspython
+ - id: CVE-2026-114605
+ purls:
+ - pkg:pypi/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # fsspec
+ - id: CVE-2026-104851
+ purls:
+ - pkg:pypi/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.airlift/aircompressor
+ - id: CVE-2024-36114
+ purls:
+ - pkg:maven/io.airlift/[email protected]
+ - pkg:maven/io.airlift/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2025-67721
+ purls:
+ - pkg:maven/io.airlift/[email protected]
+ - pkg:maven/io.airlift/[email protected]
+ - pkg:maven/io.airlift/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.micrometer/micrometer-core
+ - id: CVE-2026-40984
+ purls:
+ - pkg:maven/io.micrometer/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.netty/netty-codec
+ - id: CVE-2026-42583
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.netty/netty-codec, io.netty/netty-codec-compression
+ - id: CVE-2026-59901
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.netty/netty-codec-dns
+ - id: CVE-2026-42579
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.netty/netty-codec-http
+ - id: CVE-2026-33870
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-42584
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-55831
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-55833
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-56745
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.netty/netty-codec-http, io.netty/netty-codec-http2
+ - id: CVE-2026-42587
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.netty/netty-codec-http2
+ - id: CVE-2025-55163
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-33871
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-56819
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.netty/netty-handler
+ - id: CVE-2025-24970
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-44249
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-45416
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-50010
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-75595
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # io.netty/netty-resolver-dns
+ - id: CVE-2026-45674
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-47691
+ purls:
+ - pkg:maven/io.netty/[email protected]
+ - pkg:maven/io.netty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # joserfc
+ - id: CVE-2026-119283
+ purls:
+ - pkg:pypi/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # net.minidev/json-smart
+ - id: CVE-2021-31684
+ purls:
+ - pkg:maven/net.minidev/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2023-1370
+ purls:
+ - pkg:maven/net.minidev/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/axios
+ - id: CVE-2026-101898
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-101901
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-101903
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-101905
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-101906
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-101909
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-25639
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-42033
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-42035
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-42043
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-42264
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-44486
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-44487
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-44488
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-44494
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-44495
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-44496
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-67320
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/browserslist
+ - id: CVE-2026-73088
+ purls:
+ - pkg:npm/[email protected]
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-73089
+ purls:
+ - pkg:npm/[email protected]
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/follow-redirects
+ - id: CVE-2026-111755
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-111756
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-116689
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/form-data
+ - id: CVE-2026-12143
+ purls:
+ - pkg:npm/[email protected]
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/js-cookie
+ - id: CVE-2026-46625
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/js-yaml
+ - id: CVE-2026-59869
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-84375
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: GHSA-5p4m-2wfm-xmqj
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/lodash-es
+ - id: CVE-2026-4800
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/nanoid
+ - id: CVE-2026-67213
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-67214
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-73086
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/next
+ - id: CVE-2026-44573
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-44578
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-64641
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-64645
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-64649
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-75604
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-94482
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: GHSA-2464-fhr4-w9xw
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: GHSA-2xp9-vwfh-vxw4
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: GHSA-5j59-xgg2-r9c4
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: GHSA-8h8q-6873-q5fj
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: GHSA-h25m-26qc-wcjf
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: GHSA-mwv6-3258-q52c
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: GHSA-q4gf-8mx6-v5v3
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/postcss
+ - id: CVE-2026-45623
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-73646
+ purls:
+ - pkg:npm/[email protected]
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # npm/source-map-js
+ - id: CVE-2026-93749
+ purls:
+ - pkg:npm/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.apache.avro/avro
+ - id: CVE-2023-39410
+ purls:
+ - pkg:maven/org.apache.avro/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2024-47561
+ purls:
+ - pkg:maven/org.apache.avro/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.apache.kafka/kafka-clients
+ - id: CVE-2026-35554
+ purls:
+ - pkg:maven/org.apache.kafka/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.apache.kerby/kerb-server
+ - id: CVE-2026-57915
+ purls:
+ - pkg:maven/org.apache.kerby/[email protected]
+ - pkg:maven/org.apache.kerby/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.apache.thrift/libthrift
+ - id: CVE-2019-0205
+ purls:
+ - pkg:maven/org.apache.thrift/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2020-13949
+ purls:
+ - pkg:maven/org.apache.thrift/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-43869
+ purls:
+ - pkg:maven/org.apache.thrift/[email protected]
+ - pkg:maven/org.apache.thrift/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-43871
+ purls:
+ - pkg:maven/org.apache.thrift/[email protected]
+ - pkg:maven/org.apache.thrift/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.codehaus.jettison/jettison
+ - id: CVE-2022-40150
+ purls:
+ - pkg:maven/org.codehaus.jettison/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2022-45685
+ purls:
+ - pkg:maven/org.codehaus.jettison/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2022-45693
+ purls:
+ - pkg:maven/org.codehaus.jettison/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2023-1436
+ purls:
+ - pkg:maven/org.codehaus.jettison/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.eclipse.jetty/jetty-http
+ - id: CVE-2026-2332
+ purls:
+ - pkg:maven/org.eclipse.jetty/[email protected]
+ - pkg:maven/org.eclipse.jetty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.eclipse.jetty/jetty-security
+ - id: CVE-2026-10050
+ purls:
+ - pkg:maven/org.eclipse.jetty/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.ini4j/ini4j
+ - id: CVE-2022-41404
+ purls:
+ - pkg:maven/org.ini4j/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.jline/jline-builtins
+ - id: CVE-2026-77422
+ purls:
+ - pkg:maven/org.jline/[email protected]
+ - pkg:maven/org.jline/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.jline/jline-remote-telnet
+ - id: CVE-2026-56740
+ purls:
+ - pkg:maven/org.jline/[email protected]
+ - pkg:maven/org.jline/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-56741
+ purls:
+ - pkg:maven/org.jline/[email protected]
+ - pkg:maven/org.jline/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.json/json
+ - id: CVE-2022-45688
+ purls:
+ - pkg:maven/org.json/json@20180130
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2023-5072
+ purls:
+ - pkg:maven/org.json/json@20180130
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.lz4/lz4-java
+ - id: CVE-2025-12183
+ purls:
+ - pkg:maven/org.lz4/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2025-66566
+ purls:
+ - pkg:maven/org.lz4/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-106451
+ purls:
+ - pkg:maven/org.lz4/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.postgresql/postgresql
+ - id: CVE-2026-42198
+ purls:
+ - pkg:maven/org.postgresql/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # org.xerial.snappy/snappy-java
+ - id: CVE-2026-108106
+ purls:
+ - pkg:maven/org.xerial.snappy/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ - id: CVE-2026-93451
+ purls:
+ - pkg:maven/org.xerial.snappy/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # ray
+ - id: CVE-2026-57516
+ purls:
+ - pkg:pypi/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
+ # software.amazon.ion/ion-java
+ - id: CVE-2024-21634
+ purls:
+ - pkg:maven/software.amazon.ion/[email protected]
+ expired_at: 2027-02-07
+ statement: "Pre-existing finding, tracked in apache/gravitino#14777."
diff --git a/.github/trivy/vex.openvex.json b/.github/trivy/vex.openvex.json
new file mode 100644
index 0000000000..00c1d0df5a
--- /dev/null
+++ b/.github/trivy/vex.openvex.json
@@ -0,0 +1,8 @@
+{
+ "@context": "https://openvex.dev/ns/v0.2.0",
+ "@id":
"https://github.com/apache/gravitino/blob/main/.github/trivy/vex.openvex.json",
+ "author": "Apache Gravitino Community",
+ "timestamp": "2026-11-09T00:00:00Z",
+ "version": 1,
+ "statements": []
+}
diff --git a/.github/workflows/cve-scan.yml b/.github/workflows/cve-scan.yml
new file mode 100644
index 0000000000..544600f50f
--- /dev/null
+++ b/.github/workflows/cve-scan.yml
@@ -0,0 +1,401 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+name: CVE Scan
+
+# Weekly Trivy scan of the artifacts Gravitino ships. See
.github/trivy/README.md for what is
+# scanned, how to run the same scan locally and how exemptions work.
+#
+# A target (one shipped artifact) fails when a HIGH or CRITICAL finding
remains after the
+# exemptions in .github/trivy are applied, or when Trivy produced no valid
report. Expired
+# exemptions bring their findings back, so a red run is also the reminder to
re-triage them.
+# A failed scheduled run opens (or updates) one tracking issue, which the
first passing scheduled
+# run closes again (job 'notify').
+#
+# Every upload step uses 'if-no-files-found: warn'. A report is missing only
after an earlier step
+# of the same job failed (scan.sh fails closed), and that step already fails
the job. Using 'error'
+# would add a second, confusing failure to the same run.
+on:
+ schedule:
+ - cron: '0 3 * * 1' # Mondays 03:00 UTC
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: cve-scan-${{ github.ref }}
+ cancel-in-progress: false
+
+env:
+ TRIVY_REPORT_DIR: ${{ github.workspace }}/trivy-reports
+ TARGET_DIR: ${{ github.workspace }}/trivy-targets
+
+jobs:
+ # Downloads the vulnerability DBs once per run. The scan jobs restore them
read-only and run
+ # without network access.
+ trivy-db:
+ name: Trivy DB
+ # Forks can start the workflow manually, but only apache/gravitino runs
the schedule.
+ if: github.event_name != 'schedule' || github.repository ==
'apache/gravitino'
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ outputs:
+ cache-key: ${{ steps.key.outputs.cache-key }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+ with:
+ persist-credentials: false
+ - name: Compute the cache key once for the whole run
+ id: key
+ run: echo "cache-key=trivy-db-v1-$(date -u +%Y-%m-%d)" >>
"${GITHUB_OUTPUT}"
+ - name: Restore the DB cache
+ id: cache
+ uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
+ with:
+ path: ~/.cache/trivy
+ key: ${{ steps.key.outputs.cache-key }}
+ - name: Download the DBs
+ if: steps.cache.outputs.cache-hit != 'true'
+ run: |
+ .github/trivy/scan.sh pull
+ .github/trivy/scan.sh download-db
+ - name: Record the DB snapshot
+ run: .github/trivy/scan.sh db-info
+
+ server:
+ name: Server packages
+ if: github.event_name != 'schedule' || github.repository ==
'apache/gravitino'
+ needs: trivy-db
+ runs-on: ubuntu-latest
+ timeout-minutes: 90
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/setup-java-toolchains
+ - name: Free up disk space
+ run: dev/ci/util_free_space.sh
+ - name: Restore the DB cache
+ uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 #
v5.0.4
+ with:
+ path: ~/.cache/trivy
+ key: ${{ needs.trivy-db.outputs.cache-key }}
+ fail-on-cache-miss: true
+ - name: Pull the Trivy image
+ run: .github/trivy/scan.sh pull
+ # The web UI is not built: its WAR holds a minified static export that
Trivy cannot inspect.
+ # Its lock files are scanned in the lockfiles job (see
.github/trivy/README.md).
+ - name: Build the server packages
+ run: ./gradlew compileDistribution compileIcebergRESTServer
compileLanceRESTServer -PskipWeb=true -x test
+ # The standalone REST server directories hold the same third-party jars
as the copies in
+ # distribution/package; they are scanned too so that each shipped
package has its own report.
+ # 3 targets x 15m scan limit = 45m at most. The step limit lets the job
upload the reports of
+ # the targets that finished, which a timeout of the whole job would not.
+ - name: Scan
+ timeout-minutes: 50
+ env:
+ TRIVY_SCAN_TIMEOUT: 15m
+ run: |
+ rc=0
+ .github/trivy/scan.sh scan server-distribution distribution/package
|| rc=1
+ .github/trivy/scan.sh scan iceberg-rest-server
distribution/gravitino-iceberg-rest-server || rc=1
+ .github/trivy/scan.sh scan lance-rest-server
distribution/gravitino-lance-rest-server || rc=1
+ exit "${rc}"
+ - name: Upload the reports
+ if: ${{ !cancelled() }}
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
# v7.0.2
+ with:
+ name: cve-scan-server
+ path: ${{ env.TRIVY_REPORT_DIR }}
+ retention-days: 30
+ if-no-files-found: warn
+
+ # Every separately distributed fat jar. Each jar is staged in its own
directory and scanned as
+ # its own target, so findings stay attributable to the artifact users
download.
+ jars:
+ name: Shaded jars
+ if: github.event_name != 'schedule' || github.repository ==
'apache/gravitino'
+ needs: trivy-db
+ runs-on: ubuntu-latest
+ timeout-minutes: 90
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/setup-java-toolchains
+ - name: Free up disk space
+ run: dev/ci/util_free_space.sh
+ - name: Restore the DB cache
+ uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 #
v5.0.4
+ with:
+ path: ~/.cache/trivy
+ key: ${{ needs.trivy-db.outputs.cache-key }}
+ fail-on-cache-miss: true
+ - name: Pull the Trivy image
+ run: .github/trivy/scan.sh pull
+ - name: Build the fat jars
+ run: |
+ ./gradlew -PskipWeb=true \
+ :bundles:aws-bundle:shadowJar :bundles:gcp-bundle:shadowJar \
+ :bundles:azure-bundle:shadowJar :bundles:aliyun-bundle:shadowJar \
+ :bundles:tencent-bundle:shadowJar
:bundles:iceberg-aws-bundle:shadowJar \
+ :bundles:iceberg-gcp-bundle:shadowJar
:bundles:iceberg-azure-bundle:shadowJar \
+ :bundles:iceberg-aliyun-bundle:shadowJar \
+ :clients:client-java-runtime:shadowJar
:clients:filesystem-hadoop3-runtime:shadowJar \
+ :maintenance:jobs:shadowJar \
+ :flink-connector:flink-runtime-1.19:shadowJar
:flink-connector:flink-runtime-1.20:shadowJar \
+ :flink-connector:flink-runtime-2.1:shadowJar
:flink-connector:flink-runtime-2.2:shadowJar \
+ :spark-connector:spark-runtime-3.5:shadowJar
:spark-connector:spark-runtime-4.0:shadowJar
+ # The Spark 3.5 runtime is also released for Scala 2.13. Spark 4.0 is
Scala 2.13 only.
+ - name: Build the Spark 3.5 runtime for Scala 2.13
+ run: ./gradlew -PskipWeb=true -PscalaVersion=2.13
:spark-connector:spark-runtime-3.5:shadowJar
+ # Every jar is staged even if another one cannot be found, and the step
fails at the end. The
+ # Scan step then still scans and reports what was staged.
+ - name: Stage one directory per jar
+ id: stage
+ run: |
+ rc=0
+ stage() { .github/trivy/scan.sh stage "${TARGET_DIR}" "$@" || rc=1; }
+ for cloud in aws gcp azure aliyun tencent iceberg-aws iceberg-gcp
iceberg-azure iceberg-aliyun; do
+ stage "${cloud}-bundle"
"bundles/${cloud}-bundle/build/libs/gravitino-${cloud}-bundle-*.jar"
+ done
+ stage client-java-runtime
'clients/client-java-runtime/build/libs/gravitino-client-java-runtime-*.jar'
+ stage filesystem-hadoop3-runtime
'clients/filesystem-hadoop3-runtime/build/libs/gravitino-filesystem-hadoop3-runtime-*.jar'
+ stage jobs 'maintenance/jobs/build/libs/gravitino-jobs-*.jar'
+ for flink in 1.19 1.20 2.1 2.2; do
+ stage "flink-runtime-${flink}"
"flink-connector/v${flink}/flink-runtime/build/libs/gravitino-flink-connector-runtime-${flink}*.jar"
+ done
+ stage spark-runtime-3.5_2.12
'spark-connector/v3.5/spark-runtime/build/libs/gravitino-spark-connector-runtime-3.5_2.12-*.jar'
+ stage spark-runtime-3.5_2.13
'spark-connector/v3.5/spark-runtime/build/libs/gravitino-spark-connector-runtime-3.5_2.13-*.jar'
+ stage spark-runtime-4.0
'spark-connector/v4.0/spark-runtime/build/libs/gravitino-spark-connector-runtime-4.0_2.13-*.jar'
+ exit "${rc}"
+ # Runs after a failed Stage step too, but not when the build already
failed.
+ # 19 targets x 3m scan limit = 57m at most (a jar takes well under a
minute).
+ - name: Scan
+ if: ${{ !cancelled() && steps.stage.conclusion != 'skipped' }}
+ timeout-minutes: 60
+ env:
+ TRIVY_SCAN_TIMEOUT: 3m
+ run: .github/trivy/scan.sh scan-all "${TARGET_DIR}"
+ # A partial result (some jars staged) is still uploaded.
+ - name: Upload the reports
+ if: ${{ !cancelled() }}
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
# v7.0.2
+ with:
+ name: cve-scan-jars
+ path: ${{ env.TRIVY_REPORT_DIR }}
+ retention-days: 30
+ if-no-files-found: warn
+
+ # One target per Trino version range. Trino 473 and later need JDK 25, which
Gradle provisions
+ # through its toolchain resolver, as in the Trino integration tests.
+ trino:
+ name: Trino connectors
+ if: github.event_name != 'schedule' || github.repository ==
'apache/gravitino'
+ needs: trivy-db
+ runs-on: ubuntu-latest
+ timeout-minutes: 120
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/setup-java-toolchains
+ - name: Free up disk space
+ run: dev/ci/util_free_space.sh
+ - name: Restore the DB cache
+ uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 #
v5.0.4
+ with:
+ path: ~/.cache/trivy
+ key: ${{ needs.trivy-db.outputs.cache-key }}
+ fail-on-cache-miss: true
+ - name: Pull the Trivy image
+ run: .github/trivy/scan.sh pull
+ - name: Build the connector libraries
+ run: |
+ ./gradlew -PskipWeb=true \
+ :trino-connector:trino-connector-469-472:copyRuntimeLibs \
+ :trino-connector:trino-connector-473-477:copyRuntimeLibs \
+ :trino-connector:trino-connector-478-479:copyRuntimeLibs \
+ :trino-connector:trino-connector-480:copyRuntimeLibs \
+ :trino-connector:trino-connector-481:copyRuntimeLibs \
+ :trino-connector:trino-connector-482-483:copyRuntimeLibs
+ # 6 targets x 10m scan limit = 60m at most, which leaves room for the
build in the 120m job limit.
+ - name: Scan
+ timeout-minutes: 65
+ env:
+ TRIVY_SCAN_TIMEOUT: 10m
+ run: |
+ rc=0
+ for range in 469-472 473-477 478-479 480 481 482-483; do
+ .github/trivy/scan.sh scan "trino-connector-${range}"
"trino-connector/trino-connector-${range}/build/libs" || rc=1
+ done
+ exit "${rc}"
+ - name: Upload the reports
+ if: ${{ !cancelled() }}
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
# v7.0.2
+ with:
+ name: cve-scan-trino
+ path: ${{ env.TRIVY_REPORT_DIR }}
+ retention-days: 30
+ if-no-files-found: warn
+
+ # Lock files that pin what is installed or compiled into a shipped artifact.
Each lock file is
+ # copied into its own directory and scanned as its own target (see
.github/trivy/README.md).
+ lockfiles:
+ name: Lock files
+ if: github.event_name != 'schedule' || github.repository ==
'apache/gravitino'
+ needs: trivy-db
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+ with:
+ persist-credentials: false
+ - name: Restore the DB cache
+ uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 #
v5.0.4
+ with:
+ path: ~/.cache/trivy
+ key: ${{ needs.trivy-db.outputs.cache-key }}
+ fail-on-cache-miss: true
+ - name: Pull the Trivy image
+ run: .github/trivy/scan.sh pull
+ - name: Read the Python version of the project
+ id: python
+ run: |
+ version="$(sed -n 's/^pythonVersion *= *//p' gradle.properties)"
+ [[ -n "${version}" ]] || { echo "::error::pythonVersion not found in
gradle.properties"; exit 1; }
+ echo "version=${version}" >> "${GITHUB_OUTPUT}"
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 #
v7.1.0
+ with:
+ python-version: ${{ steps.python.outputs.version }}
+ # Trivy leaves out the development dependencies of pnpm lock files by
default, so only what
+ # the web UI ships is gated. The Python client is resolved with pip into
concrete versions,
+ # including transitive dependencies, for all extras except dev (see
.github/trivy/README.md).
+ # This is the only step that needs the network besides the DB download.
If the resolution
+ # fails, the other lock files are still staged and scanned, and the step
fails at the end.
+ - name: Stage the lock files
+ id: stage
+ run: |
+ rc=0
+ stage() { mkdir -p "${TARGET_DIR}/$1" && cp "$2" "${TARGET_DIR}/$1/"
|| rc=1; }
+ stage mcp-server mcp-server/uv.lock
+ stage web web/web/pnpm-lock.yaml
+ stage web-v2 web-v2/web/pnpm-lock.yaml
+ .github/trivy/scan.sh stage-python clients/client-python
"${TARGET_DIR}/client-python" || rc=1
+ exit "${rc}"
+ # 4 targets x 3m scan limit = 12m at most.
+ - name: Scan
+ if: ${{ !cancelled() && steps.stage.conclusion != 'skipped' }}
+ timeout-minutes: 15
+ env:
+ TRIVY_SCAN_TIMEOUT: 3m
+ run: .github/trivy/scan.sh scan-all "${TARGET_DIR}" fs
+ - name: Upload the reports
+ if: ${{ !cancelled() }}
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
# v7.0.2
+ with:
+ name: cve-scan-lockfiles
+ path: ${{ env.TRIVY_REPORT_DIR }}
+ retention-days: 30
+ if-no-files-found: warn
+
+ # Fails when an exemption breaks the policy in .github/trivy/README.md. Also
warns (without
+ # failing) about exemptions that matched no finding in any report. After a
failed job some
+ # reports are missing, and the warnings may name exemptions of the targets
that were not scanned.
+ exemptions:
+ name: Exemptions
+ if: ${{ !cancelled() && (github.event_name != 'schedule' ||
github.repository == 'apache/gravitino') }}
+ needs: [trivy-db, server, jars, trino, lockfiles]
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+ with:
+ persist-credentials: false
+ # Needs yq v4 and jq, which are preinstalled on the ubuntu runners.
+ - name: Check the exemption policy
+ run: .github/trivy/scan.sh check-exemptions
+ - name: Download the reports
+ if: ${{ !cancelled() && needs.trivy-db.result == 'success' }}
+ uses:
actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+ with:
+ pattern: cve-scan-*
+ path: ${{ env.TRIVY_REPORT_DIR }}
+ merge-multiple: true
+ - name: Look for exemptions that match nothing
+ if: ${{ !cancelled() && needs.trivy-db.result == 'success' }}
+ run: .github/trivy/scan.sh unused "${TRIVY_REPORT_DIR}"
+
+ # Optional sink: publishes the SARIF reports to GitHub code scanning. It is
the only job with
+ # write access to security events. The reports are available as workflow
artifacts either way,
+ # so a repository without code scanning enabled only gets a warning.
+ code-scanning:
+ name: Upload to code scanning
+ if: ${{ !cancelled() && needs.trivy-db.result == 'success' &&
github.repository == 'apache/gravitino' && github.ref ==
format('refs/heads/{0}', github.event.repository.default_branch) }}
+ needs: [trivy-db, server, jars, trino, lockfiles]
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ permissions:
+ contents: read
+ security-events: write
+ steps:
+ # The checkout lets the SARIF paths resolve against the repository.
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+ with:
+ persist-credentials: false
+ - name: Download the reports
+ uses:
actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+ with:
+ pattern: cve-scan-*
+ path: ${{ env.TRIVY_REPORT_DIR }}
+ merge-multiple: true
+ # Every SARIF run carries a unique automationDetails.id
(trivy/<target>/), which code
+ # scanning uses as the category. Do not set the category input: it would
override those ids.
+ - name: Upload the SARIF reports
+ id: upload
+ continue-on-error: true
+ uses:
github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 #
v4.39.3
+ with:
+ sarif_file: ${{ env.TRIVY_REPORT_DIR }}
+ - name: Report a failed upload
+ if: steps.upload.outcome == 'failure'
+ run: echo "::warning title=Code scanning upload failed::Code scanning
may not be enabled for this repository. The reports are available as workflow
artifacts."
+
+ # Keeps one tracking issue for the scheduled run: a failed run opens or
updates it, the first
+ # passing run closes it (.github/scripts/cve-scan-notify.cjs). Manual runs
are watched by whoever
+ # starts them. This is the only job that can write issues.
+ notify:
+ name: Update the tracking issue
+ if: ${{ !cancelled() && github.event_name == 'schedule' &&
github.repository == 'apache/gravitino' }}
+ needs: [trivy-db, server, jars, trino, lockfiles, exemptions,
code-scanning]
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ permissions:
+ contents: read
+ issues: write
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+ with:
+ persist-credentials: false
+ - name: Open, update or close the tracking issue
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 #
v9.0.0
+ env:
+ NEEDS: ${{ toJSON(needs) }}
+ with:
+ script: await
require('./.github/scripts/cve-scan-notify.cjs').notify({ github, context, core
})
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 37d44fe80d..bbb46e1dd8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -287,6 +287,7 @@ Add or update tests in your PR. Test open PRs locally to
help maintainers.
* Avoid unnecessary dependencies
* Prefer well-maintained libraries
* Discuss major additions on dev@
+* Known vulnerabilities in shipped artifacts are scanned weekly with Trivy;
see [.github/trivy/README.md](.github/trivy/README.md) for how to run the scan
locally and how to add an exemption
## 🛡️ Performing Compliance and Legal Checks