Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osfs: Add new BoundOS type #31

Merged
merged 2 commits into from
Aug 25, 2023
Merged

osfs: Add new BoundOS type #31

merged 2 commits into from
Aug 25, 2023

Conversation

pjbgf
Copy link
Member

@pjbgf pjbgf commented Aug 17, 2023

Create the new BoundOS osfs type, which works as a pass-through filesystem for files descending from base dir.

For backwards compatibility the previous behaviour is still the default and is now represented by the ChrootOS type.

@pjbgf pjbgf force-pushed the new-osfs branch 4 times, most recently from 7942612 to 53e55bb Compare August 21, 2023 00:27
@pjbgf pjbgf requested a review from hiddeco August 21, 2023 00:33
osfs/os_bound.go Outdated Show resolved Hide resolved
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
Copy link
Member

@hiddeco hiddeco left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@aryan9600 aryan9600 left a comment

Choose a reason for hiding this comment

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

LGTM!

osfs/os.go Outdated
func openFile(fn string, flag int, perm os.FileMode, createDir func(string) error) (billy.File, error) {
if flag&os.O_CREATE != 0 {
if createDir == nil {
return nil, fmt.Errorf("createDir func cannot be nil")

Choose a reason for hiding this comment

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

Suggested change
return nil, fmt.Errorf("createDir func cannot be nil")
return nil, fmt.Errorf("createDir func cannot be nil if file needs to be opened in create mode")

maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice one, updated it accordingly. PTAL

Create the new BoundOS osfs type, which works as a
pass-through filesystem for files descending from base dir.

For backwards compatibility the previous behaviour is
still the default and is now represented by the ChrootOS
type.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
@pjbgf pjbgf merged commit 1d4d3d3 into go-git:master Aug 25, 2023
@pjbgf pjbgf deleted the new-osfs branch August 25, 2023 15:34
pjbgf added a commit to pjbgf/go-billy that referenced this pull request Aug 29, 2023
The Default var was incorrectly removed as part of
go-git#31. This PR revert that change and adds tests to
avoid future regression.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-billy that referenced this pull request Aug 29, 2023
The Default var was incorrectly removed as part of
go-git#31. This PR revert that change and adds tests to
avoid future regression.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-billy that referenced this pull request Aug 29, 2023
The Default var was incorrectly removed as part of
go-git#31. This PR revert that change and adds tests to
avoid future regression.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-billy that referenced this pull request Aug 29, 2023
The Default var was incorrectly removed as part of
go-git#31. This PR revert that change and adds tests to
avoid future regression.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-billy that referenced this pull request Aug 29, 2023
The Default var was incorrectly removed as part of
go-git#31. This PR revert that change and adds tests to
avoid future regression.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-billy that referenced this pull request Aug 29, 2023
The Default var was incorrectly removed as part of
go-git#31. This PR revert that change and adds tests to
avoid future regression.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
@pjbgf pjbgf mentioned this pull request Aug 29, 2023
another-rex referenced this pull request in google/osv-scanner Sep 19, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/go-git/go-billy/v5](https://github.com/go-git/go-billy)
| require | minor | `v5.4.1` -> `v5.5.0` |
| [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) |
require | minor | `v5.8.1` -> `v5.9.0` |
|
[github.com/owenrumney/go-sarif/v2](https://github.com/owenrumney/go-sarif)
| require | patch | `v2.2.0` -> `v2.2.2` |

---

### Release Notes

<details>
<summary>go-git/go-billy (github.com/go-git/go-billy/v5)</summary>

### [`v5.5.0`](https://github.com/go-git/go-billy/releases/tag/v5.5.0)

[Compare
Source](https://github.com/go-git/go-billy/compare/v5.4.1...v5.5.0)

#### What's Changed

- \*: Bump dependencies and go.mod to Go 1.18. Add codeQL workflow. by
[@&#8203;pjbgf](https://github.com/pjbgf) in
[https://github.com/go-git/go-billy/pull/30](https://github.com/go-git/go-billy/pull/30)
- osfs: Add new BoundOS type by
[@&#8203;pjbgf](https://github.com/pjbgf) in
[https://github.com/go-git/go-billy/pull/31](https://github.com/go-git/go-billy/pull/31)
- Re-introduce osfs.Default by
[@&#8203;pjbgf](https://github.com/pjbgf) in
[https://github.com/go-git/go-billy/pull/33](https://github.com/go-git/go-billy/pull/33)
- Revert back to upstream github.com/cyphar/filepath-securejoin by
[@&#8203;pjbgf](https://github.com/pjbgf) in
[https://github.com/go-git/go-billy/pull/34](https://github.com/go-git/go-billy/pull/34)

**Full Changelog**:
go-git/go-billy@v5.4.1...v5.5.0

</details>

<details>
<summary>go-git/go-git (github.com/go-git/go-git/v5)</summary>

### [`v5.9.0`](https://github.com/go-git/go-git/releases/tag/v5.9.0)

[Compare
Source](https://github.com/go-git/go-git/compare/v5.8.1...v5.9.0)

#### What's Changed

- git: worktree: add Amend option to CommitOptions by
[@&#8203;john-cai](https://github.com/john-cai) in
[https://github.com/go-git/go-git/pull/438](https://github.com/go-git/go-git/pull/438)
- git: worktree, reset ignored files that are part of the worktree:
Fixes [#&#8203;819](https://github.com/go-git/go-git/issues/819) by
[@&#8203;daolis](https://github.com/daolis) in
[https://github.com/go-git/go-git/pull/821](https://github.com/go-git/go-git/pull/821)
- plumbing: Do not swallow http message coming from VCS providers by
[@&#8203;matejrisek](https://github.com/matejrisek) in
[https://github.com/go-git/go-git/pull/835](https://github.com/go-git/go-git/pull/835)
- plumbing: transport, handle IPv6 while parsing endpoint. Fixes
[#&#8203;740](https://github.com/go-git/go-git/issues/740) by
[@&#8203;ninedraft](https://github.com/ninedraft) in
[https://github.com/go-git/go-git/pull/820](https://github.com/go-git/go-git/pull/820)
- \*: update goproxy dependency to fix CVE-2023-37788 vulnerability by
[@&#8203;svghadi](https://github.com/svghadi) in
[https://github.com/go-git/go-git/pull/832](https://github.com/go-git/go-git/pull/832)
- \*: bump dependencies and Go to 1.19 by
[@&#8203;pjbgf](https://github.com/pjbgf) in
[https://github.com/go-git/go-git/pull/837](https://github.com/go-git/go-git/pull/837)

#### New Contributors

- [@&#8203;svghadi](https://github.com/svghadi) made their first
contribution in
[https://github.com/go-git/go-git/pull/832](https://github.com/go-git/go-git/pull/832)
- [@&#8203;daolis](https://github.com/daolis) made their first
contribution in
[https://github.com/go-git/go-git/pull/821](https://github.com/go-git/go-git/pull/821)

**Full Changelog**:
go-git/go-git@v5.8.1...v5.9.0

</details>

<details>
<summary>owenrumney/go-sarif
(github.com/owenrumney/go-sarif/v2)</summary>

###
[`v2.2.2`](https://github.com/owenrumney/go-sarif/releases/tag/v2.2.2)

[Compare
Source](https://github.com/owenrumney/go-sarif/compare/v2.2.1...v2.2.2)

#### What's Changed

- fix: add omitempty annotation to messageStrings by
[@&#8203;owenrumney](https://github.com/owenrumney) in
[https://github.com/owenrumney/go-sarif/pull/68](https://github.com/owenrumney/go-sarif/pull/68)

**Full Changelog**:
owenrumney/go-sarif@v2.2.1...v2.2.2

###
[`v2.2.1`](https://github.com/owenrumney/go-sarif/releases/tag/v2.2.1)

[Compare
Source](https://github.com/owenrumney/go-sarif/compare/v2.2.0...v2.2.1)

#### What's Changed

- Bump github.com/stretchr/testify from 1.8.2 to 1.8.4 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/owenrumney/go-sarif/pull/62](https://github.com/owenrumney/go-sarif/pull/62)
- Bump github.com/zclconf/go-cty from 1.13.1 to 1.13.2 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/owenrumney/go-sarif/pull/61](https://github.com/owenrumney/go-sarif/pull/61)
- support messageStrings property by
[@&#8203;masakura](https://github.com/masakura) in
[https://github.com/owenrumney/go-sarif/pull/63](https://github.com/owenrumney/go-sarif/pull/63)
- Bump github.com/zclconf/go-cty from 1.13.2 to 1.14.0 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/owenrumney/go-sarif/pull/65](https://github.com/owenrumney/go-sarif/pull/65)

#### New Contributors

- [@&#8203;masakura](https://github.com/masakura) made their first
contribution in
[https://github.com/owenrumney/go-sarif/pull/63](https://github.com/owenrumney/go-sarif/pull/63)

**Full Changelog**:
owenrumney/go-sarif@v2.2.0...v2.2.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 6am on monday" in timezone
Australia/Sydney, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/google/osv-scanner).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
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.

3 participants