Commit Graph

245 Commits

Author SHA1 Message Date
7bcc41c67b Disable repro and debug VM CLI commands. (#3494)
* Disable  and  VM CLI commands.

* Formatting.

* More formatting.

* More formatting.

* Removing Repro check.
2023-10-03 11:51:41 -07:00
1cee562cf5 Support for retention policies on containers (#3501)
- [x] ability to specify a retention period on a container, which applies to newly-created blobs
- [x] specify default retention periods in templates from CLI side 

There's a small breaking change to the Python JobHelper class.
2023-10-03 11:51:41 -07:00
96c39da54d Fix sed checks for CLI versioning (#3486)
* Fix sed checks for CLI versioning

* Fix.

* Fix.

* Changing build_cli

* Trying greater than

* Tring once more.

* Trying major minor

* trying to replace major minor

* Using major minor
2023-10-03 11:51:40 -07:00
0610a62a50 Updating requirements.txt to accept >= onefuzztypes. (#3477)
* Updating requirements.txt to accept >= onefuzztypes.

* Trying to loosen restriction.
2023-10-03 11:51:40 -07:00
a364051923 Capture crash dumps from libfuzzer, when provided (#2793)
Enables capturing crashdumps generated by ASAN at point of failure.

This helps in several ways:
- provides a crash dump in the case that we cannot repro a failure later
- some people have stated that crash dumps would be more useful to their team than the repro VM
- we should be able to use these for automated submission to Watson or similar

---

Crash dumps are automatically collected (for libfuzzer) jobs, if we find any. They should be activated by enabling crash dumps in ASAN, via:

- On Linux: `ASAN_OPTIONS=disable_coredump=0:abort_on_error=1:unmap_shadow_on_exit=1`
  - OneFuzz will override the (Ubuntu) crash dump options to generate core dumps instead and then upload them.
- On Windows: `ASAN_SAVE_DUMPS=my_dump.dmp`
  - OneFuzz will look for any `*.dmp` files in the working directory and then upload them.

In both cases, the crash dump will be renamed to match the crashing input, if possible, and uploaded to a new `crashdumps` container.

---

Also updated: the “simple” LibFuzzer test has been updated to be compiled with `cl.exe` instead of `clang` on Windows, so that we are exercising the MSVC implementation of ASAN/LibFuzzer, and the CI image has been updated to `windows-2022`. The restriction to an old version of the Windows SDK has been removed.
2023-08-09 21:55:27 +00:00
ef0cfbfc35 Update Azure CLI packages and pin azure-core to 1.28.0 to fix Az login bug (#3396)
* Updating Azure core and cli packages
2023-08-09 14:01:01 -07:00
8cb761a565 Implement with_tasks option to expand the task information (#3343)
* Implement with_tasks option to expand the task information

* Added tests

* format
2023-07-26 16:00:53 -07:00
ed4c02a8e8 Look for azcopy.exe in AZCOPY if it's a directory (#3344)
* Look for azcopy.exe in AZCOPY if it's a directory

* Make file check in AZCOPY dir more concise

Co-authored-by: George Pollard <gpollard@microsoft.com>

* Add logic to support searching for azcopy on linux

---------

Co-authored-by: George Pollard <gpollard@microsoft.com>
2023-07-26 09:00:41 -07:00
73e21e9c8e Update repro get_files to handle regression reports (#3340)
* Add support for regression reports to 'repro get_files'

* Make get_files logic more clear

* Format api.py with black

* Change crash_info default values for mypy

* Set crash_info['input_blob_container'] as a Container instead of string

* Add logic for handling a missing 'original_crash_test_result' or missing 'crash_report's

* Adjust code format in get_files

* Update logic to comply with mypy

* Fix missing dict index operation
2023-07-25 13:26:07 -07:00
62c3f079af Fix #3309 (#3334) 2023-07-24 23:54:57 +00:00
2d0d297301 Fix 'missing' dependency (#3331) 2023-07-24 19:51:33 +00:00
06fb0d3fd0 Kanan/test template fix (#3308)
* Fix test_template logic

* Rewrite test_template logic to make it's intention more clear
2023-07-19 15:53:42 -07:00
930bb3f0b7 allow tasks environment variables to be set (#3294)
* allow tasks environment variables to be set

* build fix

* build fix

* build fix

* another fix

* ajusting the analysis paramters

* make tools dir optional in the analysis task

* bug fix
2023-07-14 17:13:15 -07:00
06b0d158f8 Add --target_timeout flag for qemu_user template command (#3277) 2023-07-11 13:50:29 -07:00
e2b34a0dae Resolving Regression Bugs - File Bugs on regression_report and properly reset state on duplicate. (#3263)
* Resolving Regression Bugs.

* lint

* Fixing type.

* Remove log line.

* Switchin to log error.
2023-07-05 14:57:01 -07:00
85c3e10991 Correlate cli to service (#3137)
* Start event retention policy

* .

* Correlate telemetry from cli to service and out

* Traces end to end

* Linting

* .

* Fix build failures

* Trying to fix python dependency error

* .

* Lets let pip figure it out

* .

* Modified the wrong file

* .

* .

* .

* .

* .

* .

* This is the one

* fix lints?

* I _love_ python

* ...

* Undo some unnecessary changes

* Works again

* PR comments
2023-06-28 18:47:21 +00:00
a720dd1444 allow report to be sent when debugging (#3206) 2023-06-21 16:42:45 +00:00
aa54a15427 Add extra_output container, rename extra container (#3064)
## Summary of the Pull Request

- **Breaking** (but as far as I know this feature is not yet in use): rename the `extra_container` to `extra_setup_container`.
- **Add**: the `extra_output_container`, which pushes its outputs continually.
  - We may also want a type of container which both pushes & pulls? See discussion below.
- **Improved**: if `onefuzz-task` fails upon launch, we will log its output for diagnosis (might close #3113)

---

Some thoughts for the future:

We might want to redesign the containers so that we have something like the following which is passed to the agent, and the agent doesn't need to know the specifics of the containers supplied:

```jsonc
{
    // ...
    "containers": {
        "extra_setup_dir": {
            "mode": "pull",
            "container_name": "yyy",
        },
        "extra_output_dir": {
            "mode": "push",
            "continuous": true, // keep pushing while job is running
            "container_name": "xxx"
        }
    }
}
```

At the moment the agent needs to know what each container is for, for each task type. A more generic and flexible method might be simpler overall.
2023-06-15 02:48:27 +00:00
8e2e11fcd9 Downloading files to locally repro crashes (#3160)
Add `repro get_files` command
2023-06-07 08:17:51 -07:00
98007be1c2 Update requests version in CLI requirements to fix CVE (#3145)
* updated requests version in CLI requirements to fix CVE
2023-05-30 17:45:38 -07:00
dc0e7f76b3 fix logic to set check_fuzzer_help (#3130) 2023-05-24 09:22:27 -07:00
5048e6d50c Allow use of readonly_inputs for qemu_user template (#3116)
* Allow use of readonly_inputs for qemu_user template

* formatting fix
2023-05-19 12:33:49 +12:00
dc66164cda Increase lock wait timeout for qemu_user setup (#3114) 2023-05-17 20:55:47 +00:00
2f478d6c0b Expand valid scaleset names (#3045)
Scaleset names are now permitted to be any (valid) strings, instead of only GUIDs. When we generate a scaleset name it is now based upon the pool name; for example the pool `pool` might get a scaleset named `pool-3b24ba211cad4b078655914754485838`.

This should be backwards-compatible since GUIDs are [already serialized to table storage as strings](dddcfa4949/src/ApiService/ApiService/onefuzzlib/orm/EntityConverter.cs (L190-L191)), so this simply loosens the restrictions placed upon them.

Scaleset IDs now have a strong type in the same way as other IDs; this helps to avoid mixing them up with other strings. Because of this I found one bug in the scaleset search query logic due to Pool ID/VMSS ID confusion. As part of fixing this I've changed the scaleset search query to only return nodes from the table rather than querying Azure to find a list; this seems to be sufficient for the CLI.
2023-05-17 09:58:58 +12:00
333702aa1e Rework events (#3069)
* Start reworking events

* Trying things out

* .

* Add versioning, create events container in deploy script

* Improve gitignore

* Making the types line up

* Lets see how it works

* .

* Add CLI for querying event

* Linting

* Update src/ApiService/ApiService/Functions/Events.cs

Co-authored-by: George Pollard <porges@porg.es>

* almost done testing

* Added test

---------

Co-authored-by: George Pollard <porges@porg.es>
2023-04-27 20:10:39 +00:00
001c5a2367 Change --check_fuzzer_help to --no_check_fuzzer_help (#3063)
Because `--check_fuzzer_help` is a positive flag (defaults to `True`), there is no way to change it to `False`, because specifying it on the command line sets it to `True`. Change the flag to a negative one instead, named `--no_check_fuzzer_help`.
2023-04-26 16:26:07 +12:00
7f1257b696 Add command to download the blob content to a file (#3060) 2023-04-25 16:15:58 +00:00
a268bc9c7c Add New Endpoint to update the pool authentication (#3059)
* check that the node in managed before sending the stop message

* added endpoint to update the pool

* Update src/ApiService/ApiService/Functions/Pool.cs

Co-authored-by: Teo Voinea <58236992+tevoinea@users.noreply.github.com>

---------

Co-authored-by: Teo Voinea <58236992+tevoinea@users.noreply.github.com>
2023-04-24 21:52:13 +00:00
aa28550aad update the ado logic to consume the list of existing items once (#3014)
* update the ado logic to consume the list of existing items once

* format

* Update src/ApiService/ApiService/onefuzzlib/notifications/Ado.cs

Co-authored-by: Teo Voinea <58236992+tevoinea@users.noreply.github.com>

* Adding a notification testing endpoint

* fix tests

* format

* regen docs

* update logic

* format

* fix dummy name

* mypy fix

* make mypy happy

* bandit fix

* renaming

* address PR Comment

---------

Co-authored-by: Teo Voinea <58236992+tevoinea@users.noreply.github.com>
2023-04-19 14:27:16 -07:00
169cef7a06 Remove Additional config params - require on each request (#3000)
* Only Overrite Config Cache

* Lint

* Fixing isort.

* Removing expiry.

* Removing import.

* Removing config params.

* Remove bad import.

* Adjusting to type changes.

* Remove whitespace.

* Formatting.

* Formatting.

* null check.

* Formatting.
2023-04-11 11:35:09 -07:00
35e9effe4d Allow the duration of the tasks to be specified in the template (#2997) 2023-04-10 19:16:48 +00:00
b8f03277e6 Update az cli 2.47 (#2959)
* update az cli to fix bicep error deploying from ADO

* update AZ CLI deps


---------

Co-authored-by: George Pollard <gpollard@microsoft.com>
2023-04-04 13:54:44 -07:00
706c9fc992 Fix and CVE-2023-0286 (#2957)
- Added tempfile dependency to fix WS-2023-0045
- removed explicit version in example to fix WS-2023-0045
2023-04-03 13:50:25 -07:00
795ece3675 Add option to specify a known crash container (#2950)
* add option to upload known crash directory

* specify a container instead of a directory

* remove crash upload
2023-03-28 12:47:38 -07:00
cc08109e39 fix CVE-2023-0286 (#2933)
* fix CVE-2023-0286
removing dependency oncryptography==3.3.2

* update azure-cli-core and azure-cli to 2.46.0

* fix version handling in the server
2023-03-21 18:23:07 +00:00
e653f9b73e Resolving Variable Reference Error (#2903) 2023-03-02 12:44:49 -08:00
ca7e07f027 Reverting client_id Name Change (#2889) 2023-02-27 16:01:57 -08:00
3d299ce51e fix extra container intilization (#2887)
* fix extra container intilization

* fix extra url download

* fix extra dir parameter to the agent

* rename extra to extra_dir
2023-02-27 13:57:32 -08:00
b84896802c Adding extra container to tasks (#2847)
* adding extra container to tasks

* setup expand

* build fix

* generate docs

* build fix

* build fix

* build fix

* format

* format

* build fix

* fix extra container references

* format

* Update "Needs Triage" label to the one we use. (#2845)

* Report extension errors (#2846)

Old failure message:
```
failed to launch extension
```

New failure message:

```
failed to launch extension(s): Errors for extension 'CustomScriptExtension':
:Error: ProvisioningState/failed/3 (Provisioning failed) - Failed to download all specified files. Exiting. Error Message: The remote server returned an error: (400) Bad Request.
```

* Sematically validate notification configs (#2850)

* Add new command

* Update remaining jinja templates and references to use scriban

* Add ado template validation

* Validate ado and github templates

* Remove unnecessary function

* Update src/ApiService/ApiService/OneFuzzTypes/Model.cs

Co-authored-by: Cheick Keita <kcheick@gmail.com>

---------

Co-authored-by: Cheick Keita <kcheick@gmail.com>

* adding extra container to integration tests

* adding doc

* update tests

* format

* build and clippy fix

* Update src/agent/onefuzz-task/src/tasks/report/generic.rs

Co-authored-by: Teo Voinea <58236992+tevoinea@users.noreply.github.com>

---------

Co-authored-by: Marc Greisen <mgreisen@microsoft.com>
Co-authored-by: George Pollard <gpollard@microsoft.com>
Co-authored-by: Teo Voinea <58236992+tevoinea@users.noreply.github.com>
2023-02-23 19:08:01 +00:00
4caaf8fc32 Remove old libfuzzer dotnet template (#2875)
### Context
The original `libfuzzer dotnet` job template was a proof of concept that demonstrated how the `libfuzzer_fuzz` task could be used to express fuzzing via the (pre SharpFuzz 2.0) `libfuzzer-dotnet` tool. It (and its associated integration test) used a harness that linked an older version of SharpFuzz, and which is incompatible with LibFuzzerDotnetLoader (which requires SharpFuzz 2.0 or greater).

### Changes
- Rename `libfuzzer dotnet_dll` job template to `libfuzzer dotnet`, making it the _only_ `libfuzzer-dotnet` template
- Remove integration tests and docs for the old proof-of-concept job type

### Notice

This is a breaking change.

Closes #2874.
2023-02-21 10:54:36 +13:00
d5cff033d9 Remove function allowlist (#2859) 2023-02-17 20:19:38 -08:00
1ac3fd4bed Config Refactor Part 2 - Change Opt Param Names & Set File Expiry (#2835)
* Remove Old Optional Parameters and Hardcoded Values.

* Set file to expire.

* Adding expiry.

* test sleep

* Tested expiry.

* Set expirty to 24hrs.

* Syntax error.

* Formatting.

* Changing optional.

* Adding new params.

* Removing arguments.

* Removing arguments.

* Changing param names.

* Update params.
2023-02-17 16:12:17 -08:00
5ea0128727 Add --notification_config support for dotnet templates (#2842) 2023-02-16 10:54:58 +13:00
58f756de47 Switch over to new coverage task (#2741) 2023-02-15 12:41:19 -08:00
2e6eef7654 Add notification get command (#2818)
* Add new command

* lint
2023-02-09 11:30:40 -05:00
a13bb2feb3 Interact with migrations via cli (#2816)
* Interact with migrations via cli

* Move command under notifications
2023-02-08 22:02:40 +00:00
f13f52ab71 Deprecating the job template feature (#2798)
* deprecating the job template feature

* removing the code

* format
2023-02-08 19:21:03 +00:00
d732028201 Add unmanaged nodes integration tests (#2780)
* Add docker file to the runtime tools

* fixes

* bug fixes

* more bug fixes and added doc

* don;t overwrite the RUST_LOG env var

* integration test for unmanaged nodes

* add unamanged parameters to launch()

* add ing object_id

* more bug fixes

* bug fixes

* chmod on the linux files in docker

* format

* cleanup merge

* added test_unmanaged command

* cleanup

* use a single image for the docker compose
remove images after the test

* docs and formatting

* format

* format

* format and bug fixes

* using windows server

* fix linux container
make the base image a paramter on windows
use the windows server base image on  windows server

* format

* bug fix

* more fixes

* allow reboot

* more fixes

* added more logging around the service principal creation

* format

* more logging

* change restart policy

* fix multi tenant domain

* more fixes

* exit instead of reboot when running inside docker

* remove comment

* build fix

* try_exist instead of exist

* save the docker logs

* bug_fix

* adding timeout

* fix timeout logic

* adding a build profile

* make all agent depend on the first one

* remove profile

* another fix

* restart agent 1

* Update docs/unmnaged-nodes.md

Co-authored-by: Teo Voinea <58236992+tevoinea@users.noreply.github.com>

---------

Co-authored-by: Teo Voinea <58236992+tevoinea@users.noreply.github.com>
2023-02-08 11:07:19 -08:00
f93c75556d Resolving bug in config refactor. (#2811)
* Resolving bug in config refactor.

* fixing isort.

* Reformatting api.

* debugging.

* fixing backend.

* Adding condition to param retrieval.

* Adding back save.

* Fixing condition check.

* Formatting.
2023-02-07 18:13:29 -08:00
80e9b737e8 Add readonly_inputs to dotnet & dotnet_dll templates (#2740)
Closes #2739
2023-02-06 20:15:21 +00:00