Coder Social home page Coder Social logo

microsoft / regorus Goto Github PK

View Code? Open in Web Editor NEW
81.0 4.0 25.0 1.15 MB

Regorus - A fast, lightweight Rego (OPA policy language) interpreter written in Rust.

License: MIT License

Rust 86.36% Shell 0.17% Open Policy Agent 8.28% Python 0.28% JavaScript 0.10% CMake 0.22% C 0.64% C# 1.31% C++ 0.99% Go 0.56% Java 1.10%
interpreter opa rego rust confidential-computing policy-as-code c cpp csharp golang

regorus's Introduction

Regorus

Regorus is

  • Rego-Rus(t) - A fast, light-weight Rego interpreter written in Rust.
  • Rigorous - A rigorous enforcer of well-defined Rego semantics.

Regorus is also

  • cross-platform - Written in platform-agnostic Rust.

  • current - We strive to keep Regorus up to date with latest OPA release. Regorus supports import rego.v1.

  • compliant - Regorus is mostly compliant with the latest OPA release v0.62.0. See OPA Conformance for details. Note that while we behaviorally produce the same results, we don't yet support all the builtins.

  • extensible - Extend the Rego language by implementing custom stateful builtins in Rust. See add_extension. Support for extensibility using other languages coming soon.

  • polyglot - In addition to Rust, Regorus can be used from C, C++, C#, Golang, Java, Javascript and Python. This is made possible by the excellent FFI tools available in the Rust ecosystem. See bindings for information on how to use Regorus from different languages.

    To try out a Javascript(WASM) compiled version of Regorus from your browser, visit Regorus Playground.

Regorus is available as a library that can be easily integrated into your Rust projects. Here is an example of evaluating a simple Rego policy:

use anyhow::Result;
use regorus::*;
use serde_json;

fn main() -> Result<()> {
  // Create an engine for evaluating Rego policies.
  let mut engine = Engine::new();

  // Add policy to the engine.
  engine.add_policy(
    // Filename to be associated with the policy.
    "hello.rego".to_string(),

    // Rego policy that just sets a message.
    r#"
       package test
       message = "Hello, World!"
    "#.to_string()
  )?;

  // Evaluate the policy, fetch the message and print it.
  let results = engine.eval_query("data.test.message".to_string(), false)?;
  println!("{}", serde_json::to_string_pretty(&results)?);

  Ok(())
}

Regorus is designed with Confidential Computing in mind. In Confidential Computing environments, it is important to be able to control exactly what is being run. Regorus allows enabling and disabling various components using cargo features. By default all features are enabled.

The default build of regorus example program is 6.4M:

$ cargo build -r --example regorus; strip target/release/examples/regorus; ls -lh target/release/examples/regorus
-rwxr-xr-x  1 anand  staff   6.4M Jan 19 11:23 target/release/examples/regorus*

When all features except for yaml are disabled, the binary size drops down to 2.9M.

$ cargo build -r --example regorus --features "yaml" --no-default-features; strip target/release/examples/regorus; ls -lh target/release/examples/regorus
-rwxr-xr-x  1 anand  staff   2.9M Jan 19 11:26 target/release/examples/regorus*

Regorus passes the OPA v0.61.0 test-suite barring a few builtins. See OPA Conformance below.

Bindings

Regorus can be used from a variety of languages:

  • C: C binding is generated using cbindgen. corrosion-rs can be used to seamlessly use Regorous in your CMake based projects. See bindings/c.
  • C++: C++ binding is generated using cbindgen. corrosion-rs can be used to seamlessly use Regorous in your CMake based projects. See bindings/cpp.
  • C#: C# binding is generated using csbindgen. See bindings/csharp for an example of how to build and use Regorus in your C# projects.
  • Golang: The C bindings are exposed to Golang via CGo. See bindings/go for an example of how to build and use Regorus in your Go projects.
  • Python: Python bindings are generated using pyo3. Wheels are created using maturin. See bindings/python.
  • Java: Java bindings are developed using jni-rs. See bindings/java.
  • Javascript: Regorus is compiled to WASM using wasmpack. See bindings/wasm for an example of using Regorus from nodejs. To try out a Javascript(WASM) compiled version of Regorus from your browser, visit Regorus Playground.

