diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 00ba1a9eae..aec2b3424a 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -22,7 +22,7 @@ jobs: remote-repository-name: cla-signatures path-to-signatures: individual.json branch: main - allowlist: djanatyn,gj,gneray,jedgresham,killpack,laxjesse,patrickod,samscott89,ssglaser,uncommoncense,vrama628,dependabot,dependabot[bot] + allowlist: djanatyn,edaniels,gj,gneray,gsarjeant,jedgresham,killpack,laxjesse,orez-,samscott89,ssglaser,sverch,uncommoncense,vrama628,dependabot,dependabot[bot] use-dco-flag: false create-file-commit-message: 'Creating file for storing CLA signatures' signed-commit-message: '$contributorName has signed the CLA in osohq/oso#$pullRequestNo' diff --git a/.github/workflows/docs-diff.yml b/.github/workflows/docs-diff.yml index 6a2ceb817f..8b51e50726 100644 --- a/.github/workflows/docs-diff.yml +++ b/.github/workflows/docs-diff.yml @@ -49,7 +49,6 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: 2.4 working-directory: "languages/ruby" if: steps.cache.outputs.cache-hit != 'true' - name: Install yard @@ -84,7 +83,7 @@ jobs: - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: - hugo-version: '0.79.1' + hugo-version: "0.79.1" if: steps.cache.outputs.cache-hit != 'true' - name: Build Hugo docs env: @@ -136,7 +135,7 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: 2.4 + ruby-version: "2.7" working-directory: "languages/ruby" if: steps.cache.outputs.cache-hit != 'true' - name: Install yard @@ -171,7 +170,7 @@ jobs: - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: - hugo-version: '0.79.1' + hugo-version: "0.79.1" if: steps.cache.outputs.cache-hit != 'true' - name: Build Hugo docs env: diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index e485b8058f..d38a0a517d 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -31,7 +31,6 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: 2.4 working-directory: "languages/ruby" - name: Install yard run: gem install yard @@ -61,7 +60,7 @@ jobs: - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: - hugo-version: '0.79.1' + hugo-version: "0.79.1" - name: Get branch name (branch) if: github.event_name != 'pull_request' shell: bash diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 5468224ebe..55191c3e24 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -6,16 +6,16 @@ on: description: "docs s3 path (docs.oso.dev or docs-preview.oso.dev)" oso_version: description: "oso release to build docs for" - default: "0.27.0" # oso_version + default: "0.27.3" # oso_version flask_oso_version: description: "flask oso release to build docs for" - default: "0.27.0" # flask_oso_version + default: "0.27.1" # flask_oso_version django_oso_version: description: "django oso release to build docs for" - default: "0.27.0" # django_oso_version + default: "0.27.1" # django_oso_version sqlalchemy_oso_version: description: "sqlalchemy oso release to build docs for" - default: "0.27.0" # sqlalchemy_oso_version + default: "0.27.1" # sqlalchemy_oso_version # Needed to get an AWS token permissions: @@ -49,7 +49,6 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: 2.4 working-directory: "languages/ruby" - name: Install yard run: gem install yard diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 70a096d6f0..882f2d4d71 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -64,13 +64,13 @@ jobs: - name: Copy libraries into resources. run: | mkdir -p languages/java/oso/src/main/resources/linux - cp -r oso-lib-${{ github.event.inputs.version }}/libpolar.so languages/java/oso/src/main/resources/linux/ + cp -r oso-lib-${{ github.event.inputs.version }}/libpolar-x86_64.so languages/java/oso/src/main/resources/linux/libpolar.so mkdir -p languages/java/oso/src/main/resources/macos cp -r oso-lib-${{ github.event.inputs.version }}/libpolar-macOS-fat.dylib languages/java/oso/src/main/resources/macos/libpolar.dylib mkdir -p languages/java/oso/src/main/resources/win cp -r oso-lib-${{ github.event.inputs.version }}/polar.dll languages/java/oso/src/main/resources/win/ - run: | - GPG_TTY=$(tty) mvn -q clean source:jar deploy -DuniqueVersion=false -Dmaven.source.useDefaultManifestFile=true -DdeplyAtEnd=true -Dmaven.source.includePom=true -Dmaven.install.skip=true --settings settings.xml + GPG_TTY=$(tty) mvn -q clean source:jar deploy -DuniqueVersion=false -Dmaven.source.useDefaultManifestFile=true -DdeployAtEnd=true -Dmaven.source.includePom=true -Dmaven.install.skip=true --settings settings.xml working-directory: languages/java/oso python: name: Publish python package to pypi @@ -108,7 +108,7 @@ jobs: - name: Set up ruby ${{ matrix.ruby-version }} uses: ruby/setup-ruby@v1 with: - ruby-version: "2.7" + ruby-version: "3.2" working-directory: "languages/ruby" - run: gem push oso-oso-${{ github.event.inputs.version }}.gem working-directory: "oso-ruby-${{ github.event.inputs.version }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c26a041c4c..7aef37a53d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,33 +53,44 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.69.0 override: true - - name: Build release libraries - run: cargo build --release -p polar-c-api - - name: Build x86_64 release musl library - run: | - rustup target add x86_64-unknown-linux-musl - RUSTFLAGS="-C target-feature=-crt-static" cargo build --target x86_64-unknown-linux-musl --release -p polar-c-api - - name: Download cross + - name: Install cross env: GH_TOKEN: ${{ github.token }} - run: gh release download --repo cross-rs/cross --pattern 'cross-x86_64-unknown-linux-gnu\.tar\.gz' + run: | + gh release download --repo cross-rs/cross --pattern 'cross-x86_64-unknown-linux-gnu\.tar\.gz' + tar -xzvf cross-x86_64-unknown-linux-gnu.tar.gz + - name: Build aarch64 dynamic lib + run: | + rustup target add aarch64-unknown-linux-gnu + RUSTFLAGS="-C target-feature=-crt-static" ./cross build --target aarch64-unknown-linux-gnu --release -p polar-c-api - name: Build aarch64 release musl library run: | rustup target add aarch64-unknown-linux-musl - tar -xzvf cross-x86_64-unknown-linux-gnu.tar.gz RUSTFLAGS="-C target-feature=-crt-static" ./cross build --target aarch64-unknown-linux-musl --release -p polar-c-api + - name: Build x86_64 release libraries + run: cargo build --release -p polar-c-api + - name: Build x86_64 release musl library + run: | + rustup target add x86_64-unknown-linux-musl + RUSTFLAGS="-C target-feature=-crt-static" cargo build --target x86_64-unknown-linux-musl --release -p polar-c-api - name: Rename static lib run: mv target/release/libpolar.a target/libpolar-${{runner.os}}.a - name: Rename x86_64 static lib run: mv target/x86_64-unknown-linux-musl/release/libpolar.a target/libpolar-musl-x86_64.a - name: Rename aarch64 static lib run: mv target/aarch64-unknown-linux-musl/release/libpolar.a target/libpolar-musl-aarch64.a + - name: Rename x86_64 dynamic lib + run: mv target/release/libpolar.so target/libpolar-x86_64.so + - name: Rename aarch64 dynamic lib + run: mv target/aarch64-unknown-linux-gnu/release/libpolar.so target/libpolar-aarch64.so - uses: actions/upload-artifact@v2 with: name: oso_library - path: target/release/libpolar.so + path: | + target/libpolar-x86_64.so + target/libpolar-aarch64.so - uses: actions/upload-artifact@v2 with: name: oso_library @@ -106,7 +117,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.69.0 override: true - name: Build release library run: cargo build --release -p polar-c-api @@ -151,7 +162,7 @@ jobs: windows_libs: name: Build release libraries on Windows - runs-on: windows-latest + runs-on: windows-2019 needs: [version] steps: - uses: actions/checkout@v2 @@ -166,7 +177,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.69.0 override: true - name: Build release library run: cargo build --release -p polar-c-api @@ -252,7 +263,7 @@ jobs: - name: Copy libraries into resources. run: | mkdir -p languages/java/oso/src/main/resources/linux - cp -r oso_library/libpolar.so languages/java/oso/src/main/resources/linux/ + cp -r oso_library/libpolar-x86_64.so languages/java/oso/src/main/resources/linux/libpolar.so mkdir -p languages/java/oso/src/main/resources/macos cp -r oso_library/libpolar-macOS-fat.dylib languages/java/oso/src/main/resources/macos/libpolar.dylib mkdir -p languages/java/oso/src/main/resources/win @@ -280,7 +291,6 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: 2.4 working-directory: "languages/ruby" - name: Set version env id: version @@ -292,7 +302,8 @@ jobs: - name: Copy libraries into resources. run: | mkdir -p languages/ruby/ext/oso-oso/lib - cp -r oso_library/libpolar.so languages/ruby/ext/oso-oso/lib/ + cp -r oso_library/libpolar-x86_64.so languages/ruby/ext/oso-oso/lib/ + cp -r oso_library/libpolar-aarch64.so languages/ruby/ext/oso-oso/lib/ cp -r oso_library/libpolar-macOS-fat.dylib languages/ruby/ext/oso-oso/lib/libpolar.dylib cp -r oso_library/polar.dll languages/ruby/ext/oso-oso/lib/ - name: Test @@ -329,7 +340,7 @@ jobs: rm languages/python/oso/README.md cp README.md languages/python/oso/README.md - name: Build wheels - uses: pypa/cibuildwheel@v2.11.2 + uses: pypa/cibuildwheel@v2.16.2 env: # Skip Python 2.7 and Python 3.5 CIBW_SKIP: "cp27-* cp35-* pp27-*" @@ -364,7 +375,7 @@ jobs: rm languages/python/oso/README.md cp README.md languages/python/oso/README.md - name: Build wheels - uses: pypa/cibuildwheel@v2.11.2 + uses: pypa/cibuildwheel@v2.16.2 env: # Skip Python 2.7 and Python 3.5 CIBW_SKIP: "cp27-* cp35-* pp27-*" @@ -383,7 +394,7 @@ jobs: build_windows_wheels: name: Build wheels on Windows - runs-on: windows-latest + runs-on: windows-2019 needs: [version, windows_libs] steps: - uses: actions/checkout@v2 @@ -401,7 +412,7 @@ jobs: rm languages/python/oso/README.md cp README.md languages/python/oso/README.md - name: Build wheels - uses: pypa/cibuildwheel@v2.11.2 + uses: pypa/cibuildwheel@v2.16.2 env: # Skip Python 2.7 and Python 3.5 CIBW_SKIP: "cp27-* cp35-* pp27-*" @@ -438,7 +449,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.69.0 override: true - name: Add WebAssembly target run: rustup target add wasm32-unknown-unknown @@ -463,7 +474,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-11, windows-latest] + os: [ubuntu-latest, macos-11, windows-2019] go-version: ["1.14", "1.15", "1.16", "1.17"] steps: - uses: actions/checkout@v2 @@ -531,7 +542,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set version env @@ -560,7 +571,7 @@ jobs: runs-on: macos-11 strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set version env @@ -625,14 +636,21 @@ jobs: arch -arm64 ./venv311/bin/pip install oso==${{ steps.version.outputs.oso_version }} -f ../wheel arch -arm64 ./venv311/bin/python test.py working-directory: test + - name: "test python 3.12" + run: | + arch -arm64 /opt/homebrew/opt/python@3.12/bin/python3 -m venv venv312 + arch -arm64 ./venv312/bin/pip install oso==${{ steps.version.outputs.oso_version }} -f ../wheel --no-deps --no-index + arch -arm64 ./venv312/bin/pip install oso==${{ steps.version.outputs.oso_version }} -f ../wheel + arch -arm64 ./venv312/bin/python test.py + working-directory: test validate_python_windows: name: Test python ${{ matrix.python-version }} on Windows needs: [build_windows_wheels] - runs-on: windows-latest + runs-on: windows-2019 strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set version env @@ -661,7 +679,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set version env @@ -681,8 +699,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-11, windows-latest] - ruby-version: [2.4, 2.5, 2.6, 2.7, "3.0"] + os: [ubuntu-latest, macos-11, windows-2019] + ruby-version: ["2.6", "2.7", "3.0", "3.1", "3.2"] steps: - uses: actions/checkout@v2 - name: Set version env @@ -714,7 +732,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-11, windows-latest] + os: [ubuntu-latest, macos-11, windows-2019] java-version: [11, 12, 13, 14] steps: - uses: actions/checkout@v2 @@ -749,7 +767,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-11, windows-latest] + os: [ubuntu-latest, macos-11, windows-2019] node-version: ["12", "14", "16"] steps: - uses: actions/checkout@v2 @@ -794,11 +812,11 @@ jobs: uses: actions/setup-python@v1 with: python-version: "3.7" - - name: Use Ruby 2.4 + - name: Use Ruby 2.7 uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: "2.4" + ruby-version: "2.7" working-directory: "docs/examples/quickstart/ruby" - name: Use Node.js 12 uses: actions/setup-node@v1 @@ -812,7 +830,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.69.0 override: true - name: Use Go 1.14 uses: actions/setup-go@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8098af16ab..6c0b9482a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,7 +57,6 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: 2.4 working-directory: "languages/ruby" - name: Lint Ruby code working-directory: "languages/ruby" @@ -214,7 +213,6 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: 2.4 working-directory: "languages/ruby" - name: Test ruby run: make ruby-test @@ -350,8 +348,8 @@ jobs: - name: Install Ruby + gems uses: ruby/setup-ruby@v1 with: - ruby-version: 2.4 bundler-cache: true + working-directory: "languages/ruby" - name: Use Node.js 18 uses: actions/setup-node@v3 with: @@ -362,6 +360,8 @@ jobs: java-version: "11" - name: Build python lib run: make python-build + - name: Build ruby lib + run: make ruby-build - name: Python test deps run: make -C languages/python/oso test-requirements - name: Build js lib diff --git a/.gitignore b/.gitignore index 7246a61d40..06f06a361b 100644 --- a/.gitignore +++ b/.gitignore @@ -174,7 +174,6 @@ cython_debug/ # Java class files *.class -.ruby-version languages/java/oso/dependency-reduced-pom.xml languages/java/oso/src/main/resources/* diff --git a/Cargo.lock b/Cargo.lock index 73a8f153c3..f2c82bef56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -729,7 +729,7 @@ checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" [[package]] name = "oso" -version = "0.27.0" +version = "0.27.3" dependencies = [ "anyhow", "clap 3.2.23", @@ -753,7 +753,7 @@ dependencies = [ [[package]] name = "oso-derive" -version = "0.27.0" +version = "0.27.3" dependencies = [ "quote", "syn", @@ -867,7 +867,7 @@ dependencies = [ [[package]] name = "polar-c-api" -version = "0.27.0" +version = "0.27.3" dependencies = [ "cbindgen", "polar-core", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "polar-core" -version = "0.27.0" +version = "0.27.3" dependencies = [ "criterion", "indoc", @@ -897,7 +897,7 @@ dependencies = [ [[package]] name = "polar-language-server" -version = "0.27.0" +version = "0.27.3" dependencies = [ "console_error_panic_hook", "js-sys", @@ -911,7 +911,7 @@ dependencies = [ [[package]] name = "polar-wasm-api" -version = "0.27.0" +version = "0.27.3" dependencies = [ "console_error_panic_hook", "js-sys", diff --git a/Makefile b/Makefile index 446f9b270b..739d0f78bb 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,9 @@ python-django-test: python-build python-django-build python-sqlalchemy-test: python-build $(MAKE) -C languages/python/sqlalchemy-oso test +ruby-build: rust-build + $(MAKE) -C languages/ruby copy_lib + ruby-test: $(MAKE) -C languages/ruby test @@ -55,7 +58,7 @@ java-test: go-test: rust-build $(MAKE) -C languages/go test -docs-test: python-build +docs-test: python-build ruby-build $(MAKE) -C docs test fmt: fmt-java fmt-rust fmt-python fmt-js fmt-go diff --git a/README.md b/README.md index 2f99185267..6b3ac20cc5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +# Deprecated + +We have deprecated the legacy Oso open source library. We have plans for the next open source release and we’re looking forward to getting feedback from the community leading up to that point (please reach out to us in the Slack #help channel). In the meantime, if you’re happy using the Oso open source library now, nothing needs to change – i.e., we are not end-of-lifing (EOL) the library and we’ll continue to provide support and critical bug fixes. More context: [here](https://www.osohq.com/docs/oss/getting-started/deprecation.html). + # Oso [![Development][badge-ci]][badge-ci-link] @@ -15,6 +19,7 @@ Oso is a batteries-included framework for building authorization in your application. With Oso, you can: + - **Model**: Set up common permissions patterns like role-based access control (RBAC) and relationships using Oso’s built-in primitives. Extend them however you need with Oso’s declarative policy language, Polar. - **Filter**: Go beyond yes/no authorization questions. Implement authorization over collections too - e.g., “Show me only the records that Juno can see.” - **Test**: Write unit tests over your authorization logic now that you have a single interface for it. Use the Oso debugger or REPL to track down unexpected behavior. diff --git a/VERSION b/VERSION index 1b58cc1018..b38e1e76f5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.27.0 +0.27.3 diff --git a/docs/content/any/getting-started/deprecation.md b/docs/content/any/getting-started/deprecation.md new file mode 100644 index 0000000000..329989fb93 --- /dev/null +++ b/docs/content/any/getting-started/deprecation.md @@ -0,0 +1,48 @@ +--- +title: Deprecating the Oso Open Source Library +weight: 1 +any: true +hideContents: false +draft: false +--- + +# Deprecating the Oso Open Source Library + +**Date: 2023/12/18** + +Today we’re deprecating the legacy Oso open source library. We have plans for the next open source release and we’re looking forward to getting feedback from the community leading up to that point. In the meantime, if you’re happy using the Oso open source library now, nothing needs to change – i.e., we are not end-of-lifing (EOL) the library and we’ll continue to provide support and critical bug fixes. + +This post describes how we got here, what this change means for existing users, and what you can expect from Oso in the future. If you have questions, you can always reach out to us in our community Slack. + +### How we got here + +We started working on the Oso library in 2020. We believed that Polar could help developers with a piece of the authorization problem, and we turned out to be right. We worked with thousands of users to make Polar more intuitive and to solve some of the thornier problems in authorization, like data filtering. + +Through this process, we learned a ton about what was good and not so good about the Oso library. Polar – this was good! We have continued to lean into this. But over time we continued to see two main challenges with the implementation of the library: + +1. API boundary + 1. The Oso library centers around the [Foreign Function Interface (FFI)](https://doc.rust-lang.org/nomicon/ffi.html). + 2. While convenient in some ways, this abstraction has proved to be more confusing than useful. + 3. The upshot is a fuzzy API surface area for Oso, which created footguns for our users in setup and when debugging. +2. Performance + 1. Since the Oso library doesn’t store any data itself, it relies on your existing model (by definition) + 2. This led to unpredictable performance, especially for data filtering use cases + 3. The hooks into ORMs (for `sqlalchemy-oso` and `django-oso`) made it easier to set up the Oso library, but querying by way of the ORM also contributed to these performance challenges + +Based on feedback from our users, we decided to build [Oso Cloud](https://www.osohq.com/docs) to solve a set of problems that the library doesn’t solve – authorization for microservices. When we built Oso cloud, we wanted to apply what we’ve learned from the library’s API boundary and performance issues. This is what gave rise to the Facts API and Facts data model, respectively. To make this happen, we had a choice: try to refactor the existing library, or start from a clean slate. We chose the latter, which enabled us to leave our technical debt behind. This created a new challenge: ever since that point, we’ve had 2 codebases, 2 sets of libraries, and 2 documentation sites. + +This is neither good for our users nor good for us. It’s made it harder for us to maintain the Oso library, to build new features for it, and to support it. We want to fix that, but it’s going to take some time. + +### What we’re doing and what it means for users + +Our first step is to deprecate the Oso library. We’ve also moved the Oso library documentation to https://www.osohq.com/docs/oss. The implications for most existing users are: nothing. That is, if the Oso library is working for you, there’s no action required at the moment. + +Our plan is to start open sourcing core components of the latest Oso implementation from here. This will take time – we plan to do this over multiple releases. While the first things we open source will not be suitable for all use cases, we’re confident that the core architectural changes will be well worth it for the developer community. And over time, we plan to reach use case parity with what exists today. + +In the meantime, we’re not going anywhere. We’re committed to making critical bug fixes and providing best-efforts support if you’re having issues. We’re not planning to end of life (EOL) the Oso library for at least 12 months. And once we have a suitable replacement for the Oso library, we’ll provide documentation on how to migrate, as well as make ourselves available via Slack and Zoom, as always. + +### Oso’s open source future + +We know that deprecating software you’re using is inconvenient at best, but we believe this step is the best way to set up Oso and the broader development community for the long-term. + +We believe in the power of open source. This is the first step towards delivering a better and more sustainable open source Oso. While we aren’t sharing specifics on those just yet, we’re happy to share more details and hear your feedback 1x1. In particular, if there are areas you’d be interested to learn about and/or contribute, we’d love to hear it! And more generally, if you have any questions or feedback, feel free to reach out to us in Slack. diff --git a/docs/content/any/guides/data_filtering/index.md b/docs/content/any/guides/data_filtering/index.md index d247b53b21..6c04ebe35d 100644 --- a/docs/content/any/guides/data_filtering/index.md +++ b/docs/content/any/guides/data_filtering/index.md @@ -96,7 +96,7 @@ A `{{% exampleGet "filterName" %}}` is a representation of a query. It is very s It has four fields: - `{{% exampleGet "filterRoot" %}}` Is the name of the type we are filtering. -- {{% exampleGet "filterRelations" %}} Are named relations to other types, typically turned into joins. +- `{{% exampleGet "filterRelations" %}}` Are named relations to other types, typically turned into joins. - `{{% exampleGet "filterConditions" %}}` Are the individual pieces of logic that must be true with respect to objects matching the filter. These typically get turned into where clauses. - `{{% exampleGet "filterTypes" %}}` Is a map from type names to user type information, including registered relations. diff --git a/docs/content/any/project/changelogs/2022-12-05.md b/docs/content/any/project/changelogs/2022-12-05.md index 6485aed420..25e899b790 100644 --- a/docs/content/any/project/changelogs/2022-12-05.md +++ b/docs/content/any/project/changelogs/2022-12-05.md @@ -17,7 +17,7 @@ description: >- You should now be able to use `pip install oso` to get the latest Oso package. - Thanks to [`@kkirsche`](https://github.com/kkirsche) help with this! + Thanks to [`@kkirsche`](https://github.com/kkirsche) for help with this! #### Other bugs & improvements diff --git a/docs/content/any/project/changelogs/2023-12-18.md b/docs/content/any/project/changelogs/2023-12-18.md new file mode 100644 index 0000000000..25f5ef7e34 --- /dev/null +++ b/docs/content/any/project/changelogs/2023-12-18.md @@ -0,0 +1,12 @@ +--- +title: 2023-12-18 Deprecation Notice +menuTitle: 2023-12-18 Deprecation Notice +any: true +description: >- + Oso Library deprecation notice +draft: false +--- + +## `oso` 0.27.1 + +We have deprecated the legacy Oso open source library. We have plans for the next open source release and we’re looking forward to getting feedback from the community leading up to that point (please reach out to us in the Slack #help channel). In the meantime, if you’re happy using the Oso open source library now, nothing needs to change – i.e., we are not end-of-lifing (EOL) the library and we’ll continue to provide support and critical bug fixes. More context: [here](https://www.osohq.com/docs/oss/getting-started/deprecation.html). diff --git a/docs/content/any/project/changelogs/2023-12-20.md b/docs/content/any/project/changelogs/2023-12-20.md new file mode 100644 index 0000000000..58c3029a0e --- /dev/null +++ b/docs/content/any/project/changelogs/2023-12-20.md @@ -0,0 +1,20 @@ +--- +title: Release 2023-12-20 +menuTitle: 2023-12-20 +any: true +description: >- + Changelog for Release 2023-12-20 (oso 0.27.2) containing new features, bug + fixes, and more. +draft: true +--- + +## `oso` 0.27.2 + +### Python + +#### New features + +##### Python 3.12 Support + +Thanks to [`@kkirsche`](https://github.com/kkirsche), the Oso library now +works on Python 3.12. diff --git a/docs/content/any/project/changelogs/2024-01-12.md b/docs/content/any/project/changelogs/2024-01-12.md new file mode 100644 index 0000000000..382204bdb1 --- /dev/null +++ b/docs/content/any/project/changelogs/2024-01-12.md @@ -0,0 +1,21 @@ +--- +title: Release 2024-01-12 +menuTitle: 2024-01-12 +any: true +description: >- + Changelog for Release 2024-01-12 (0.27.3) containing new features, + bug fixes, and more. +--- + +## `oso` 0.27.3 + +### Ruby + +#### New features + +##### Linux AArch64 support + +You can now run the `oso-oso` gem in AArch64 Linux environments, including in +Docker on Apple silicon. + +Thanks to [`@jdeff`](https://github.com/jdeff) for the contribution! diff --git a/docs/content/any/project/changelogs/NEXT.md b/docs/content/any/project/changelogs/NEXT.md index 28ca524d38..e2c15a74ed 100644 --- a/docs/content/any/project/changelogs/NEXT.md +++ b/docs/content/any/project/changelogs/NEXT.md @@ -8,9 +8,9 @@ description: >- draft: true --- -## `oso` NEW_VERSION +## `RELEASED_PACKAGE_1` NEW_VERSION -### Core +### LANGUAGE (e.g., 'Core' or 'Python' or 'Node.js') #### Breaking changes @@ -37,6 +37,6 @@ Link to [relevant documentation section](). #### Other bugs & improvements -- Thank you to [`FinnRG`](https://github.com/FinnRG) and - [`onalante-msft`](https://github.com/onalante-msft) for updating dependencies - across the core, the C API crate, and the Rust language library. +- Bulleted list +- Of smaller improvements +- Potentially with doc [links](). diff --git a/docs/content/any/project/old-docs.md b/docs/content/any/project/old-docs.md deleted file mode 100644 index 94af3f0e2a..0000000000 --- a/docs/content/any/project/old-docs.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: 0.15 Documentation -weight: 2 -href: https://docs.osohq.com/v/0.15/index.html -_build: - render: never ---- diff --git a/docs/examples/Makefile b/docs/examples/Makefile index 5b9a0475d8..dfe2f8eef6 100644 --- a/docs/examples/Makefile +++ b/docs/examples/Makefile @@ -7,7 +7,7 @@ JS_DIR := $(OSO_ROOT)/languages/js RUBY_DIR := $(OSO_ROOT)/languages/ruby # Needed for tests -JAVA_PACKAGE_JAR_PATH := $(JAVA_DIR)/oso/target/oso-0.27.0.jar +JAVA_PACKAGE_JAR_PATH := $(JAVA_DIR)/oso/target/oso-0.27.3.jar # Note: if you are using bundler in a sub-makefile (in a docs test for example), # you need to add `unexport BUNDLE_GEMFILE` to that makefile. Otherwise this diff --git a/docs/spelling/allowed_words.txt b/docs/spelling/allowed_words.txt index 57c3b97d38..b942a3b06c 100644 --- a/docs/spelling/allowed_words.txt +++ b/docs/spelling/allowed_words.txt @@ -1,3 +1,4 @@ +AArch ABAC AGPL APIs @@ -19,6 +20,7 @@ DFA Dexec EMR EOF +EOL EndsWith FFI ForbiddenError @@ -121,6 +123,7 @@ changelog classpath cmp codebase +codebases constructable coroutine customizations @@ -148,6 +151,7 @@ favoriteAnimal fieldName filesystem filterRelation +footguns forbiddenerror fromFieldName fromTypeName @@ -175,6 +179,7 @@ lastLogin latencies lhs lifecycle +lifing loadFile loadStr localhost diff --git a/languages/go/README.md b/languages/go/README.md index 91476e3074..be7da47265 100644 --- a/languages/go/README.md +++ b/languages/go/README.md @@ -1,3 +1,7 @@ +# Deprecated + +We have deprecated the legacy Oso open source library. We have plans for the next open source release and we’re looking forward to getting feedback from the community leading up to that point (please reach out to us in the Slack #help channel). In the meantime, if you’re happy using the Oso open source library now, nothing needs to change – i.e., we are not end-of-lifing (EOL) the library and we’ll continue to provide support and critical bug fixes. (Link to Docs message) (We released a writeup with more context) + # Oso go library This is the publish repository for the oso go library. It contains prebuilt oso-core @@ -10,4 +14,4 @@ All development happens on https://github.com/osohq/oso. ``` import "github.com/osohq/go-oso" ... -``` \ No newline at end of file +``` diff --git a/languages/java/oso/pom.xml b/languages/java/oso/pom.xml index 1df9e689bd..3a34f9173f 100644 --- a/languages/java/oso/pom.xml +++ b/languages/java/oso/pom.xml @@ -12,7 +12,7 @@ com.osohq oso - 0.27.0 + 0.27.3 diff --git a/languages/js/package.json b/languages/js/package.json index 6df7dfe193..10a6dec7e2 100644 --- a/languages/js/package.json +++ b/languages/js/package.json @@ -1,6 +1,6 @@ { "name": "oso", - "version": "0.27.0", + "version": "0.27.3", "description": "oso authorization library.", "bin": "bin/repl.js", "main": "dist/src/index.js", diff --git a/languages/python/django-oso/django_oso/__init__.py b/languages/python/django-oso/django_oso/__init__.py index fdca3dc745..6e5af9b0d8 100644 --- a/languages/python/django-oso/django_oso/__init__.py +++ b/languages/python/django-oso/django_oso/__init__.py @@ -3,7 +3,7 @@ from .oso import Oso -__version__ = "0.27.0" +__version__ = "0.27.1" if django.VERSION < (3, 2): default_app_config = "django_oso.apps.DjangoOsoConfig" diff --git a/languages/python/django-oso/requirements.txt b/languages/python/django-oso/requirements.txt index 18f1370d52..198f49c8da 100644 --- a/languages/python/django-oso/requirements.txt +++ b/languages/python/django-oso/requirements.txt @@ -1,2 +1,2 @@ -oso~=0.27.0 +oso~=0.27.1 django>=2.2 diff --git a/languages/python/docs/conf.py b/languages/python/docs/conf.py index c43b351d36..aaf97a0610 100644 --- a/languages/python/docs/conf.py +++ b/languages/python/docs/conf.py @@ -42,8 +42,8 @@ project = "oso" copyright = "2020-2021 Oso Security, Inc" author = "oso" -version = "0.27.0" -release = "0.27.0" +version = "0.27.3" +release = "0.27.3" # -- General configuration --------------------------------------------------- diff --git a/languages/python/flask-oso/flask_oso/__init__.py b/languages/python/flask-oso/flask_oso/__init__.py index 4f77015f7d..60cb66b790 100644 --- a/languages/python/flask-oso/flask_oso/__init__.py +++ b/languages/python/flask-oso/flask_oso/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.27.0" +__version__ = "0.27.1" from .decorators import authorize, skip_authorization from .flask_oso import FlaskOso diff --git a/languages/python/flask-oso/requirements.txt b/languages/python/flask-oso/requirements.txt index d298232197..4c46aa1f70 100644 --- a/languages/python/flask-oso/requirements.txt +++ b/languages/python/flask-oso/requirements.txt @@ -1,3 +1,3 @@ -oso~=0.27.0 +oso~=0.27.1 flask==2.1.0 werkzeug==2.0.3 diff --git a/languages/python/oso/oso/oso.py b/languages/python/oso/oso/oso.py index 0622999847..8f6edc458b 100644 --- a/languages/python/oso/oso/oso.py +++ b/languages/python/oso/oso/oso.py @@ -1,6 +1,6 @@ """Core oso functionality""" -__version__ = "0.27.0" +__version__ = "0.27.3" import os from typing import Any, List, Set, Type diff --git a/languages/python/sqlalchemy-oso/requirements.txt b/languages/python/sqlalchemy-oso/requirements.txt index ca985eddb5..185f3dde03 100644 --- a/languages/python/sqlalchemy-oso/requirements.txt +++ b/languages/python/sqlalchemy-oso/requirements.txt @@ -1,3 +1,3 @@ oso~=0.27.0 -SQLAlchemy>=1.3.17 +SQLAlchemy>=1.3.17,<3.0 packaging>=21.3,<24.0 diff --git a/languages/python/sqlalchemy-oso/sqlalchemy_oso/session.py b/languages/python/sqlalchemy-oso/sqlalchemy_oso/session.py index 18e651c229..61986d12fb 100644 --- a/languages/python/sqlalchemy-oso/sqlalchemy_oso/session.py +++ b/languages/python/sqlalchemy-oso/sqlalchemy_oso/session.py @@ -301,7 +301,7 @@ def do_orm_execute(execute_state): return entities = all_entities_in_statement(execute_state.statement) - logger.info(f"Authorizing entities: {entities}") + logger.debug(f"Authorizing entities: {entities}") for entity in entities: action = checked_permissions.get(entity) @@ -316,7 +316,7 @@ def do_orm_execute(execute_state): else: filter = authorize_model(oso, user, action, session, entity) if filter is not None: - logger.info(f"Applying filter {filter} to entity {entity}") + logger.debug(f"Applying filter {filter} to entity {entity}") where = with_loader_criteria(entity, filter, include_aliases=True) execute_state.statement = execute_state.statement.options(where) else: diff --git a/languages/ruby/.gitignore b/languages/ruby/.gitignore index ae0efc3a99..7bc09d589e 100644 --- a/languages/ruby/.gitignore +++ b/languages/ruby/.gitignore @@ -11,3 +11,4 @@ vendor # rspec failure tracking .rspec_status +ext diff --git a/languages/ruby/.rubocop.yml b/languages/ruby/.rubocop.yml index c58f59b6f2..8ee21a6b58 100644 --- a/languages/ruby/.rubocop.yml +++ b/languages/ruby/.rubocop.yml @@ -1,10 +1,50 @@ AllCops: - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.6 Exclude: - "**/*~" - "bin/oso" - "vendor/**/*" NewCops: enable + SuggestExtensions: false + Naming/FileName: Exclude: - "lib/oso-oso.rb" + +Layout/EmptyLineBetweenDefs: + Enabled: false +Layout/LineContinuationSpacing: + Enabled: false + +Gemspec/RequireMFA: + Enabled: false +Gemspec/DevelopmentDependencies: + Enabled: false + +Lint/ConstantDefinitionInBlock: + Enabled: false +Lint/SymbolConversion: + Enabled: false +Lint/NonAtomicFileOperation: + Enabled: false +Lint/EmptyBlock: + Enabled: false +Lint/AmbiguousOperatorPrecedence: + Enabled: false + +Style/FetchEnvVar: + Enabled: false +Style/RedundantCurrentDirectoryInPath: + Enabled: false +Style/QuotedSymbols: + Enabled: false +Style/RedundantConstantBase: + Enabled: false +Style/RedundantInitialize: + Enabled: false +Style/CommentAnnotation: + Enabled: false +Style/FileRead: + Enabled: false +Style/HashConversion: + Enabled: false diff --git a/languages/ruby/.ruby-version b/languages/ruby/.ruby-version new file mode 100644 index 0000000000..be94e6f53d --- /dev/null +++ b/languages/ruby/.ruby-version @@ -0,0 +1 @@ +3.2.2 diff --git a/languages/ruby/Gemfile.lock b/languages/ruby/Gemfile.lock index 39bb76e98b..17278f2993 100644 --- a/languages/ruby/Gemfile.lock +++ b/languages/ruby/Gemfile.lock @@ -1,104 +1,135 @@ PATH remote: . specs: - oso-oso (0.27.0) + oso-oso (0.27.3) ffi (~> 1.0) GEM remote: https://rubygems.org/ specs: - activemodel (5.2.6) - activesupport (= 5.2.6) - activerecord (5.2.6) - activemodel (= 5.2.6) - activesupport (= 5.2.6) - arel (>= 9.0) - activesupport (5.2.6) + activemodel (7.1.2) + activesupport (= 7.1.2) + activerecord (7.1.2) + activemodel (= 7.1.2) + activesupport (= 7.1.2) + timeout (>= 0.4.0) + activesupport (7.1.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - arel (9.0.0) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) ast (2.4.2) backport (1.2.0) - benchmark (0.2.0) + base64 (0.2.0) + benchmark (0.3.0) + bigdecimal (3.1.4) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.9) - diff-lcs (1.4.4) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) + diff-lcs (1.5.0) + drb (2.2.0) + ruby2_keywords e2mmap (0.1.0) - ffi (1.15.4) - i18n (1.8.11) + ffi (1.16.3) + i18n (1.14.1) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.4) - maruku (0.7.3) + jaro_winkler (1.5.6) + json (2.7.1) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + language_server-protocol (3.17.0.3) method_source (1.0.0) - mini_portile2 (2.4.0) - minitest (5.14.4) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) - parallel (1.20.1) - parser (2.7.2.0) + mini_portile2 (2.8.5) + minitest (5.20.0) + mutex_m (0.2.0) + nokogiri (1.15.5) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + nokogiri (1.15.5-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.15.5-x86_64-linux) + racc (~> 1.4) + parallel (1.23.0) + parser (3.2.2.4) ast (~> 2.4.1) - pry (0.13.1) + racc + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.9.0) + pry-byebug (3.10.1) byebug (~> 11.0) - pry (~> 0.13.0) - rainbow (3.0.0) + pry (>= 0.13, < 0.15) + racc (1.7.3) + rainbow (3.1.1) rake (12.3.3) - regexp_parser (2.1.1) + rbs (2.8.4) + regexp_parser (2.8.3) reverse_markdown (2.1.1) nokogiri - rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-support (3.10.3) - rubocop (0.89.1) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rubocop (1.58.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.1.1) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) - rexml - rubocop-ast (>= 0.3.0, < 1.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.8.0) - parser (>= 2.7.1.5) - ruby-progressbar (1.11.0) - solargraph (0.39.17) - backport (~> 1.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) + solargraph (0.49.0) + backport (~> 1.2) benchmark - bundler (>= 1.17.2) + bundler (~> 2.0) + diff-lcs (~> 1.4) e2mmap jaro_winkler (~> 1.5) - maruku (~> 0.7, >= 0.7.3) - nokogiri (~> 1.9, >= 1.9.1) - parser (~> 2.3) - reverse_markdown (>= 1.0.5, < 3) - rubocop (~> 0.52) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.1) + parser (~> 3.0) + rbs (~> 2.0) + reverse_markdown (~> 2.0) + rubocop (~> 1.38) thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) - sqlite3 (1.4.2) - thor (1.1.0) - thread_safe (0.3.6) - tilt (2.0.10) - tzinfo (1.2.9) - thread_safe (~> 0.1) - unicode-display_width (1.8.0) - yard (0.9.26) + sqlite3 (1.6.9) + mini_portile2 (~> 2.8.0) + sqlite3 (1.6.9-x86_64-darwin) + sqlite3 (1.6.9-x86_64-linux) + thor (1.3.0) + tilt (2.3.0) + timeout (0.4.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + yard (0.9.34) PLATFORMS ruby @@ -108,13 +139,13 @@ PLATFORMS DEPENDENCIES activerecord oso-oso! - pry-byebug (~> 3.9.0) + pry-byebug (~> 3.10.1) rake (~> 12.0) rspec (~> 3.0) - rubocop (~> 0.89.1) - solargraph (~> 0.39.14) + rubocop (~> 1.58.0) + solargraph (~> 0.49.0) sqlite3 yard (~> 0.9.25) BUNDLED WITH - 2.2.4 + 2.4.22 diff --git a/languages/ruby/Makefile b/languages/ruby/Makefile index d2e36f7eb9..79c5889d8e 100644 --- a/languages/ruby/Makefile +++ b/languages/ruby/Makefile @@ -1,12 +1,28 @@ -.PHONY: rust install test lint typecheck repl +.PHONY: rust copy_lib install test lint typecheck repl + +UNAME_S := $(shell uname -s) +UNAME_M := $(shell uname -m) rust: $(MAKE) -C ../.. rust-build +copy_lib: + mkdir -p ext/oso-oso/lib/ +ifeq ($(UNAME_S),Linux) +ifeq ($(UNAME_M),x86_64) + cp ../../target/debug/libpolar.so ext/oso-oso/lib/libpolar-x86_64.so +else + cp ../../target/debug/libpolar.so ext/oso-oso/lib/libpolar-aarch64.so +endif +endif +ifeq ($(UNAME_S),Darwin) + cp ../../target/debug/libpolar.dylib ext/oso-oso/lib/ +endif + install: bundle install -test: install rust +test: install rust copy_lib POLAR_IGNORE_NO_ALLOW_WARNING=1 bundle exec rake spec lint: install @@ -15,5 +31,5 @@ lint: install typecheck: install bundle exec solargraph typecheck -repl: install rust +repl: install rust copy_lib bundle exec oso diff --git a/languages/ruby/lib/oso/polar/ffi.rb b/languages/ruby/lib/oso/polar/ffi.rb index e4a52d4a46..23e0abd07d 100644 --- a/languages/ruby/lib/oso/polar/ffi.rb +++ b/languages/ruby/lib/oso/polar/ffi.rb @@ -6,12 +6,17 @@ module Oso module Polar # FFI classes shared between all ffi/*.rb modules module FFI - LIB = "#{::FFI::Platform::LIBPREFIX}polar.#{::FFI::Platform::LIBSUFFIX}" - RELEASE_PATH = File.expand_path(File.join(__dir__, "../../../ext/oso-oso/lib/#{LIB}")) - DEV_PATH = File.expand_path(File.join(__dir__, "../../../../../target/debug/#{LIB}")) - # If the lib exists in the ext/ dir, use it. Otherwise, fall back to - # checking the local Rust target dir. - LIB_PATH = File.file?(RELEASE_PATH) ? RELEASE_PATH : DEV_PATH + LIB = + case ::FFI::Platform::OS + when /darwin/ + 'libpolar.dylib' + when /windows|cygwin|msys/ + 'polar.dll' + else + "libpolar-#{::FFI::Platform::ARCH}.so" + end + + LIB_PATH = File.expand_path(File.join(__dir__, "../../../ext/oso-oso/lib/#{LIB}")) # Wrapper classes defined upfront to fix Ruby loading issues. Actual # implementations live in the sibling `ffi/` directory and are `require`d diff --git a/languages/ruby/lib/oso/polar/polar.rb b/languages/ruby/lib/oso/polar/polar.rb index 5aa87095b3..0006286d28 100644 --- a/languages/ruby/lib/oso/polar/polar.rb +++ b/languages/ruby/lib/oso/polar/polar.rb @@ -153,14 +153,11 @@ def load_str(str, filename: nil) # Query for a Polar predicate or string. # - # @overload query(query) - # @param query [String] - # @return [Enumerator] of resulting bindings - # @raise [Error] if the FFI call raises one. - # @overload query(query) - # @param query [Predicate] - # @return [Enumerator] of resulting bindings - # @raise [Error] if the FFI call raises one. + # @param query [String, Predicate] + # @param host [Host] + # @param bindings [Hash] + # @return [Enumerator] of resulting bindings + # @raise [Error] if the FFI call raises one. def query(query, host: self.host.dup, bindings: {}) case query when String diff --git a/languages/ruby/lib/oso/version.rb b/languages/ruby/lib/oso/version.rb index acece74c2f..4ac63e09aa 100644 --- a/languages/ruby/lib/oso/version.rb +++ b/languages/ruby/lib/oso/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Oso - VERSION = '0.27.0' + VERSION = '0.27.3' end diff --git a/languages/ruby/oso-oso.gemspec b/languages/ruby/oso-oso.gemspec index 68a98be5fd..22c2979696 100644 --- a/languages/ruby/oso-oso.gemspec +++ b/languages/ruby/oso-oso.gemspec @@ -8,10 +8,15 @@ Gem::Specification.new do |spec| spec.authors = ['Oso Security, Inc.'] spec.email = ['support@osohq.com'] spec.licenses = ['Apache-2.0'] - spec.summary = 'Oso authorization library.' + spec.summary = 'We have deprecated the legacy Oso open source library. We have plans for the next open ' \ + "source release and we're looking forward to getting feedback from the community leading up " \ + 'to that point (please reach out to us in the Slack #help channel). In the meantime, if ' \ + "you're happy using the Oso open source library now, nothing needs to change – i.e., we are " \ + "not end-of-lifing (EOL) the library and we'll continue to provide support and critical bug " \ + 'fixes. More context: [here](https://www.osohq.com/docs/oss/getting-started/deprecation.html).' spec.homepage = 'https://www.osohq.com/' - spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0') + spec.required_ruby_version = Gem::Requirement.new('>= 2.6.10') spec.metadata['homepage_uri'] = spec.homepage spec.metadata['source_code_uri'] = 'https://github.com/osohq/oso' @@ -32,11 +37,11 @@ Gem::Specification.new do |spec| # Development dependencies spec.add_development_dependency 'activerecord' - spec.add_development_dependency 'pry-byebug', '~> 3.9.0' + spec.add_development_dependency 'pry-byebug', '~> 3.10.1' spec.add_development_dependency 'rake', '~> 12.0' spec.add_development_dependency 'rspec', '~> 3.0' - spec.add_development_dependency 'rubocop', '~> 0.89.1' - spec.add_development_dependency 'solargraph', '~> 0.39.14' + spec.add_development_dependency 'rubocop', '~> 1.58.0' + spec.add_development_dependency 'solargraph', '~> 0.49.0' spec.add_development_dependency 'sqlite3' spec.add_development_dependency 'yard', '~> 0.9.25' end diff --git a/languages/ruby/spec/oso/polar/data_filtering/gitclub_spec.rb b/languages/ruby/spec/oso/polar/data_filtering/gitclub_spec.rb index a9577dfd68..d77376bdd1 100644 --- a/languages/ruby/spec/oso/polar/data_filtering/gitclub_spec.rb +++ b/languages/ruby/spec/oso/polar/data_filtering/gitclub_spec.rb @@ -3,6 +3,7 @@ require_relative './helpers' require 'sqlite3' require 'active_record' +require 'oso/polar/data/adapter/active_record_adapter' DB_FILE = 'gitclub_test.db' RSpec.describe Oso::Oso do # rubocop:disable Metrics/BlockLength diff --git a/languages/rust/oso-derive/Cargo.toml b/languages/rust/oso-derive/Cargo.toml index c462e5fb11..047f43d59f 100644 --- a/languages/rust/oso-derive/Cargo.toml +++ b/languages/rust/oso-derive/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/osohq/oso" homepage = "https://www.osohq.com/" readme = "README.md" -version = "0.27.0" +version = "0.27.3" edition = "2021" diff --git a/languages/rust/oso/Cargo.toml b/languages/rust/oso/Cargo.toml index ab293ee4d6..be7b4a5352 100644 --- a/languages/rust/oso/Cargo.toml +++ b/languages/rust/oso/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" name = "oso" readme = "README.md" -version = "0.27.0" +version = "0.27.3" edition = "2021" @@ -31,8 +31,8 @@ required-features = ["anyhow"] [dependencies] impl-trait-for-tuples = "0.2.1" maplit = "1.0.2" -oso-derive = { path = "../oso-derive", version = "=0.27.0", optional = true } -polar-core = { path = "../../../polar-core", version = "=0.27.0" } +oso-derive = { path = "../oso-derive", version = "=0.27.3", optional = true } +polar-core = { path = "../../../polar-core", version = "=0.27.3" } thiserror = "1.0.30" tracing = { version = "0.1.29", features = ["log"] } @@ -52,7 +52,7 @@ uuid-10 = { package = "uuid", version = ">=1.0.0, <2.0.0", optional = true } [dev-dependencies] anyhow = "1.0.44" criterion = { version = "0.3.5", default-features = false } -oso-derive = { path = "../oso-derive", version = "=0.27.0" } +oso-derive = { path = "../oso-derive", version = "=0.27.3" } static_assertions = "1.1.0" tempfile = "3.2.0" tracing-subscriber = { version = "0.3.1", default-features = false, features = [ diff --git a/languages/rust/oso/tests/test_polar.rs b/languages/rust/oso/tests/test_polar.rs index 598820bc00..da367df9cc 100644 --- a/languages/rust/oso/tests/test_polar.rs +++ b/languages/rust/oso/tests/test_polar.rs @@ -119,7 +119,7 @@ fn test_data_conversions_polar_values() -> oso::Result<()> { // TODO (dhatch): Type handling: Would be great to be able to get each index // out here dynamically, the same way we can with result set. if let PolarValue::List(x_vec) = v_x { - assert_eq!(i64::from_polar(x_vec.get(0).unwrap().to_owned())?, 1); + assert_eq!(i64::from_polar(x_vec.first().unwrap().to_owned())?, 1); assert_eq!( String::from_polar(x_vec.get(1).unwrap().to_owned())?, String::from("two") @@ -328,7 +328,7 @@ fn test_basic_queries() { assert_eq!(results.len(), 1); assert!(results - .get(0) + .first() .map(|r| r.keys().next().is_none()) .unwrap_or_default()); } diff --git a/polar-c-api/Cargo.toml b/polar-c-api/Cargo.toml index 1b31f448aa..57f17bc130 100644 --- a/polar-c-api/Cargo.toml +++ b/polar-c-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polar-c-api" -version = "0.27.0" +version = "0.27.3" authors = ["Oso Security, Inc. "] edition = "2021" @@ -10,7 +10,7 @@ crate-type = ["lib", "staticlib", "cdylib"] bench = false [dependencies] -polar-core = { path = "../polar-core", version = "=0.27.0" } +polar-core = { path = "../polar-core", version = "=0.27.3" } serde = "1.0" serde_json = "1.0.61" diff --git a/polar-c-api/src/lib.rs b/polar-c-api/src/lib.rs index 98c356862b..f88c4ea1bd 100644 --- a/polar-c-api/src/lib.rs +++ b/polar-c-api/src/lib.rs @@ -329,7 +329,9 @@ pub extern "C" fn string_free(s: *mut c_char) -> i32 { if s.is_null() { return POLAR_FAILURE; } - unsafe { CString::from_raw(s) }; + unsafe { + let _ = CString::from_raw(s); + }; POLAR_SUCCESS } diff --git a/polar-core/Cargo.toml b/polar-core/Cargo.toml index 0e4d1c2682..6719a8e6bd 100644 --- a/polar-core/Cargo.toml +++ b/polar-core/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/osohq/oso" homepage = "https://www.osohq.com/" readme = "README.md" -version = "0.27.0" +version = "0.27.3" edition = "2021" diff --git a/polar-core/src/data_filtering.rs b/polar-core/src/data_filtering.rs index 21b9969320..326ca062a9 100644 --- a/polar-core/src/data_filtering.rs +++ b/polar-core/src/data_filtering.rs @@ -211,9 +211,8 @@ impl VarInfo { } fn do_and(self, args: &[Term]) -> PolarResult { - args.iter().fold(Ok(self), |this, arg| { - this?.process_exp(arg.as_expression()?) - }) + args.iter() + .try_fold(self, |this, arg| this.process_exp(arg.as_expression()?)) } fn do_dot(mut self, lhs: &Term, rhs: &Term) -> Self { @@ -795,8 +794,7 @@ impl<'a> ResultSetBuilder<'a> { fn constrain_fields(&mut self, id: Id, var_type: &str) -> PolarResult<&mut Self> { match self.vars.field_relationships.get(&id) { None => Ok(self), - Some(fs) => fs.iter().fold(Ok(self), |this, (field, child)| { - let this = this?; + Some(fs) => fs.iter().try_fold(self, |this, (field, child)| { match this.types.get(var_type).and_then(|m| m.get(field)) { None => df_field_missing(var_type, field), Some(Type::Relation { @@ -991,7 +989,7 @@ where A: Eq + Hash, B: Eq + Hash, { - map.entry(a).or_insert_with(HashSet::new).insert(b); + map.entry(a).or_default().insert(b); map } diff --git a/polar-core/src/formatting.rs b/polar-core/src/formatting.rs index eb30b7b6a1..af4ddba36a 100644 --- a/polar-core/src/formatting.rs +++ b/polar-core/src/formatting.rs @@ -574,7 +574,7 @@ mod to_polar { if args.is_empty() { kwargs } else { - vec![args, kwargs].join(", ") + [args, kwargs].join(", ") } } None => args, diff --git a/polar-core/src/lexer.rs b/polar-core/src/lexer.rs index c97b197778..1f1ec81754 100644 --- a/polar-core/src/lexer.rs +++ b/polar-core/src/lexer.rs @@ -518,14 +518,14 @@ mod tests { lexer.next(), Some(Ok((_, Token::Integer(123), _))) )); - assert!(matches!(lexer.next(), None)); + assert!(lexer.next().is_none()); let s = "123 #comment"; let mut lexer = Lexer::new(s); assert!(matches!( lexer.next(), Some(Ok((_, Token::Integer(123), _))) )); - assert!(matches!(lexer.next(), None)); + assert!(lexer.next().is_none()); } #[test] @@ -595,14 +595,14 @@ mod tests { assert!( matches!(lexer.next(), Some(Ok((4, Token::Symbol(x), 7))) if x == Symbol::new("bar")) ); - assert!(matches!(lexer.next(), None)); + assert!(lexer.next().is_none()); let s = "foo::bar"; let mut lexer = Lexer::new(s); assert!( matches!(lexer.next(), Some(Ok((0, Token::Symbol(x), 8))) if x == Symbol::new("foo::bar")) ); - assert!(matches!(lexer.next(), None)); + assert!(lexer.next().is_none()); let s = "foo:::bar"; let mut lexer = Lexer::new(s); @@ -651,7 +651,7 @@ mod tests { assert!( matches!(lexer.next(), Some(Ok((66, Token::Symbol(ruby_namespace), 81))) if ruby_namespace == Symbol::new("Ruby::Namespace")) ); - assert!(matches!(lexer.next(), None)); + assert!(lexer.next().is_none()); } #[test] diff --git a/polar-core/src/partial/simplify.rs b/polar-core/src/partial/simplify.rs index db76f83029..da634df0ea 100644 --- a/polar-core/src/partial/simplify.rs +++ b/polar-core/src/partial/simplify.rs @@ -286,8 +286,8 @@ impl PerfCounters { return; } - self.simplify_term.extend(other.simplify_term.into_iter()); - self.preprocess_and.extend(other.preprocess_and.into_iter()); + self.simplify_term.extend(other.simplify_term); + self.preprocess_and.extend(other.preprocess_and); } pub fn is_enabled(&self) -> bool { diff --git a/polar-core/src/rules.rs b/polar-core/src/rules.rs index d65a3d7a5e..a88b358e71 100644 --- a/polar-core/src/rules.rs +++ b/polar-core/src/rules.rs @@ -122,7 +122,7 @@ impl RuleTypes { pub fn add(&mut self, rule_type: Rule) { let name = rule_type.name.clone(); // get rule types with this rule name - let rule_types = self.0.entry(name).or_insert_with(Vec::new); + let rule_types = self.0.entry(name).or_default(); rule_types.push(rule_type); } @@ -161,7 +161,7 @@ impl RuleIndex { None } }) - .or_insert_with(RuleIndex::default) + .or_default() .index_rule(rule_id, params, i + 1); } else { self.rules.insert(rule_id); @@ -180,8 +180,8 @@ impl RuleIndex { let mut ruleset = self .index .get(&Some(arg.clone())) - .map(|index| filter_next_args(index)) - .unwrap_or_else(RuleSet::default); + .map(filter_next_args) + .unwrap_or_default(); // Extend for a variable parameter. if let Some(index) = self.index.get(&None) { @@ -193,7 +193,7 @@ impl RuleIndex { self.index.values().fold( RuleSet::default(), |mut result: RuleSet, index: &RuleIndex| { - result.extend(filter_next_args(index).into_iter()); + result.extend(filter_next_args(index)); result }, ) diff --git a/polar-core/src/vm.rs b/polar-core/src/vm.rs index daacb57f91..74f4cdbabd 100644 --- a/polar-core/src/vm.rs +++ b/polar-core/src/vm.rs @@ -832,7 +832,7 @@ impl PolarVirtualMachine { trace = trace_stack .pop() .map(|ts| ts.as_ref().clone()) - .unwrap_or_else(Vec::new); + .unwrap_or_default(); } stack.reverse(); @@ -1261,7 +1261,7 @@ impl PolarVirtualMachine { }); let mut add_constraints = vec![type_constraint]; - add_constraints.extend(field_constraints.into_iter()); + add_constraints.extend(field_constraints); // Run compatibility check. self.choose_conditional( diff --git a/polar-language-server/Cargo.toml b/polar-language-server/Cargo.toml index 66b685b5d8..e74ac3306f 100644 --- a/polar-language-server/Cargo.toml +++ b/polar-language-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polar-language-server" -version = "0.27.0" +version = "0.27.3" authors = ["Oso Security, Inc. "] edition = "2021" @@ -12,7 +12,7 @@ bench = false console_error_panic_hook = "0.1.6" js-sys = "0.3.53" lsp-types = "0.90.0" -polar-core = { path = "../polar-core", version = "=0.27.0" } +polar-core = { path = "../polar-core", version = "=0.27.3" } serde = { version = "1.0", features = ["derive"] } serde-wasm-bindgen = "0.3.1" wasm-bindgen = "0.2.76" diff --git a/polar-language-server/src/lib.rs b/polar-language-server/src/lib.rs index 7c90cb2289..fda02c1c4e 100644 --- a/polar-language-server/src/lib.rs +++ b/polar-language-server/src/lib.rs @@ -604,7 +604,7 @@ mod tests { assert_eq!(params.uri, doc.uri); assert_eq!(params.version.unwrap(), doc.version); assert_eq!(params.diagnostics.len(), 1, "{}", doc.uri); - let diagnostic = params.diagnostics.get(0).unwrap(); + let diagnostic = params.diagnostics.first().unwrap(); assert_eq!( diagnostic.message, "hit the end of the file unexpectedly. Did you forget a semi-colon" @@ -629,7 +629,7 @@ mod tests { assert_eq!(params.uri, doc.uri); assert_eq!(params.version.unwrap(), doc.version); assert_eq!(params.diagnostics.len(), 1, "{}", doc.uri); - let diagnostic = params.diagnostics.get(0).unwrap(); + let diagnostic = params.diagnostics.first().unwrap(); let expected = diagnostic .message .starts_with("Your policy does not contain an allow rule"); @@ -892,7 +892,7 @@ mod tests { // `load_documents()` API performs no filtering. let polar_diagnostics = pls.load_documents(); assert_eq!(polar_diagnostics.len(), 2, "{:?}", polar_diagnostics); - let unknown_specializer = polar_diagnostics.get(0).unwrap(); + let unknown_specializer = polar_diagnostics.first().unwrap(); let expected_message = "Unknown specializer String at line 3, column 41 of file file:///whatever.polar:\n\t003: has_permission(_: Actor, _: String, _: Resource);\n\t ^\n"; assert_eq!(unknown_specializer.to_string(), expected_message); let unregistered_class = polar_diagnostics.get(1).unwrap(); @@ -918,7 +918,7 @@ mod tests { // `load_documents()` API performs no filtering. let polar_diagnostics = pls.load_documents(); assert_eq!(polar_diagnostics.len(), 2, "{:?}", polar_diagnostics); - let unknown_specializer = polar_diagnostics.get(0).unwrap(); + let unknown_specializer = polar_diagnostics.first().unwrap(); let expected_message = "Unknown specializer B at line 4, column 18 of file file:///whatever.polar:\n\t004: f(_: B);\n\t ^\n"; assert_eq!(unknown_specializer.to_string(), expected_message); let unregistered_constant = polar_diagnostics.get(1).unwrap(); @@ -939,7 +939,7 @@ mod tests { // `load_documents()` API performs no filtering. let polar_diagnostics = pls.load_documents(); assert_eq!(polar_diagnostics.len(), 1, "{:?}", polar_diagnostics); - let singleton_variable = polar_diagnostics.get(0).unwrap(); + let singleton_variable = polar_diagnostics.first().unwrap(); assert!(singleton_variable .to_string() .starts_with("Singleton variable a is unused or undefined; try renaming to _a or _")); @@ -963,7 +963,7 @@ mod tests { assert_eq!(params.uri, doc.uri); assert_eq!(params.version.unwrap(), doc.version); assert_eq!(params.diagnostics.len(), 1); - let diagnostic = params.diagnostics.get(0).unwrap(); + let diagnostic = params.diagnostics.first().unwrap(); assert_eq!( diagnostic.message, "debug is a reserved Polar word and cannot be used here" @@ -989,7 +989,7 @@ mod tests { assert_eq!(params.uri, doc.uri); assert_eq!(params.version.unwrap(), doc.version); assert_eq!(params.diagnostics.len(), 1, "{:?}", params.diagnostics); - let undeclared_term = ¶ms.diagnostics.get(0).unwrap().message; + let undeclared_term = ¶ms.diagnostics.first().unwrap().message; assert!( undeclared_term.starts_with("Undeclared term \"read\""), "{}", @@ -1016,7 +1016,7 @@ mod tests { assert_eq!(params.uri, doc2.uri); assert_eq!(params.version.unwrap(), doc2.version); assert_eq!(params.diagnostics.len(), 1, "{:?}", params.diagnostics); - let undeclared_term = ¶ms.diagnostics.get(0).unwrap().message; + let undeclared_term = ¶ms.diagnostics.first().unwrap().message; assert_eq!( undeclared_term, &format!("Problem loading file: A file with the same contents as {} named {} has already been loaded.", doc2.uri, doc1.uri), diff --git a/polar-wasm-api/Cargo.toml b/polar-wasm-api/Cargo.toml index 3ee255b229..3ff88086e6 100644 --- a/polar-wasm-api/Cargo.toml +++ b/polar-wasm-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polar-wasm-api" -version = "0.27.0" +version = "0.27.3" authors = ["Oso Security, Inc. "] edition = "2021" @@ -11,7 +11,7 @@ bench = false [dependencies] console_error_panic_hook = "0.1.6" js-sys = "0.3.53" -polar-core = { path = "../polar-core", version = "=0.27.0" } +polar-core = { path = "../polar-core", version = "=0.27.3" } serde = { version = "1.0.119", features = ["rc"] } serde-wasm-bindgen = "0.3.1" wasm-bindgen = "0.2.76" diff --git a/vscode/oso/package.json b/vscode/oso/package.json index 15bff2db33..a112052259 100644 --- a/vscode/oso/package.json +++ b/vscode/oso/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "0.27.0", + "version": "0.27.3", "name": "oso", "displayName": "Oso", "author": "Oso Security Inc.", @@ -117,4 +117,4 @@ "typescript": "^4.4.3", "vsce": "^2.6.3" } -} \ No newline at end of file +}