Skip to content

Conversation

@jamietanna
Copy link
Contributor

Changes

We recently introduced the ability for self-hosted administrators to
control execution of possibly unsafe commands with
allowedUnsafeExecutions.

An existing attack vector of Gradle Wrapper commands being executed
(i.e. for Verification Metadata or lockfile updates) needs to be
retrofit into allowedUnsafeExecutions as part of #39657.

This will be kept on-by-default until the next breaking change, after
which self-hosted administrators will be able to opt-in to enabling this
functionality is required.

Context

Please select one of the following:

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

Warning

TODO

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository:

We recently introduced the ability for self-hosted administrators to
control execution of possibly unsafe commands with
`allowedUnsafeExecutions`.

An existing attack vector of Gradle Wrapper commands being executed
(i.e. for Verification Metadata or lockfile updates) needs to be
retrofit into `allowedUnsafeExecutions` as part of #39657.

This will be kept on-by-default until the next breaking change, after
which self-hosted administrators will be able to opt-in to enabling this
functionality is required.
Comment on lines +80 to +86
if (!isGradleExecutionAllowed(cmd)) {
logger.trace(
'Not allowed to execute gradle due to allowedUnsafeExecutions - aborting update',
);
return subprojects;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage checks aren't happy here - we don't currently test this directly (as it's not exported) and right now it's not called unless isGradleExecutionAllowed === true

But I didn't want to leave it "at risk" of not having it set

import os from 'node:os';
import upath from 'upath';
import { mockDeep } from 'vitest-mock-extended';
import { globalConfig } from 'zod/v4/core';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { globalConfig } from 'zod/v4/core';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add allowedUnsafeExecution for ./gradlew

2 participants