To avoid operational overhead, we currently don't publish these bindings to various repositories. It is straight-forward to build these bindings yourself.

Getting Started

examples/regorus is an example program that shows how to integrate Regorus into your project and evaluate Rego policies.

To build and install it, do

$ cargo install --example regorus --path .

Check that the regorus example program is working

$ regorus
Usage: regorus <COMMAND>

Commands:
  eval   Evaluate a Rego Query
  lex    Tokenize a Rego policy
  parse  Parse a Rego policy
  help   Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

First, let's evaluate a simple Rego expression 1*2+3

$ regorus eval "1*2+3"

This produces the following output

{
  "result": [
    {
      "expressions": [
        {
           "value": 5,
           "text": "1*2+3",
           "location": {
              "row": 1,
              "col": 1
            }
        }
      ]
    }
  ]
}

Next, evaluate a sample policy and input (borrowed from Rego tutorial):

$ regorus eval -d examples/example.rego -i examples/input.json data.example

Finally, evaluate real-world policies used in Azure Container Instances (ACI)

$ regorus eval -b tests/aci -d tests/aci/data.json -i tests/aci/input.json data.policy.mount_overlay=x

Policy coverage

Regorus allows determining which lines of a policy have been executed using the coverage feature (enabled by default).

We can try it out using the regorus example program by passing in the --coverage flag.

$ regorus eval -d examples/example.rego -i examples/input.json data.example --coverage

It produces the following coverage report which shows that all lines are executed except the line that sets allow to true.

coverage.png

See Engine::get_coverage_report for details. Policy coverage information is useful for debugging your policy as well as to write tests for your policy so that all lines of the policy are exercised by the tests.

ACI Policies

Regorus successfully passes the ACI policy test-suite. It is fast and can run each of the tests in a few milliseconds.

$ cargo test -r --test aci
    Finished release [optimized + debuginfo] target(s) in 0.05s
    Running tests/aci/main.rs (target/release/deps/aci-2cd8d21a893a2450)
aci/mount_device                                  passed    3.863292ms
aci/mount_overlay                                 passed    3.6905ms
aci/scratch_mount                                 passed    3.643041ms
aci/create_container                              passed    5.046333ms
aci/shutdown_container                            passed    3.632ms
aci/scratch_unmount                               passed    3.631333ms
aci/unmount_overlay                               passed    3.609916ms
aci/unmount_device                                passed    3.626875ms
aci/load_fragment                                 passed    4.045167ms

Run the ACI policies in the tests/aci directory, using data tests/aci/data.json and input tests/aci/input.json:

$ regorus eval -b tests/aci -d tests/aci/data.json -i tests/aci/input.json data.policy.mount_overlay=x

Verify that OPA produces the same output

$ diff <(regorus eval -b tests/aci -d tests/aci/data.json -i tests/aci/input.json data.framework.mount_overlay=x) \
       <(opa eval -b tests/aci -d tests/aci/data.json -i tests/aci/input.json data.framework.mount_overlay=x)

Performance

To check how fast Regorus runs on your system, first install a tool like hyperfine.

$ cargo install hyperfine

Then benchmark evaluation of the ACI policies,

$ hyperfine "regorus eval -b tests/aci -d tests/aci/data.json -i   tests/aci/input.json data.framework.mount_overlay=x"
Benchmark 1: regorus eval -b tests/aci -d tests/aci/data.json -i tests/aci/input.json data.framework.mount_overlay=x
  Time (mean ± σ):       4.6 ms ±   0.2 ms    [User: 4.1 ms, System: 0.4 ms]
  Range (min … max):     4.4 ms …   6.0 ms    422 runs

Compare it with OPA

$ hyperfine "opa eval -b tests/aci -d tests/aci/data.json -i tests/aci/input.json data.framework.mount_overlay=x"
Benchmark 1: opa eval -b tests/aci -d tests/aci/data.json -i tests/aci/input.json data.framework.mount_overlay=x
  Time (mean ± σ):      45.2 ms ±   0.6 ms    [User: 68.8 ms, System: 5.1 ms]
  Range (min … max):    43.8 ms …  46.7 ms    62 runs

