mirror of
https://github.com/edera-dev/sprout.git
synced 2026-02-04 21:30:17 +00:00
Compare commits
6 Commits
v0.0.27
...
chore/rele
| Author | SHA1 | Date | |
|---|---|---|---|
|
254dfb40a8
|
|||
|
|
656fde2044 | ||
|
|
5740c14e31 | ||
|
c295de4951
|
|||
|
|
95e0360721 | ||
|
|
1370e1b39b |
6
.github/workflows/ci-actions.yml
vendored
6
.github/workflows/ci-actions.yml
vendored
@@ -25,17 +25,17 @@ jobs:
|
||||
actions: read # Needed to analyze action metadata.
|
||||
steps:
|
||||
- name: harden runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: setup uv
|
||||
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
|
||||
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
||||
|
||||
- name: zizmor
|
||||
run: uvx zizmor --pedantic --format sarif . > results.sarif
|
||||
|
||||
12
.github/workflows/ci-code.yml
vendored
12
.github/workflows/ci-code.yml
vendored
@@ -21,12 +21,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: harden runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -51,12 +51,12 @@ jobs:
|
||||
name: 'build ${{ matrix.arch }}'
|
||||
steps:
|
||||
- name: harden runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -80,12 +80,12 @@ jobs:
|
||||
name: 'clippy ${{ matrix.arch }}'
|
||||
steps:
|
||||
- name: harden runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
4
.github/workflows/codeql.yml
vendored
4
.github/workflows/codeql.yml
vendored
@@ -37,12 +37,12 @@ jobs:
|
||||
build-mode: none
|
||||
steps:
|
||||
- name: harden runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
6
.github/workflows/publish.yml
vendored
6
.github/workflows/publish.yml
vendored
@@ -25,12 +25,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: harden runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
path: target/assemble/*
|
||||
|
||||
- name: 'attest artifacts'
|
||||
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
|
||||
uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0
|
||||
with:
|
||||
subject-name: artifacts.zip
|
||||
subject-digest: "sha256:${{ steps.upload.outputs.artifact-digest }}"
|
||||
|
||||
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -25,12 +25,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: harden runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
run: ./hack/assemble.sh
|
||||
|
||||
- name: 'attest release artifacts'
|
||||
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
|
||||
uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0
|
||||
with:
|
||||
subject-path: target/assemble/*
|
||||
|
||||
|
||||
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -66,7 +66,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "edera-sprout-boot"
|
||||
version = "0.0.27"
|
||||
version = "0.0.28"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"edera-sprout-build",
|
||||
@@ -83,18 +83,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "edera-sprout-build"
|
||||
version = "0.0.27"
|
||||
version = "0.0.28"
|
||||
|
||||
[[package]]
|
||||
name = "edera-sprout-config"
|
||||
version = "0.0.27"
|
||||
version = "0.0.28"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "edera-sprout-eficore"
|
||||
version = "0.0.27"
|
||||
version = "0.0.28"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags",
|
||||
@@ -270,9 +270,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.9.10+spec-1.1.0"
|
||||
version = "0.9.11+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48"
|
||||
checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_spanned",
|
||||
|
||||
@@ -9,7 +9,7 @@ resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
license = "Apache-2.0"
|
||||
version = "0.0.27"
|
||||
version = "0.0.28"
|
||||
homepage = "https://sprout.edera.dev"
|
||||
repository = "https://github.com/edera-dev/sprout"
|
||||
edition = "2024"
|
||||
@@ -48,7 +48,7 @@ version = "1.3.0"
|
||||
default-features = false
|
||||
|
||||
[workspace.dependencies.toml]
|
||||
version = "0.9.10"
|
||||
version = "0.9.11"
|
||||
default-features = false
|
||||
features = ["serde", "parse"]
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfigurat
|
||||
// Resolve the path to the image to chainload.
|
||||
let resolved = eficore::path::resolve_path(
|
||||
Some(context.root().loaded_image_path()?),
|
||||
&context.stamp(&configuration.path),
|
||||
context.stamp(&configuration.path),
|
||||
)
|
||||
.context("unable to resolve chainload path")?;
|
||||
|
||||
@@ -38,8 +38,7 @@ pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfigurat
|
||||
.context("unable to open loaded image protocol")?;
|
||||
|
||||
// Stamp and combine the options to pass to the image.
|
||||
let options =
|
||||
utils::combine_options(configuration.options.iter().map(|item| context.stamp(item)));
|
||||
let options = utils::combine_options(context.stamp_iter(configuration.options.iter()));
|
||||
|
||||
// Pass the load options to the image.
|
||||
// If no options are provided, the resulting string will be empty.
|
||||
@@ -50,6 +49,7 @@ pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfigurat
|
||||
.context("unable to convert chainloader options to CString16")?,
|
||||
);
|
||||
|
||||
// Ensure the chainloader options limit is not exceeded.
|
||||
if options.num_bytes() > u32::MAX as usize {
|
||||
bail!("chainloader options too large");
|
||||
}
|
||||
|
||||
@@ -20,20 +20,11 @@ use uefi::Guid;
|
||||
/// Builds a configuration string for the Xen EFI stub using the specified `configuration`.
|
||||
fn build_xen_config(context: Rc<SproutContext>, configuration: &EderaConfiguration) -> String {
|
||||
// Stamp xen options and combine them.
|
||||
let xen_options = utils::combine_options(
|
||||
configuration
|
||||
.xen_options
|
||||
.iter()
|
||||
.map(|item| context.stamp(item)),
|
||||
);
|
||||
let xen_options = utils::combine_options(context.stamp_iter(configuration.xen_options.iter()));
|
||||
|
||||
// Stamp kernel options and combine them.
|
||||
let kernel_options = utils::combine_options(
|
||||
configuration
|
||||
.kernel_options
|
||||
.iter()
|
||||
.map(|item| context.stamp(item)),
|
||||
);
|
||||
let kernel_options =
|
||||
utils::combine_options(context.stamp_iter(configuration.kernel_options.iter()));
|
||||
|
||||
// xen config file format is ini-like
|
||||
[
|
||||
|
||||
@@ -269,6 +269,15 @@ impl SproutContext {
|
||||
Self::stamp_values(&self.all_values(), text.as_ref()).1
|
||||
}
|
||||
|
||||
/// Stamps all the items from the iterator `input` with all the values in this [SproutContext]
|
||||
/// and it's parents. This calls [self.stamp] on each item.
|
||||
pub fn stamp_iter(
|
||||
&self,
|
||||
input: impl Iterator<Item = impl AsRef<str>>,
|
||||
) -> impl Iterator<Item = String> {
|
||||
input.map(|item| self.stamp(item))
|
||||
}
|
||||
|
||||
/// Unloads a [SproutContext] back into an owned context. This
|
||||
/// may not succeed if something else is holding onto the value.
|
||||
pub fn unload(self: Rc<SproutContext>) -> Option<SproutContext> {
|
||||
|
||||
@@ -18,7 +18,7 @@ fn load_driver(context: Rc<SproutContext>, driver: &DriverDeclaration) -> Result
|
||||
// Resolve the path to the driver image.
|
||||
let resolved = eficore::path::resolve_path(
|
||||
Some(context.root().loaded_image_path()?),
|
||||
&context.stamp(&driver.path),
|
||||
context.stamp(&driver.path),
|
||||
)
|
||||
.context("unable to resolve path to driver")?;
|
||||
|
||||
|
||||
@@ -22,11 +22,10 @@ pub fn generate(
|
||||
|
||||
// Stamp the entry title and actions from the template.
|
||||
let mut entry = list.entry.clone();
|
||||
entry.actions = entry
|
||||
.actions
|
||||
.into_iter()
|
||||
.map(|action| context.stamp(action))
|
||||
.collect();
|
||||
|
||||
// Stamp all the actions this entry references.
|
||||
entry.actions = context.stamp_iter(entry.actions.into_iter()).collect();
|
||||
|
||||
// Push the entry into the list with the new context.
|
||||
entries.push(BootableEntry::new(
|
||||
index.to_string(),
|
||||
|
||||
@@ -48,8 +48,8 @@ fn cstring16_contains_char(string: &CString16, c: char) -> bool {
|
||||
|
||||
/// Parses the input `path` as a [DevicePath].
|
||||
/// Uses the [DevicePathFromText] protocol exclusively, and will fail if it cannot acquire the protocol.
|
||||
pub fn text_to_device_path(path: &str) -> Result<PoolDevicePath> {
|
||||
let path = CString16::try_from(path).context("unable to convert path to CString16")?;
|
||||
pub fn text_to_device_path(path: impl AsRef<str>) -> Result<PoolDevicePath> {
|
||||
let path = CString16::try_from(path.as_ref()).context("unable to convert path to CString16")?;
|
||||
let device_path_from_text = uefi::boot::open_protocol_exclusive::<DevicePathFromText>(
|
||||
uefi::boot::get_handle_for_protocol::<DevicePathFromText>()
|
||||
.context("no device path from text protocol")?,
|
||||
@@ -113,8 +113,13 @@ pub fn device_path_subpath(path: &DevicePath) -> Result<String> {
|
||||
/// Resolve a path specified by `input` to its various components.
|
||||
/// Uses `default_root_path` as the base root if one is not specified in the path.
|
||||
/// Returns [ResolvedPath] which contains the resolved components.
|
||||
pub fn resolve_path(default_root_path: Option<&DevicePath>, input: &str) -> Result<ResolvedPath> {
|
||||
let mut path = text_to_device_path(input).context("unable to convert text to path")?;
|
||||
pub fn resolve_path(
|
||||
default_root_path: Option<&DevicePath>,
|
||||
input: impl ToString,
|
||||
) -> Result<ResolvedPath> {
|
||||
let mut input = input.to_string();
|
||||
|
||||
let mut path = text_to_device_path(&input).context("unable to convert text to path")?;
|
||||
let path_has_device = path
|
||||
.node_iter()
|
||||
.next()
|
||||
@@ -125,7 +130,6 @@ pub fn resolve_path(default_root_path: Option<&DevicePath>, input: &str) -> Resu
|
||||
.map(|it| it.to_string().contains('('))
|
||||
.unwrap_or(false);
|
||||
if !path_has_device {
|
||||
let mut input = input.to_string();
|
||||
if !input.starts_with('\\') {
|
||||
input.insert(0, '\\');
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ impl<'a> ShimInput<'a> {
|
||||
let path = path
|
||||
.to_string(DisplayOnly(false), AllowShortcuts(false))
|
||||
.context("unable to convert device path to string")?;
|
||||
let path = crate::path::resolve_path(None, &path.to_string())
|
||||
let path = crate::path::resolve_path(None, path.to_string())
|
||||
.context("unable to resolve path")?;
|
||||
// Read the file path.
|
||||
let data = path.read_file()?;
|
||||
|
||||
Reference in New Issue
Block a user