Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Aligning feature branch with main #1389

Merged
merged 26 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
74c3a9a
Bump reqwest from 0.11.4 to 0.11.5 in /src/proxy-manager (#1336)
dependabot[bot] Oct 11, 2021
8753ef3
Bump reqwest from 0.11.4 to 0.11.5 in /src/agent (#1335)
dependabot[bot] Oct 11, 2021
03f79ed
Work around for newly-upgraded pip breaking pip-licenses (#1346)
stishkin Oct 11, 2021
19ecba4
Bump iced-x86 from 1.14.0 to 1.15.0 in /src/agent (#1337)
dependabot[bot] Oct 11, 2021
da955db
revert pip breaking pip-licenses workaround (#1348)
stishkin Oct 12, 2021
67cdd74
Bump thiserror from 1.0.29 to 1.0.30 in /src/proxy-manager (#1341)
dependabot[bot] Oct 12, 2021
9b211b2
Bump thiserror from 1.0.29 to 1.0.30 in /src/agent (#1342)
dependabot[bot] Oct 12, 2021
d2354b6
Bump strum from 0.21.0 to 0.22.0 in /src/agent (#1343)
dependabot[bot] Oct 13, 2021
e5c3e60
Bump azure cli to 2.27.2 (#1355)
stishkin Oct 13, 2021
4160da2
Bump azure-identity to 1.6.1 (#1356)
stishkin Oct 13, 2021
d86764c
Bump strum_macros from 0.21.1 to 0.22.0 in /src/agent (#1344)
dependabot[bot] Oct 13, 2021
4f53ada
Bump sysinfo from 0.20.4 to 0.20.5 in /src/agent (#1353)
dependabot[bot] Oct 14, 2021
a633b7c
Release 3.2.0 (#1361)
mgreisen Oct 15, 2021
bb40c66
Temporarily ignore non-actionable `cargo audit` errors (#1365)
ranweiler Oct 18, 2021
720c8dc
Azure DevOps notifications not appearing (#1370)
stishkin Oct 19, 2021
d8503cf
Bump procfs from 0.10.1 to 0.11.0 in /src/agent (#1360)
dependabot[bot] Oct 19, 2021
e3ef29c
Bump structopt from 0.3.23 to 0.3.25 in /src/agent (#1364)
dependabot[bot] Oct 19, 2021
a84e58c
Bump reqwest from 0.11.5 to 0.11.6 in /src/proxy-manager (#1367)
dependabot[bot] Oct 19, 2021
20bcab4
Bump reqwest from 0.11.5 to 0.11.6 in /src/agent (#1368)
dependabot[bot] Oct 19, 2021
deeb720
Bump crossterm from 0.21.0 to 0.22.1 in /src/agent (#1369)
dependabot[bot] Oct 20, 2021
97a3a67
Fix validation of `target_exe` blob name (#1371)
ranweiler Oct 20, 2021
357bc4f
NSG Updated After CLI Update to Instance_Config (#1375)
nharper285 Oct 21, 2021
b238bfe
Revert "NSG Updated After CLI Update to Instance_Config (#1375)" (#1384)
nharper285 Oct 21, 2021
3da5f67
Bump backtrace from 0.3.61 to 0.3.62 in /src/agent (#1382)
dependabot[bot] Oct 21, 2021
c97395a
Set compiler env vars to effect Win10 SDK downgrade (#1388)
ranweiler Oct 22, 2021
4e73a5c
Merge remote-tracking branch 'master/main' into ri
Oct 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,34 @@ jobs:
choco install llvm
choco install make
$env:Path += ";C:\Program Files\LLVM\bin;C:\ProgramData\chocolatey\bin"


# WORKAROUND: effectively downgrade the default Windows 10 SDK version.
#
# This ensures we link against a version of the SDK which won't trigger a
# startup bug in the LLVM-shipped ASAN runtime.

# Assume a default MSVC 2019 install path.
$MsvcDir = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC'

# Assume that `$MsvcDir` only contains version-named subdirectories.
$MsvcVersion = ((Get-ChildItem $MsvcDir).name | Sort-Object -Descending)[0]
$MsvcLib = "${MsvcDir}/${MsvcVersion}/lib/x64"

# Known "good" (non-bug-surfacing) version.
$WindowsSdkVersion = '10.0.18362.0'

# Assume default install path.
$WindowsSdkDir = 'C:/Program Files (x86)/Windows Kits/10'
$WindowsSdkLib = "${WindowsSdkDir}/Lib/${WindowsSdkVersion}"
$WindowsSdkInclude = "${WindowsSdkDir}/Include/${WindowsSdkVersion}"

# Used by `clang.exe`.
$env:CPATH = $WindowsSdkInclude
$env:LIBRARY_PATH = "${MsvcLib};${WindowsSdkLib}/ucrt/x64;${WindowsSdkLib}/um/x64"

# Used by `link.exe`.
$env:LIB = $env:LIBRARY_PATH

cd src/integration-tests

mkdir artifacts/windows-libfuzzer
Expand Down
31 changes: 20 additions & 11 deletions src/agent/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/agent/onefuzz-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ atexit = { path = "../atexit" }
backoff = { version = "0.3", features = ["tokio"] }
clap = "2.33"
coverage = { path = "../coverage" }
crossterm = "0.21"
crossterm = "0.22"
env_logger = "0.9"
flume = "0.10"
futures = "0.3"
Expand Down
64 changes: 54 additions & 10 deletions src/api-service/__app__/onefuzzlib/tasks/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
# Licensed under the MIT License.

import logging
import ntpath
import os
import posixpath
import pathlib
from typing import Dict, List, Optional
from uuid import UUID

Expand Down Expand Up @@ -105,14 +104,12 @@ def check_target_exe(config: TaskConfig, definition: TaskDefinition) -> None:

return

# Azure Blob Store uses virtualized directory structures. As such, we need
# the paths to already be canonicalized. As an example, accessing the blob
# store path "./foo" generates an exception, but "foo" and "foo/bar" do
# not.
if (
posixpath.relpath(config.task.target_exe) != config.task.target_exe
or ntpath.relpath(config.task.target_exe) != config.task.target_exe
):
# User-submitted paths must be relative to the setup directory that contains them.
# They also must be normalized, and exclude special filesystem path elements.
#
# For example, accessing the blob store path "./foo" generates an exception, but
# "foo" and "foo/bar" do not.
if not is_valid_blob_name(config.task.target_exe):
raise TaskConfigError("target_exe must be a canonicalized relative path")

container = [x for x in config.containers if x.type == ContainerType.setup][0]
Expand All @@ -124,6 +121,53 @@ def check_target_exe(config: TaskConfig, definition: TaskDefinition) -> None:
LOGGER.warning(err)


# Azure Blob Storage uses a flat scheme, and has no true directory hierarchy. Forward
# slashes are used to delimit a _virtual_ directory structure.
def is_valid_blob_name(blob_name: str) -> bool:
# https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#blob-names
MIN_LENGTH = 1
MAX_LENGTH = 1024 # Inclusive
MAX_PATH_SEGMENTS = 254

length = len(blob_name)

# No leading/trailing whitespace.
if blob_name != blob_name.strip():
return False

if length < MIN_LENGTH:
return False

if length > MAX_LENGTH:
return False

path = pathlib.PurePosixPath(blob_name)

if len(path.parts) > MAX_PATH_SEGMENTS:
return False

# No path segment should end with a dot (`.`).
for part in path.parts:
if part.endswith("."):
return False

# Reject absolute paths to avoid confusion.
if path.is_absolute():
return False

# Reject paths with special relative filesystem entries.
if "." in path.parts:
return False

if ".." in path.parts:
return False

# Will not have a leading `.`, even if `blob_name` does.
normalized = path.as_posix()

return blob_name == normalized


def target_uses_input(config: TaskConfig) -> bool:
if config.task.target_options is not None:
for option in config.task.target_options:
Expand Down
57 changes: 57 additions & 0 deletions src/api-service/tests/test_task_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from typing import Tuple

import pytest

from __app__.onefuzzlib.tasks.config import is_valid_blob_name

BlobNameTestCase = Tuple[str, bool]


BLOB_NAME_TEST_CASES = [
# Valid
("fuzz.exe", True),
("bin/fuzz.exe", True),
("/".join("a" * 254), True),
("a" * 1024, True),
# Invalid (absolute)
("/fuzz.exe", False),
("/bin/fuzz.exe", False),
# Invalid (special dirs)
("./fuzz.exe", False),
("././fuzz.exe", False),
("./bin/fuzz.exe", False),
("./bin/./fuzz.exe", False),
("../fuzz.exe", False),
("../bin/fuzz.exe", False),
(".././fuzz.exe", False),
("../bin/./fuzz.exe", False),
# Out of Azure size bounds
("", False),
(" ", False),
("/".join("a" * 255), False),
("a" * 1025, False),
# Paths with invalid segments.
("a.", False),
("a..", False),
("a./b", False),
("a/b./c", False),
("a./", False),
("a../", False),
("a./b/", False),
("a/b./c/", False),
("a//", False),
]


@pytest.mark.parametrize("blob_name_test_case", BLOB_NAME_TEST_CASES)
def test_is_valid_blob_name(blob_name_test_case: BlobNameTestCase) -> None:
blob_name, expected = blob_name_test_case

is_valid = is_valid_blob_name(blob_name)

assert is_valid == expected