OPA Conformance

Regorus has been verified to be compliant with OPA v0.61.0 using a test driver that loads and runs the OPA testsuite using Regorus, and verifies that expected outputs are produced.

The test driver can be invoked by running:

$ cargo test -r --test opa

Currently, Regorus passes all the non-builtin specific tests. See passing tests suites.

The following test suites don't pass fully due to mising builtins:

  • cryptoparsersaprivatekeys
  • cryptox509parseandverifycertificates
  • cryptox509parsecertificaterequest
  • cryptox509parsecertificates
  • cryptox509parsekeypair
  • cryptox509parsersaprivatekey
  • globsmatch
  • graphql
  • invalidkeyerror
  • jsonpatch
  • jwtdecodeverify
  • jwtencodesign
  • jwtencodesignraw
  • jwtverifyhs256
  • jwtverifyhs384
  • jwtverifyhs512
  • jwtverifyrsa
  • netcidrcontains
  • netcidrcontainsmatches
  • netcidrexpand
  • netcidrintersects
  • netcidrisvalid
  • netcidrmerge
  • netcidroverlap
  • netlookupipaddr
  • providers-aws
  • regometadatachain
  • regometadatarule
  • regoparsemodule
  • rendertemplate

They are captured in the following github issues.

Grammar

The grammar used by Regorus to parse Rego policies is described in grammar.md in both W3C EBNF and RailRoad Diagram formats.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

regorus's People

Contributors

anakrish avatar dependabot[bot] avatar eric-therond avatar justanotherminh avatar microsoft-github-operations[bot] avatar microsoftopensource avatar mingweishih avatar unexge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

regorus's Issues

[Lib] Implement semver functions

Implement OPA's semver functions

  • semver.compare
  • semver.is_valid

To implement:

  • Use ak-semver to start off. It contains placeholder implementations for the two library functions that only do parameter validation. It also contains tests and the logic needed to register these library functions.
  • Replace bail! statements in src/builtins/semver.rs with actual implementations.
  • To test, run cargo test semver. This will run tests that have been added in compare.yaml and is_valid.yaml.

Policy Coverage

Provide a way to figure out what lines of policy were evaluated.

[Bug] Parse query string completely

Ensure that the entire query string is parsed. x ? should produce an error. Previously, after parsing the valid portion of the query, the trailing portion was ignored.

Add --non-strict flag to regorus

By default, regorus runs in strict mode, detecting and raising errors. Add the --non-strict mode that allows returning Undefined instead of raising some errors. With this flag

regorus eval is equivalent to opa eval --strict --strict-builtin-errors
regorus eval --non-strict == opa eval

Do not raise errors from builtins in when evaluation is not strict.

Currently regorus will raise errors from builtin functions even when not executing in strict mode. To be compatible with OPA, beyond the OPA testsuite, we need to change to behavior to not raise errors from builtins when not in strict mode. Instead of errors, Undefined will be propagated to the caller.

Preserve `false` values in single-expression queries

If any expression evaluates to false in a query, then regorus currently returns no results for the query.
E.g.: 1; true; false does not produce any result. Upstream OPA also behaves the same.

However, if a query has only one expression, then upstream OPA returns the value as a result, even if the value is false.
Currently Regorus treats it the same as multi-valued query and returns no result. The behavior must be changed to match upstream OPA.

Also there is a distinction between = and ==. The former is a binding operator and would evaluate to Undefined in case of mismatch between lhs and rhs. The latter evaluates to either true or false.
Thus 1 = 2 must not produce results whereas 1 == 2 must produce results.

Note that 1 == 2; true must not produce results since it is a multi-expression query.

Unable to run test code on OSX M1 by default

I get the following error when running the code on Mac:

$ cargo test
    Blocking waiting for file lock on build directory
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.139
   Compiling memchr v2.5.0
   Compiling bitflags v1.3.2
   Compiling linux-raw-sys v0.1.4
   Compiling serde v1.0.152
   Compiling ppv-lite86 v0.2.17
   Compiling ryu v1.0.12
   Compiling itoa v1.0.5
   Compiling regex-syntax v0.6.28
   Compiling log v0.4.17
   Compiling aho-corasick v0.7.20
   Compiling num-traits v0.2.15
   Compiling termcolor v1.2.0
   Compiling io-lifetimes v1.0.5
   Compiling getrandom v0.2.8
   Compiling rand_core v0.6.4
   Compiling rustix v0.36.8
   Compiling rand_chacha v0.3.1
   Compiling regex v1.7.1
   Compiling hashbrown v0.12.3
   Compiling humantime v2.1.0
   Compiling rand v0.8.5
   Compiling is-terminal v0.4.4
   Compiling serde_json v1.0.93
   Compiling env_logger v0.10.0
   Compiling indexmap v1.9.2
   Compiling ordered-float v3.4.0
   Compiling anyhow v1.0.69
   Compiling same-file v1.0.6
   Compiling unsafe-libyaml v0.2.5
   Compiling lazy_static v1.4.0
   Compiling walkdir v2.3.2
   Compiling regorus v0.1.0 (/Users/suraj/regorus)
   Compiling serde_yaml v0.9.17
WARN rustc_codegen_ssa::back::link Linker does not support -static-pie command line option. Retrying with -static instead.
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crt1.o" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbegin.o" "/var/folders/ls/csbb474j2r9__hhcvmxq0rfh0000gn/T/rustcnqCu9M/symbols.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.26oy5xroe1j4uizr.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.2al4rbod2d9ouijo.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.2ell7l6z5e2ib1ww.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.3dfnnzlc4ks2tmnc.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.3tqzf0hnys57fi3b.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.3zwjhdaxhp1yjnnm.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.454ueeyu32ilswfv.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.4kdq0gtkgmh1lj11.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.4zzwzf8zq860h2ec.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.5836ha2a7szqtn9b.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.7djmpei4nvyela8.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.he6eobjek6bvjb7.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.ow62x8f73xh9oux.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.qa6eayjupo3qekh.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4.3w5ijmrcl3hbb8h9.rcgu.o" "-Wl,--as-needed" "-L" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/Users/suraj/regorus/target/debug/deps" "-L" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libserde_json-cdcfbac8d3038cc5.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libryu-b1b9f8d3fa76cb19.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libitoa-e0dd1901b33b3a15.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libtest-ad0f359ad33f9b7b.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libgetopts-79eba14d9f034925.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libunicode_width-afab047dd1b3ce90.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_std-842db571d17646c8.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libserde-c4504a9a9e7f5d96.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libordered_float-325f78850fa22743.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libnum_traits-0c7dcfa51f336571.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/liblog-b357d2e8b2ee508d.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/liblazy_static-78967fb5a1b2ccae.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/librand-dc8da0f8c2953e14.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/librand_chacha-7a8120c61382777d.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libppv_lite86-f174219c679d741c.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/librand_core-85cfaef9eabee4e3.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libgetrandom-8a1e0d457729ec1d.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/liblibc-b47602084d6405af.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libcfg_if-9474d645befae3f8.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libanyhow-9157ae3575dd79b3.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libprofiler_builtins-bd289e9e1d3116a4.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-3d55d9622a2f5140.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libobject-7aa31308145aea0a.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libmemchr-8c385129ceceaff7.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libaddr2line-3a9d0b46a4afc5ce.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libgimli-5c4e1c7dd1c36634.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-85de0c518ec91e8f.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_detect-2eeeecc93705146d.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-990303a257faf081.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libminiz_oxide-3639a8245c3cc653.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libadler-8dbe6ab28e534b48.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-dd6269f764aa51a6.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-53c0377c886910ca.rlib" "-lunwind" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-68da8aade85f8514.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-f8cfdefff46a260d.rlib" "-lc" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-d2c87b1633315b15.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-37886685c2c3c64f.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-5c96c3c09cedb260.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-8917dd2a6ba09b28.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "-o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/regorus-fcec70836da02bd4" "-Wl,--gc-sections" "-static" "-Wl,-zrelro,-znow" "-nodefaultlibs" "-u" "__llvm_profile_runtime" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtend.o" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
  = note: ld: unknown option: --as-needed
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `regorus` due to previous error
warning: build failed, waiting for other jobs to finish...
WARN rustc_codegen_ssa::back::link Linker does not support -static-pie command line option. Retrying with -static instead.
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crt1.o" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbegin.o" "/var/folders/ls/csbb474j2r9__hhcvmxq0rfh0000gn/T/rustcezdAAE/symbols.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.10lbz54l10fy7bnj.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.14qdkywmskbufgzc.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.14x1578w73rs0t7g.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.15pang75rgcc2149.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.15ttnen1yodphh59.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.19qiu0vstc6blcoo.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1chunr76iiltpbwh.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1d5q024lzwtrjxc1.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1drcbnq9dk8d16y9.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1dtq9gsda3qt1569.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1esr8c3vv575wkum.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1gk4hluxuh3zfnt4.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1iov375qof33xtth.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1mlvsdh2p3rtl69a.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1ncizjpmszhorze4.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1qlk5wae1w1agfkv.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1u46vy1nwnirjjgu.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1v0fcbsxcm20a357.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1v6w4vossqd9m9wx.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1v9kxi413z2zvb37.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1w54bwl3badzw2ui.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.1w7gmfjkhdppngnw.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.20ao07srkatsdi1a.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.20mk0g32l9hglkiu.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.21surqq5dprmlr7n.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.236ahaz3xdvx19vz.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.239og53s1h4sf4he.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.24bc8iduz0hpw1vv.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.278fswuw6juzym6z.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.292z02bdmwk82fkw.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2dhcymdxg28stykj.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2gx0zi7jtyafyap.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2h151lwiifn8t2b8.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2ici9tg27fg93szc.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2ihl00rhn5w063xo.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2k5geolxrpmtsrx1.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2ky3qvmsunrmsuz5.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2mkz35slr7u08tt2.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2neziuzui60355f6.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2o5wbrg0lh63d9rr.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2t9dk78lxlh9z8t6.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2tbgxkmc1p4usxru.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2tqs1rtkjkcndkz3.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2uqjhe8ydp5faoc9.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2uu5wwwbcages3zz.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2wba4gk4otk9a9cl.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2wdrxpmvrj88arhb.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.31do7vn09jexws7a.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.32yvriltmj8las5i.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.36ab358g564vkadv.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.39sjso3eptiwkso3.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.39v3ijqe9ohdx6ix.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3bnqese2dkk10qxb.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3c0kwcmwuvdn0nwe.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3cx6j9et76p6e8dr.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3ewxvgxu7ntq7kak.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3g4d52phcytf66e1.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3jk00xc1l27y3cby.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3ktgq3elm9xczl5s.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3nay7aaq2o8dwp2.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3qj5ythr684tme3f.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3qvnf4i07hgdrkua.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.3vm3vhz51xqoolkm.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.41ee3azv9168g668.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.41ight3vjb60iss.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.42novq37zj9kk2iz.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.43hrmg2tdwdbz2tu.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.46sjiehwsngos927.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4a1bopx8hdq8zitz.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4c3bzkmkpqzsjk44.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4cvv3qrxo7ucxr2b.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4f9t18mqhvohsx7s.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4gfly11vbz811auk.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4h9plm51ncrcj3od.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4i436tjojnxt7cyy.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4igp5hcl8upsitcn.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4p45qxhjnrsrvn7v.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4rk03eexl33bipk3.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4sk3841ngzoivdt8.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4v05i0ipvhez0b7h.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4v4xwnqfixyzp2gc.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4vyjq0nhdlaxj77h.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4w4x67d76bqfsud2.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4wl0vgh2rzv7r5lc.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.4ww2zc4z3cipog6m.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.54i7dq1g3vasvvmp.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.57oci7izti4d3mhc.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.58yq1lbk0m2hpeq2.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.5cexk1c8q8j7zf46.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.5fjck2b3oj36ru6n.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.6jfmxsxw6bw8jlh.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.6vikuziay2a4kll.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.9reru6ioj34p3pr.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.d0y5x9anjldh59h.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.dhwg9sp9svbwafl.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.dw0guksm18tfhv9.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.fvhcb11tjjkg28x.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.fxaa8i4jalx23o.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.iv179gi6ew87u2u.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.ked6dapl1yydq12.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.ltrkj4sc07w9afm.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.lw3bf575jbf5niv.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.lypp958fqg0qquv.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.nzd85bdo9hx53pj.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.opjuftvetdalckf.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.q6valkxkn5aqvvq.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.q7vvvvks6l15x91.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.sd6c0si6nq56dgg.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.u4beonlsekqmaij.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.vyn2m1m2cq7xu1x.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.wn5l5h2mu2x96vv.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.x5pum6ohexqcreu.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.zg53v1wdz67ucak.rcgu.o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422.2ohczznkv083gq9.rcgu.o" "-Wl,--as-needed" "-L" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/Users/suraj/regorus/target/debug/deps" "-L" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libserde_yaml-10928f6a17d9ac05.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libindexmap-ace3303970416a49.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libhashbrown-6b1ed0f4c35f0529.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libunsafe_libyaml-ba03e2fcbab3acc5.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libenv_logger-d191049e22d18f84.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libtermcolor-b14b6fb0486f23c6.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libis_terminal-9f4d4e6a3f6cd08c.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/librustix-06f28caa09371fd8.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libbitflags-4616e6d358ea76d6.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/liblinux_raw_sys-caa13804594638b4.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libio_lifetimes-13f403714eb7d653.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libhumantime-f15b169e767823af.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libregex-dac92d386ed86f3f.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libaho_corasick-ca0617db7b86d108.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libmemchr-f38717440fcdc3d3.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libregex_syntax-674614f1fdd60202.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libtest-ad0f359ad33f9b7b.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libgetopts-79eba14d9f034925.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libunicode_width-afab047dd1b3ce90.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_std-842db571d17646c8.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libregorus-51e3b06d197979a2.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libserde_json-cdcfbac8d3038cc5.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libryu-b1b9f8d3fa76cb19.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libitoa-e0dd1901b33b3a15.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libserde-c4504a9a9e7f5d96.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libordered_float-325f78850fa22743.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libnum_traits-0c7dcfa51f336571.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/liblog-b357d2e8b2ee508d.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/liblazy_static-78967fb5a1b2ccae.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/librand-dc8da0f8c2953e14.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/librand_chacha-7a8120c61382777d.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libppv_lite86-f174219c679d741c.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/librand_core-85cfaef9eabee4e3.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libgetrandom-8a1e0d457729ec1d.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/liblibc-b47602084d6405af.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libcfg_if-9474d645befae3f8.rlib" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/libanyhow-9157ae3575dd79b3.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libprofiler_builtins-bd289e9e1d3116a4.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-3d55d9622a2f5140.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libobject-7aa31308145aea0a.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libmemchr-8c385129ceceaff7.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libaddr2line-3a9d0b46a4afc5ce.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libgimli-5c4e1c7dd1c36634.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-85de0c518ec91e8f.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_detect-2eeeecc93705146d.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-990303a257faf081.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libminiz_oxide-3639a8245c3cc653.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libadler-8dbe6ab28e534b48.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-dd6269f764aa51a6.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-53c0377c886910ca.rlib" "-lunwind" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-68da8aade85f8514.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-f8cfdefff46a260d.rlib" "-lc" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-d2c87b1633315b15.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-37886685c2c3c64f.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-5c96c3c09cedb260.rlib" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-8917dd2a6ba09b28.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "-o" "/Users/suraj/regorus/target/x86_64-unknown-linux-musl/debug/deps/tests-9550f7ae56217422" "-Wl,--gc-sections" "-static" "-Wl,-zrelro,-znow" "-nodefaultlibs" "-u" "__llvm_profile_runtime" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtend.o" "/Users/suraj/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
  = note: ld: unknown option: --as-needed
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `regorus` due to previous error

But with the following change I can make it run on the OSX as well:

$ git diff
diff --git .cargo/config.toml .cargo/config.toml
index 997f237..8f70798 100644
--- .cargo/config.toml
+++ .cargo/config.toml
@@ -1,5 +1,5 @@
 [build]
-target = "x86_64-unknown-linux-musl"
+# target = "x86_64-unknown-linux-musl"

 # Flags to enable code-coverage for all builds.
 # These can be removed later.

Or I can do that by manually specifying the target

$ cargo test --target aarch64-apple-darwin

Publishing crate to crates.io

Thanks for this amazing crate! I played with it and it looks great! Do you have any plans to publish it to crates.io anytime soon? I'd be happy to help to set up CI for publishing if you want. Thanks!

simplify the regorus API

Hello
I am facing troubles integrating regorus into an existing project mainly because of references to modules/schedule in the interpreter.

Because of this and the modules/schedule lifetimes I need to refactor my project to call the regorus API (like in test cases) and then to have a reference to the interpreter that is passed through functions of my project that need it (instead of storing the interpreter instance into a struct).

What do you think about "to hide" the complexity of the API (create the Sources, Parse and Analyze them, ...) and to store everything (struct instances not references) into the interpreter? something like that:

let mut interpreter = interpreter::Interpreter::new();
interpreter.add_module("myfile.rego");
interpreter.add_input("foo.json");
interpreter.eval_modules(enable_tracing)?;

