Compare commits

...

10 commits

Author SHA1 Message Date
Tim Thacker
113c031357
Merge 753c372d87 into d018ae7711 2025-01-02 17:24:43 +00:00
renovate[bot]
d018ae7711
chore(deps): update prom/prometheus docker tag to v3.1.0 (#33375)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-02 16:41:03 +00:00
renovate[bot]
3eb405d9ed
chore(deps): update dependency @swc/core to v1.10.2 (#33374)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-02 16:40:45 +00:00
Michael Kriese
e811b23df5
fix(platform): ensure order for cached pr's on gitea and bitbucket (#33373) 2025-01-02 16:39:43 +00:00
Tobias Bieniek
5390390b7d
feat(presets): Add axum monorepo (#33362)
Some checks are pending
Build / setup (push) Waiting to run
Build / setup-build (push) Waiting to run
Build / prefetch (push) Blocked by required conditions
Build / lint-eslint (push) Blocked by required conditions
Build / lint-prettier (push) Blocked by required conditions
Build / lint-docs (push) Blocked by required conditions
Build / lint-other (push) Blocked by required conditions
Build / (push) Blocked by required conditions
Build / codecov (push) Blocked by required conditions
Build / coverage-threshold (push) Blocked by required conditions
Build / test-success (push) Blocked by required conditions
Build / build (push) Blocked by required conditions
Build / build-docs (push) Blocked by required conditions
Build / test-e2e (push) Blocked by required conditions
Build / release (push) Blocked by required conditions
Code scanning / CodeQL-Build (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
whitesource-scan / WS_SCAN (push) Waiting to run
2025-01-02 08:01:58 +00:00
renovate[bot]
351db7750e
chore(deps): update dependency markdownlint-cli2 to v0.17.0 (#33365)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-02 04:33:52 +00:00
Janus Troelsen
1caffcc310
feat(vulnerabilities): Add Hackage support (#33328)
Some checks are pending
Build / setup (push) Waiting to run
Build / setup-build (push) Waiting to run
Build / prefetch (push) Blocked by required conditions
Build / lint-eslint (push) Blocked by required conditions
Build / lint-prettier (push) Blocked by required conditions
Build / lint-docs (push) Blocked by required conditions
Build / lint-other (push) Blocked by required conditions
Build / (push) Blocked by required conditions
Build / codecov (push) Blocked by required conditions
Build / coverage-threshold (push) Blocked by required conditions
Build / test-success (push) Blocked by required conditions
Build / build (push) Blocked by required conditions
Build / build-docs (push) Blocked by required conditions
Build / test-e2e (push) Blocked by required conditions
Build / release (push) Blocked by required conditions
Code scanning / CodeQL-Build (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
whitesource-scan / WS_SCAN (push) Waiting to run
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-01-01 21:17:44 +00:00
renovate[bot]
dd903881c6
build(deps): update dependency @renovatebot/osv-offline to v1.5.11 (#33364)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-01 20:52:14 +00:00
renovate[bot]
bea61f528b
chore(deps): update dependency type-fest to v4.31.0 (#33363)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-01 18:54:00 +00:00
Tim Thacker
753c372d87 clone git submodules with env vars from getGitEnvironmentVariables 2024-10-08 04:10:17 +11:00
13 changed files with 566 additions and 130 deletions

View file

@ -2426,6 +2426,7 @@ Renovate only queries the OSV database for dependencies that use one of these da
- [`crate`](./modules/datasource/crate/index.md) - [`crate`](./modules/datasource/crate/index.md)
- [`go`](./modules/datasource/go/index.md) - [`go`](./modules/datasource/go/index.md)
- [`hackage`](./modules/datasource/hackage/index.md)
- [`hex`](./modules/datasource/hex/index.md) - [`hex`](./modules/datasource/hex/index.md)
- [`maven`](./modules/datasource/maven/index.md) - [`maven`](./modules/datasource/maven/index.md)
- [`npm`](./modules/datasource/npm/index.md) - [`npm`](./modules/datasource/npm/index.md)

View file

@ -22,7 +22,7 @@ services:
# Prometheus for storing metrics # Prometheus for storing metrics
prometheus: prometheus:
image: prom/prometheus:v3.0.1 image: prom/prometheus:v3.1.0
ports: ports:
- '9090:9090' # Web UI - '9090:9090' # Web UI
- '4318' # OTLP HTTP - '4318' # OTLP HTTP

View file

@ -55,6 +55,7 @@
"https://github.com/awslabs/aws-sdk-rust" "https://github.com/awslabs/aws-sdk-rust"
], ],
"awsappsync": "https://github.com/awslabs/aws-mobile-appsync-sdk-js", "awsappsync": "https://github.com/awslabs/aws-mobile-appsync-sdk-js",
"axum": "https://github.com/tokio-rs/axum",
"azure-functions-dotnet-worker": "https://github.com/Azure/azure-functions-dotnet-worker", "azure-functions-dotnet-worker": "https://github.com/Azure/azure-functions-dotnet-worker",
"azure azure-libraries-for-net": "https://github.com/Azure/azure-libraries-for-net", "azure azure-libraries-for-net": "https://github.com/Azure/azure-libraries-for-net",
"azure azure-sdk-for-net": "https://github.com/Azure/azure-sdk-for-net", "azure azure-sdk-for-net": "https://github.com/Azure/azure-sdk-for-net",

View file

@ -166,8 +166,8 @@ describe('modules/platform/bitbucket/pr-cache', () => {
); );
expect(res).toMatchObject([ expect(res).toMatchObject([
{ number: 1, title: 'title' },
{ number: 2, title: 'title' }, { number: 2, title: 'title' },
{ number: 1, title: 'title' },
]); ]);
expect(cache).toEqual({ expect(cache).toEqual({
httpCache: {}, httpCache: {},

View file

@ -11,6 +11,7 @@ import type { BitbucketPrCacheData, PagedResult, PrResponse } from './types';
import { prFieldsFilter, prInfo, prStates } from './utils'; import { prFieldsFilter, prInfo, prStates } from './utils';
export class BitbucketPrCache { export class BitbucketPrCache {
private items: Pr[] = [];
private cache: BitbucketPrCacheData; private cache: BitbucketPrCacheData;
private constructor( private constructor(
@ -41,6 +42,7 @@ export class BitbucketPrCache {
} }
repoCache.platform.bitbucket.pullRequestsCache = pullRequestCache; repoCache.platform.bitbucket.pullRequestsCache = pullRequestCache;
this.cache = pullRequestCache; this.cache = pullRequestCache;
this.updateItems();
} }
private static async init( private static async init(
@ -62,7 +64,7 @@ export class BitbucketPrCache {
} }
private getPrs(): Pr[] { private getPrs(): Pr[] {
return Object.values(this.cache.items); return this.items;
} }
static async getPrs( static async getPrs(
@ -77,6 +79,7 @@ export class BitbucketPrCache {
private setPr(pr: Pr): void { private setPr(pr: Pr): void {
logger.debug(`Adding PR #${pr.number} to the PR cache`); logger.debug(`Adding PR #${pr.number} to the PR cache`);
this.cache.items[pr.number] = pr; this.cache.items[pr.number] = pr;
this.updateItems();
} }
static async setPr( static async setPr(
@ -161,6 +164,16 @@ export class BitbucketPrCache {
}, },
`PR cache sync finished`, `PR cache sync finished`,
); );
this.updateItems();
return this; return this;
} }
/**
* Ensure the pr cache starts with the most recent PRs.
* JavaScript ensures that the cache is sorted by PR number.
*/
private updateItems(): void {
this.items = Object.values(this.cache.items).reverse();
}
} }

View file

@ -1166,10 +1166,10 @@ describe('modules/platform/gitea/index', () => {
const res = await gitea.getPrList(); const res = await gitea.getPrList();
expect(res).toMatchObject([ expect(res).toMatchObject([
{ number: 1, title: 'Some PR' },
{ number: 2, title: 'Other PR' },
{ number: 3, title: 'Draft PR' },
{ number: 4, title: 'Merged PR' }, { number: 4, title: 'Merged PR' },
{ number: 3, title: 'Draft PR' },
{ number: 2, title: 'Other PR' },
{ number: 1, title: 'Some PR' },
]); ]);
}); });
@ -1209,10 +1209,10 @@ describe('modules/platform/gitea/index', () => {
const res = await gitea.getPrList(); const res = await gitea.getPrList();
expect(res).toMatchObject([ expect(res).toMatchObject([
{ number: 1, title: 'Some PR' },
{ number: 2, title: 'Other PR' },
{ number: 3, title: 'Draft PR' },
{ number: 4, title: 'Merged PR' }, { number: 4, title: 'Merged PR' },
{ number: 3, title: 'Draft PR' },
{ number: 2, title: 'Other PR' },
{ number: 1, title: 'Some PR' },
]); ]);
}); });
@ -1244,16 +1244,16 @@ describe('modules/platform/gitea/index', () => {
await initFakeRepo(scope); await initFakeRepo(scope);
const res1 = await gitea.getPrList(); const res1 = await gitea.getPrList();
expect(res1).toMatchObject([{ number: 1 }, { number: 2 }]); expect(res1).toMatchObject([{ number: 2 }, { number: 1 }]);
memCache.set('gitea-pr-cache-synced', false); memCache.set('gitea-pr-cache-synced', false);
const res2 = await gitea.getPrList(); const res2 = await gitea.getPrList();
expect(res2).toMatchObject([ expect(res2).toMatchObject([
{ number: 1 },
{ number: 2 },
{ number: 3 },
{ number: 4 }, { number: 4 },
{ number: 3 },
{ number: 2 },
{ number: 1 },
]); ]);
}); });
}); });

View file

@ -11,6 +11,7 @@ import { API_PATH, toRenovatePR } from './utils';
export class GiteaPrCache { export class GiteaPrCache {
private cache: GiteaPrCacheData; private cache: GiteaPrCacheData;
private items: Pr[] = [];
private constructor( private constructor(
private repo: string, private repo: string,
@ -31,6 +32,7 @@ export class GiteaPrCache {
} }
repoCache.platform.gitea.pullRequestsCache = pullRequestCache; repoCache.platform.gitea.pullRequestsCache = pullRequestCache;
this.cache = pullRequestCache; this.cache = pullRequestCache;
this.updateItems();
} }
static forceSync(): void { static forceSync(): void {
@ -54,7 +56,7 @@ export class GiteaPrCache {
} }
private getPrs(): Pr[] { private getPrs(): Pr[] {
return Object.values(this.cache.items); return this.items;
} }
static async getPrs( static async getPrs(
@ -68,6 +70,7 @@ export class GiteaPrCache {
private setPr(item: Pr): void { private setPr(item: Pr): void {
this.cache.items[item.number] = item; this.cache.items[item.number] = item;
this.updateItems();
} }
static async setPr( static async setPr(
@ -137,6 +140,16 @@ export class GiteaPrCache {
url = parseLinkHeader(res.headers.link)?.next?.url; url = parseLinkHeader(res.headers.link)?.next?.url;
} }
this.updateItems();
return this; return this;
} }
/**
* Ensure the pr cache starts with the most recent PRs.
* JavaScript ensures that the cache is sorted by PR number.
*/
private updateItems(): void {
this.items = Object.values(this.cache.items).reverse();
}
} }

View file

@ -55,6 +55,7 @@ import type {
StorageConfig, StorageConfig,
TreeItem, TreeItem,
} from './types'; } from './types';
import { getGitEnvironmentVariables } from './auth';
export { setNoVerify } from './config'; export { setNoVerify } from './config';
export { setPrivateKey } from './private-key'; export { setPrivateKey } from './private-key';
@ -353,6 +354,13 @@ export async function cloneSubmodules(
return; return;
} }
submodulesInitizialized = true; submodulesInitizialized = true;
const gitSubmoduleAuthEnvironmentVariables = getGitEnvironmentVariables();
const gitEnv = {
// pass all existing env variables
...process.env,
// add all known git variables
...gitSubmoduleAuthEnvironmentVariables,
};
await syncGit(); await syncGit();
const submodules = await getSubmodules(); const submodules = await getSubmodules();
for (const submodule of submodules) { for (const submodule of submodules) {
@ -366,7 +374,7 @@ export async function cloneSubmodules(
try { try {
logger.debug(`Cloning git submodule at ${submodule}`); logger.debug(`Cloning git submodule at ${submodule}`);
await gitRetry(() => await gitRetry(() =>
git.submoduleUpdate(['--init', '--recursive', submodule]), git.env(gitEnv).submoduleUpdate(['--init', '--recursive', submodule]),
); );
} catch (err) { } catch (err) {
logger.warn( logger.warn(

View file

@ -47,7 +47,7 @@ export function getFixedVersionByDatasource(
return `[${fixedVersion},)`; return `[${fixedVersion},)`;
} }
// crates.io, Go, Hex, npm, RubyGems, PyPI // crates.io, Go, Hackage, Hex, npm, RubyGems, PyPI
return `>= ${fixedVersion}`; return `>= ${fixedVersion}`;
} }

View file

@ -840,6 +840,63 @@ describe('workers/repository/process/vulnerabilities', () => {
]); ]);
}); });
it('returns packageRules for Hackage', async () => {
const packageFiles: Record<string, PackageFile[]> = {
hackage: [
{
deps: [
{
depName: 'aeson',
currentValue: '0.4.0.0',
datasource: 'hackage',
},
],
packageFile: 'some-file',
},
],
};
getVulnerabilitiesMock.mockResolvedValueOnce([
{
id: 'HSEC-2023-0001',
summary: 'Hash flooding vulnerability in aeson',
details:
'# Hash flooding vulnerability in aeson\n\n*aeson* was vulnerable to hash flooding (a.k.a. hash DoS). The\nissue is a consequence of the HashMap implementation from\n*unordered-containers*. It results in a denial of service through\nCPU consumption. This technique has been used in real-world attacks\nagainst a variety of languages, libraries and frameworks over the\nyears.\n',
aliases: ['CVE-2022-3433'],
modified: '2023-06-13T09:03:52Z',
affected: [
{
package: {
ecosystem: 'Hackage',
name: 'aeson',
},
ranges: [
{
type: 'ECOSYSTEM',
events: [{ introduced: '0.4.0.0' }, { fixed: '2.0.1.0' }],
},
],
},
],
},
]);
await vulnerabilities.appendVulnerabilityPackageRules(
config,
packageFiles,
);
expect(config.packageRules).toHaveLength(1);
expect(config.packageRules).toMatchObject([
{
matchDatasources: ['hackage'],
matchPackageNames: ['aeson'],
matchCurrentVersion: '0.4.0.0',
allowedVersions: '>= 2.0.1.0',
isVulnerabilityAlert: true,
},
]);
});
it('filters not applicable vulnerability based on last_affected version', async () => { it('filters not applicable vulnerability based on last_affected version', async () => {
const packageFiles: Record<string, PackageFile[]> = { const packageFiles: Record<string, PackageFile[]> = {
poetry: [ poetry: [

View file

@ -35,6 +35,7 @@ export class Vulnerabilities {
> = { > = {
crate: 'crates.io', crate: 'crates.io',
go: 'Go', go: 'Go',
hackage: 'Hackage',
hex: 'Hex', hex: 'Hex',
maven: 'Maven', maven: 'Maven',
npm: 'npm', npm: 'npm',

View file

@ -164,7 +164,7 @@
"@qnighy/marshal": "0.1.3", "@qnighy/marshal": "0.1.3",
"@renovatebot/detect-tools": "1.1.0", "@renovatebot/detect-tools": "1.1.0",
"@renovatebot/kbpgp": "4.0.1", "@renovatebot/kbpgp": "4.0.1",
"@renovatebot/osv-offline": "1.5.10", "@renovatebot/osv-offline": "1.5.11",
"@renovatebot/pep440": "4.0.1", "@renovatebot/pep440": "4.0.1",
"@renovatebot/ruby-semver": "4.0.0", "@renovatebot/ruby-semver": "4.0.0",
"@sindresorhus/is": "4.6.0", "@sindresorhus/is": "4.6.0",
@ -269,7 +269,7 @@
"@openpgp/web-stream-tools": "0.1.3", "@openpgp/web-stream-tools": "0.1.3",
"@renovate/eslint-plugin": "file:tools/eslint", "@renovate/eslint-plugin": "file:tools/eslint",
"@semantic-release/exec": "6.0.3", "@semantic-release/exec": "6.0.3",
"@swc/core": "1.10.1", "@swc/core": "1.10.2",
"@types/auth-header": "1.0.6", "@types/auth-header": "1.0.6",
"@types/aws4": "1.11.6", "@types/aws4": "1.11.6",
"@types/better-sqlite3": "7.6.12", "@types/better-sqlite3": "7.6.12",
@ -335,7 +335,7 @@
"jest-mock": "29.7.0", "jest-mock": "29.7.0",
"jest-mock-extended": "3.0.7", "jest-mock-extended": "3.0.7",
"jest-snapshot": "29.7.0", "jest-snapshot": "29.7.0",
"markdownlint-cli2": "0.16.0", "markdownlint-cli2": "0.17.0",
"memfs": "4.15.1", "memfs": "4.15.1",
"nock": "13.5.6", "nock": "13.5.6",
"npm-run-all2": "7.0.2", "npm-run-all2": "7.0.2",
@ -347,7 +347,7 @@
"tmp-promise": "3.0.3", "tmp-promise": "3.0.3",
"ts-jest": "29.2.5", "ts-jest": "29.2.5",
"ts-node": "10.9.2", "ts-node": "10.9.2",
"type-fest": "4.30.2", "type-fest": "4.31.0",
"typescript": "5.7.2", "typescript": "5.7.2",
"unified": "9.2.2" "unified": "9.2.2"
}, },

File diff suppressed because it is too large Load diff