Compare commits

...

5 Commits

Author SHA1 Message Date
Lucas Nogueira
e7af22c9d9 chore: only run publish for tauri 2022-09-15 16:51:42 -03:00
Lucas Nogueira
c89ed86dbd skip major git tag bump 2022-09-15 16:46:13 -03:00
Lucas Nogueira
90e56c454c add publish-hotfix workflow 2022-09-15 12:16:01 -03:00
Lucas Nogueira
0bd3a90178 run covector version 2022-09-15 07:55:46 -03:00
Amr Bashir
bb17882908 fix(endpoints/fs/readDir): don't read symlinks that are not allowed b… (#5123) 2022-09-15 07:50:30 -03:00
7 changed files with 114 additions and 12 deletions

View File

@@ -66,7 +66,6 @@
}
],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
],
@@ -136,7 +135,6 @@
}
],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
]

59
.github/workflows/publish-hotfix.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: version or publish
on:
push:
branches:
- '1.*'
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 65
outputs:
change: ${{ steps.covector.outputs.change }}
commandRan: ${{ steps.covector.outputs.commandRan }}
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
- name: cargo login
run: cargo login ${{ secrets.crate_token }}
- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- name: covector version or publish (publish when no change files present)
uses: jbolda/covector/packages/action@covector-v0
id: covector
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: 'version-or-publish'
createRelease: true
filterPackages: 'tauri'
- name: Trigger cli.js publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'cli.rs')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-clijs

View File

@@ -1,5 +1,10 @@
# Changelog
## \[1.0.6]
- Fix `fs.readDir` recursive option reading symlinked directories that are not allowed by the scope.
- [bb178829](https://www.github.com/tauri-apps/tauri/commit/bb178829086e80916f9be190f02d83bc25802799) fix(endpoints/fs/readDir): don't read symlinks that are not allowed b… ([#5123](https://www.github.com/tauri-apps/tauri/pull/5123)) on 2022-09-08
## \[1.0.5]
- Escape the MSI file path when running msiexec via powershell.

View File

@@ -16,7 +16,7 @@ license = "Apache-2.0 OR MIT"
name = "tauri"
readme = "README.md"
repository = "https://github.com/tauri-apps/tauri"
version = "1.0.5"
version = "1.0.6"
[package.metadata.docs.rs]
no-default-features = true

View File

@@ -6,7 +6,7 @@
use serde::Serialize;
use std::{
fs::{self, metadata},
fs::{self, metadata, symlink_metadata},
path::{Path, PathBuf},
};
use tempfile::{self, tempdir};
@@ -31,8 +31,36 @@ pub fn is_dir<P: AsRef<Path>>(path: P) -> crate::api::Result<bool> {
metadata(path).map(|md| md.is_dir()).map_err(Into::into)
}
fn is_symlink<P: AsRef<Path>>(path: P) -> crate::api::Result<bool> {
// TODO: remove the different implementation once we raise tauri's MSRV to at least 1.58
#[cfg(windows)]
let ret = symlink_metadata(path)
.map(|md| md.is_symlink())
.map_err(Into::into);
#[cfg(not(windows))]
let ret = symlink_metadata(path)
.map(|md| md.file_type().is_symlink())
.map_err(Into::into);
ret
}
/// Reads a directory. Can perform recursive operations.
pub fn read_dir<P: AsRef<Path>>(path: P, recursive: bool) -> crate::api::Result<Vec<DiskEntry>> {
read_dir_with_options(path, recursive, ReadDirOptions { scope: None })
}
#[derive(Clone, Copy)]
pub(crate) struct ReadDirOptions<'a> {
pub scope: Option<&'a crate::FsScope>,
}
pub(crate) fn read_dir_with_options<P: AsRef<Path>>(
path: P,
recursive: bool,
options: ReadDirOptions<'_>,
) -> crate::api::Result<Vec<DiskEntry>> {
let mut files_and_dirs: Vec<DiskEntry> = vec![];
for entry in fs::read_dir(path)? {
let path = entry?.path();
@@ -42,11 +70,16 @@ pub fn read_dir<P: AsRef<Path>>(path: P, recursive: bool) -> crate::api::Result<
files_and_dirs.push(DiskEntry {
path: path.clone(),
children: if flag {
Some(if recursive {
read_dir(&path_as_string, true)?
} else {
vec![]
})
Some(
if recursive
&& (!is_symlink(&path_as_string)?
|| options.scope.map(|s| s.is_allowed(&path)).unwrap_or(true))
{
read_dir_with_options(&path_as_string, true, options)?
} else {
vec![]
},
)
} else {
None
},

View File

@@ -74,6 +74,7 @@ pub fn read_binary<P: AsRef<Path>>(file: P) -> crate::api::Result<Vec<u8>> {
#[cfg(test)]
mod test {
use super::*;
#[cfg(not(windows))]
use crate::api::Error;
use quickcheck::{Arbitrary, Gen};

View File

@@ -191,9 +191,15 @@ impl Cmd {
path,
dir,
)?;
dir::read_dir(&resolved_path, recursive)
.with_context(|| format!("path: {}", resolved_path.display()))
.map_err(Into::into)
dir::read_dir_with_options(
&resolved_path,
recursive,
dir::ReadDirOptions {
scope: Some(&context.window.state::<Scopes>().fs),
},
)
.with_context(|| format!("path: {}", resolved_path.display()))
.map_err(Into::into)
}
#[module_command_handler(fs_copy_file)]