Skip to content

Commit 1375c93

Browse files
committed
Merge tag 'v0.68.2' into ajk/chore/merge-upstream-0.68.2
2 parents c14c35d + 0c40a8d commit 1375c93

File tree

713 files changed

+17129
-22133
lines changed

Some content is hidden

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

713 files changed

+17129
-22133
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ pkg/sbom/ @knqyf263 @DmitriyLewen
88
pkg/scanner/ @knqyf263 @DmitriyLewen
99

1010
# Misconfiguration scanning
11-
docs/docs/scanner/misconfiguration/ @simar7 @nikpivkin
12-
docs/docs/target/aws.md @simar7 @nikpivkin
13-
pkg/fanal/analyzer/config/ @simar7 @nikpivkin
14-
pkg/cloud/ @simar7 @nikpivkin
15-
pkg/iac/ @simar7 @nikpivkin
11+
docs/guide/scanner/misconfiguration/ @simar7 @nikpivkin
12+
docs/guide/target/aws.md @simar7 @nikpivkin
13+
pkg/fanal/analyzer/config/ @simar7 @nikpivkin
14+
pkg/config/aws/ @simar7 @nikpivkin
15+
pkg/iac/ @simar7 @nikpivkin
1616

1717
# Helm chart
1818
helm/trivy/ @afdesk @simar7
1919

2020
# Kubernetes scanning
2121
pkg/k8s/ @afdesk @simar7
22-
docs/docs/target/kubernetes.md @afdesk @simar7
22+
docs/guide/target/kubernetes.md @afdesk @simar7

.github/DISCUSSION_TEMPLATE/bugs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ body:
1010
1111
**Do not open a GitHub issue, please.** Maintainers triage discussions and then create issues.
1212
13-
Please also check [our contribution guidelines](https://trivy.dev/latest/community/contribute/discussion/).
13+
Please also check [our contribution guidelines](https://trivy.dev/docs/latest/community/contribute/discussion/).
1414
- type: textarea
1515
attributes:
1616
label: Description
@@ -117,7 +117,7 @@ body:
117117
description: Have you tried the following?
118118
options:
119119
- label: Run `trivy clean --all`
120-
- label: Read [the troubleshooting](https://trivy.dev/latest/docs/references/troubleshooting/)
120+
- label: Read [the troubleshooting](https://trivy.dev/docs/latest/references/troubleshooting/)
121121
- type: markdown
122122
attributes:
123123
value: |

.github/DISCUSSION_TEMPLATE/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ body:
77
Feel free to create a docs report if something doesn't work as expected or is unclear in the documentation.
88
Please ensure that you're not creating a duplicate report by searching the [issues](https://github.com/aquasecurity/trivy/issues)/[discussions](https://github.com/aquasecurity/trivy/discussions) beforehand.
99
10-
Please also check [our contribution guidelines](https://trivy.dev/latest/community/contribute/discussion/).
10+
Please also check [our contribution guidelines](https://trivy.dev/docs/latest/community/contribute/discussion/).
1111
- type: textarea
1212
attributes:
1313
label: Description

.github/DISCUSSION_TEMPLATE/false-detection.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ body:
88
99
**Do not open a GitHub issue, please.** Maintainers triage discussions and then create issues.
1010
11-
Please also check [our contribution guidelines](https://trivy.dev/latest/community/contribute/discussion/).
11+
Please also check [our contribution guidelines](https://trivy.dev/docs/latest/community/contribute/discussion/).
1212
- type: input
1313
attributes:
1414
label: IDs

.github/DISCUSSION_TEMPLATE/ideas.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
1010
**Do not open a GitHub issue, please.** Maintainers triage discussions and then create issues.
1111
12-
Please also check [our contribution guidelines](https://trivy.dev/latest/community/contribute/discussion/).
12+
Please also check [our contribution guidelines](https://trivy.dev/docs/latest/community/contribute/discussion/).
1313
- type: textarea
1414
attributes:
1515
label: Description

.github/DISCUSSION_TEMPLATE/q-a.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
1010
**Do not open a GitHub issue, please.** Maintainers triage discussions and then create issues.
1111
12-
Please also check [our contribution guidelines](https://trivy.dev/latest/community/contribute/discussion/).
12+
Please also check [our contribution guidelines](https://trivy.dev/docs/latest/community/contribute/discussion/).
1313
- type: textarea
1414
attributes:
1515
label: Question

.github/ISSUE_TEMPLATE/maintainer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ assignees: ''
88
---
99

1010
## Are you a maintainer of the Trivy project?
11-
If not, please open [a discussion](https://github.com/aquasecurity/trivy/discussions); if you are, please review [the guideline](https://trivy.dev/latest/community/contribute/discussion/).
11+
If not, please open [a discussion](https://github.com/aquasecurity/trivy/discussions); if you are, please review [the guideline](https://trivy.dev/docs/latest/community/contribute/discussion/).

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
Remove this section if you don't have related PRs.
1111

1212
## Checklist
13-
- [ ] I've read the [guidelines for contributing](https://trivy.dev/latest/community/contribute/pr/) to this repository.
14-
- [ ] I've followed the [conventions](https://trivy.dev/latest/community/contribute/pr/#title) in the PR title.
13+
- [ ] I've read the [guidelines for contributing](https://trivy.dev/docs/latest/community/contribute/pr/) to this repository.
14+
- [ ] I've followed the [conventions](https://trivy.dev/docs/latest/community/contribute/pr/#title) in the PR title.
1515
- [ ] I've added tests that prove my fix is effective or that my feature works.
1616
- [ ] I've updated the [documentation](https://github.com/aquasecurity/trivy/blob/main/docs) with the relevant information (if needed).
1717
- [ ] I've added usage information (if the PR introduces new options)

.github/workflows/apidiff.yaml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: API Diff Check
2+
3+
on:
4+
# SECURITY: Using pull_request_target to support fork PRs with write permissions.
5+
# PR code is checked out but only for static analysis - it is never executed.
6+
# If modifying this workflow, ensure PR code is never executed and user inputs are not used unsafely.
7+
pull_request_target:
8+
types: [opened, synchronize]
9+
paths:
10+
- 'pkg/**/*.go'
11+
- 'rpc/**/*.go'
12+
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
issues: write
17+
18+
jobs:
19+
apidiff:
20+
runs-on: ubuntu-24.04
21+
name: API Diff Check
22+
steps:
23+
# Check if PR has conflicts. When conflicts exist, the merge commit becomes
24+
# frozen at an old state and apidiff cannot run correctly.
25+
- name: Check for merge conflicts
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
PR_NUMBER: ${{ github.event.pull_request.number }}
29+
# pull_request_target and mergeability are processed asynchronously.
30+
# As a result, it’s possible that we start the check before GitHub has finished calculating the mergeability.
31+
# To handle this, a retry mechanism has been added — it waits for 2 seconds after each attempt.
32+
# If mergeable_state isn’t obtained after 5 attempts, an error is returned.
33+
run: |
34+
MAX=5
35+
for i in $(seq 1 "$MAX"); do
36+
state=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq .mergeable_state)
37+
echo "mergeable_state=$state"
38+
39+
if [ "$state" = "dirty" ]; then
40+
echo "::error::This PR has merge conflicts. Please resolve conflicts before running apidiff."
41+
exit 1
42+
fi
43+
44+
if [ -n "$state" ] && [ "$state" != "unknown" ] && [ "$state" != "null" ]; then
45+
break
46+
fi
47+
48+
if [ "$i" -lt "$MAX" ] && { [ -z "$state" ] || [ "$state" = "unknown" ] || [ "$state" = "null" ]; }; then
49+
echo "::error::Could not determine mergeability after $i tries."
50+
exit 1
51+
fi
52+
53+
sleep 2
54+
done
55+
56+
# Checkout PR merge commit to compare against base branch
57+
# This ensures we compare the actual merge result with the base branch,
58+
# avoiding false positives when PR is not rebased with latest main
59+
- name: Checkout
60+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
61+
with:
62+
ref: refs/pull/${{ github.event.pull_request.number }}/merge
63+
64+
- name: Set up Go
65+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
66+
with:
67+
go-version-file: go.mod
68+
check-latest: true # Ensure we use the latest Go patch version
69+
cache: false
70+
71+
# Ensure the base commit exists locally for go-apidiff to compare against.
72+
# Even though we checkout the merge commit, go-apidiff needs the base ref to exist.
73+
# Use base.ref instead of base.sha, since base.sha is outdated (not updated after every commit).
74+
# cf. https://github.com/orgs/community/discussions/59677
75+
- name: Fetch base commit
76+
id: fetch_base
77+
run: |
78+
set -euo pipefail
79+
BASE_REF="${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}"
80+
if [ -z "${BASE_REF:-}" ]; then
81+
echo "::error::BASE_REF is empty (no base ref in event payload)"; exit 1
82+
fi
83+
84+
git fetch --depth=1 origin "$BASE_REF"
85+
86+
BASE_SHA="$(git rev-parse "origin/$BASE_REF")"
87+
if [ -z "${BASE_SHA:-}" ]; then
88+
echo "::error::BASE_SHA is empty (failed to resolve origin/$BASE_REF)"; exit 1
89+
fi
90+
echo "base_sha=$BASE_SHA" >> "$GITHUB_OUTPUT"
91+
92+
# NOTE: go-apidiff is not managed in go.mod because installing it via `go get -tool`
93+
# would cause `mage tool:install` to attempt building it on Windows, which currently
94+
# fails due to platform-specific issues.
95+
- name: Run go-apidiff
96+
id: apidiff
97+
continue-on-error: true
98+
uses: joelanford/go-apidiff@60c4206be8f84348ebda2a3e0c3ac9cb54b8f685 # v0.8.3
99+
with:
100+
base-ref: ${{ steps.fetch_base.outputs.base_sha }}
101+
version: v0.8.3
102+
103+
- name: Add apidiff label
104+
if: ${{ steps.apidiff.outputs.semver-type == 'major' }}
105+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
106+
with:
107+
script: |
108+
const label = 'apidiff';
109+
await github.rest.issues.addLabels({
110+
owner: context.repo.owner,
111+
repo: context.repo.repo,
112+
issue_number: context.issue.number,
113+
labels: [label],
114+
});
115+
116+
- name: Comment API diff
117+
if: ${{ steps.apidiff.outputs.semver-type == 'major' }}
118+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
119+
env:
120+
APIDIFF_OUTPUT: ${{ steps.apidiff.outputs.output }}
121+
SEMVER_TYPE: ${{ steps.apidiff.outputs.semver-type }}
122+
with:
123+
script: |
124+
const header = '## 📊 API Changes Detected';
125+
const diff = process.env.APIDIFF_OUTPUT.trim();
126+
const semver = process.env.SEMVER_TYPE || 'unknown';
127+
const body = [
128+
header,
129+
'',
130+
`Semver impact: \`${semver}\``,
131+
'',
132+
'```',
133+
diff,
134+
'```',
135+
].join('\n');
136+
137+
const { data: comments } = await github.rest.issues.listComments({
138+
owner: context.repo.owner,
139+
repo: context.repo.repo,
140+
issue_number: context.issue.number,
141+
});
142+
143+
const existing = comments.find(comment =>
144+
comment.user.type === 'Bot' &&
145+
comment.body.startsWith(header),
146+
);
147+
148+
if (existing) {
149+
await github.rest.issues.updateComment({
150+
owner: context.repo.owner,
151+
repo: context.repo.repo,
152+
comment_id: existing.id,
153+
body,
154+
});
155+
} else {
156+
await github.rest.issues.createComment({
157+
owner: context.repo.owner,
158+
repo: context.repo.repo,
159+
issue_number: context.issue.number,
160+
body,
161+
});
162+
}
163+
164+
# Attempt to request the premium reviewers; needs org-scoped token because GITHUB_TOKEN lacks read:org.
165+
- name: Request trivy-premium review
166+
if: ${{ steps.apidiff.outputs.semver-type == 'major' }}
167+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
168+
with:
169+
github-token: ${{ secrets.ORG_REPO_TOKEN }}
170+
script: |
171+
try {
172+
await github.rest.pulls.requestReviewers({
173+
owner: context.repo.owner,
174+
repo: context.repo.repo,
175+
pull_number: context.issue.number,
176+
team_reviewers: ['trivy-premium'],
177+
});
178+
console.log('Requested review from aquasecurity/trivy-premium team');
179+
} catch (error) {
180+
core.error(`Failed to request trivy-premium reviewers: ${error.message}`);
181+
throw error;
182+
}

.github/workflows/auto-close-issue.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Close issue if user does not have write or admin permissions
12-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
12+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
1313
with:
1414
script: |
1515
// Get the issue creator's username
@@ -26,7 +26,7 @@ jobs:
2626
2727
// If the user does not have write or admin permissions, leave a comment and close the issue
2828
if (permission !== 'write' && permission !== 'admin') {
29-
const commentBody = "Please see https://trivy.dev/latest/community/contribute/issue/";
29+
const commentBody = "Please see https://trivy.dev/docs/latest/community/contribute/issue/";
3030
await github.rest.issues.createComment({
3131
owner: context.repo.owner,
3232
repo: context.repo.repo,

0 commit comments

Comments
 (0)