Visitar URL original
Enforce safe directory by thboop · Pull Request #762 · actions/checkout · GitHub
Skip to content

Enforce safe directory - #762

Merged
thboop merged 2 commits into
mainfrom
thboop/fixSafeDirectory
Apr 14, 2022
Merged

thboop merged 2 commits into
mainfrom
thboop/fixSafeDirectory

Conversation

@thboop

@thboop thboop commented Apr 13, 2022 •

Copy link
Copy Markdown
Contributor

This pr fixes #760 by setting the repositories path as a safe directory when running checkout and removing that config on cleanup.

We aren't able to set it as a local config, as this setting only works for global configs.

So, using the standard we used for submodules, lets go ahead and copy the existing global config to a new location. Then we can go ahead and modify that global config (so we don't modify like a users global config if they test something on a self hosted runner real fast). Then, we can delete that global config at the end of the checkout step.

This does carry some limitations, it doesn't persist this configuration for the duration of the job mainly. So if your job pushes to git or something after checkout, that will continue to fail. We need to figure out how to address this at an ecosystem level, outside of the checkout action.

Comment thread src/git-source-provider.ts Resolved
Comment thread src/git-command-manager.ts Resolved
Comment thread src/git-source-provider.ts Resolved
Comment thread src/git-source-provider.ts Resolved
'removeGlobalConfig removes override'
it(removeGlobalConfig_removesOverride, async () => {
// Arrange
await setup(removeGlobalAuth_removesOverride)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed this function, changes are a result of that

Comment thread src/git-source-provider.ts Resolved
Comment thread src/git-auth-helper.ts Resolved
Comment thread src/git-source-provider.ts Resolved
@cbalioglu

ghost commented Apr 13, 2022

Copy link
Copy Markdown

@thboop thanks a lot for taking quick action! Do you have an ETA on when you plan to land this fix?

Comment thread src/git-auth-helper.ts Resolved
Comment thread src/git-auth-helper.ts Resolved
Comment thread src/git-auth-helper.ts Resolved
Comment thread src/git-auth-helper.ts Resolved
Comment thread src/git-source-provider.ts Resolved
Comment thread src/git-source-provider.ts Resolved
Comment thread src/git-source-provider.ts Resolved
Comment thread src/git-auth-helper.ts Resolved
Comment thread src/git-auth-helper.ts Resolved
@thboop
thboop force-pushed the thboop/fixSafeDirectory branch from c940690 to 5c1bbe6 Compare April 14, 2022 15:18
@thboop
thboop force-pushed the thboop/fixSafeDirectory branch from 5c1bbe6 to 55fd82f Compare April 14, 2022 15:20
@thboop thboop mentioned this pull request Apr 14, 2022
@mathomp4 mathomp4 mentioned this pull request Jul 7, 2022
3 of 7 tasks
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.

fatal: unsafe repository (REPO is owned by someone else) with ubuntu 20.04 container

5 participants