Update readme.md

Update readme.md with information about how to get started, OPA compliance, performance etc.

[Bug] Execute queries in a separate module.

Previously, queries were executed in the last parsed module.
Thus, x = data.test.y would result in checking whether x is equal to data.test.y if data.test module was the last module and if it had a rule named x.

Execute each query in its own separate module so that bindings are not shared with modules and other queries.

[Lib] Implement base64url functions

Implement base64url functions and add tests.

  • base64url.decode
  • base64url.encode
  • base64url.encode_no_pad

Ensure that cargo test --test opa -- base64url passes.

See

[Lib] Implement base64 functions

Implement base64 functions. and add tests.

  • base64.decode
  • base64.encode
  • base64.is_valid

Ensure that cargo test --test opa -- base64builtins to ensure that OPA tests pass.

Pass OPA `withkeyword` tests

with keyword is currently only partially implemented. Handle all the cases specified in withkeyword test suite.

multiple underscore indexes issue

test case:

x1[y] {
  y = sites[_].servers[_].hostname
}

data from: https://www.openpolicyagent.org/docs/latest/policy-language/#example-data

error:

   |
57 |           y = sites[_].servers[_].hostname
   |                               ^
error: item cannot be indexed

I suspect this part of the code:
https://github.com/microsoft/regorus/blob/main/src/interpreter.rs#L99

If I add variable with _ key / removed the condition on line 99, it's now working only for one underscore:

x1[y] {
  y = sites[i].servers[_].hostname
}

The OPA documentation mentions that:

Under the hood, OPA translates the _ character to a unique variable name that does not conflict with variables and rules that are in scope.

I believe this is how it should be done, any hint to do that?

[Performance] Avoid unnecessary Rc creation

Span::text() returns an Rc<&str> which is most often short-lived

regorus/src/lexer.rs

Lines 189 to 191 in ad3282c

pub fn text(&self) -> std::rc::Rc<&str> {
std::rc::Rc::new(&self.source.contents()[self.start as usize..self.end as usize])
}

Return &str instead to improve performance.

Prior to this change:

aci/mount_device                                  passed    3.171083ms
aci/mount_overlay                                 passed    2.899375ms
aci/scratch_mount                                 passed    2.816084ms
aci/create_container                              passed    3.44075ms
aci/shutdown_container                            passed    2.779167ms
aci/scratch_unmount                               passed    2.758459ms
aci/unmount_overlay                               passed    2.762375ms
aci/unmount_device                                passed    2.735333ms
aci/load_fragment                                 passed    2.926875ms

After this change:

aci/mount_device                                  passed    2.338666ms
aci/mount_overlay                                 passed    2.133084ms
aci/scratch_mount                                 passed    2.013791ms
aci/create_container                              passed    2.57825ms
aci/shutdown_container                            passed    2.346958ms
aci/scratch_unmount                               passed    2.110208ms
aci/unmount_overlay                               passed    2.055667ms
aci/unmount_device                                passed    1.981667ms
aci/load_fragment                                 passed    2.24825ms

regorus vs regorust

Not an issue, per say, but what is the difference between regorus and regorust? I'm interested in this especially in the context of both projects being under the microsoft organisation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.