Skip to content

Jenkinsfile: add workaround for CVE-2022-24765#43485

Merged
tianon merged 1 commit intomoby:masterfrom
thaJeztah:fix_dco_check
Apr 13, 2022
Merged

Jenkinsfile: add workaround for CVE-2022-24765#43485
tianon merged 1 commit intomoby:masterfrom
thaJeztah:fix_dco_check

Conversation

@thaJeztah
Copy link
Member

relates to #43477 (comment)

git published an advisory Yesterday, which (as a counter-measure)
requires the git repository's directory to be owned by the current
user, and otherwise produce an error:

fatal: unsafe repository ('/workspace' is owned by someone else)
To add an exception for this directory, call:

    git config --global --add safe.directory /workspace

The DCO check is run within a container, which is running as root
(to allow packages to be installed), but because of this, the user
does not match the files that are bind-mounted from the host (as they
are checked out by Jenkins, using a different user).

To work around this issue, this patch configures git to consider the
/workspace directory as "safe". We configure it in the --system
configuration so that it takes effect for "all users" inside the
container.

More details on the advisory can be found on GitHub's blog:
https://github.blog/2022-04-12-git-security-vulnerability-announced/

- A picture of a cute animal (not mandatory but encouraged)

git published an advisory Yesterday, which (as a counter-measure)
requires the git repository's directory to be owned by the current
user, and otherwise produce an error:

    fatal: unsafe repository ('/workspace' is owned by someone else)
    To add an exception for this directory, call:

        git config --global --add safe.directory /workspace

The DCO check is run within a container, which is running as `root`
(to allow packages to be installed), but because of this, the user
does not match the files that are bind-mounted from the host (as they
are checked out by Jenkins, using a different user).

To work around this issue, this patch configures git to consider the
`/workspace` directory as "safe". We configure it in the `--system`
configuration so that it takes effect for "all users" inside the
container.

More details on the advisory can be found on GitHub's blog:
https://github.blog/2022-04-12-git-security-vulnerability-announced/

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@tianon tianon merged commit c110770 into moby:master Apr 13, 2022
@thaJeztah thaJeztah deleted the fix_dco_check branch April 13, 2022 21:17
@AkihiroSuda
Copy link
Member

Wondering we could propose the git to allow root-owned directories exceptionally.

@thaJeztah
Copy link
Member Author

Perhaps not a bad idea.

(that said, in this specific case, we shouldn't require root, it's just that we need it because we are ad-hoc installing things in the container)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants