From a84d200b8498067ef5809752c9e9856a1334626f Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 21 Feb 2024 11:27:52 +1000 Subject: [PATCH] Incompatability with `symbol-fstring` --- Gemfile | 2 ++ Gemfile.lock | 3 +++ test/auditing_test.rb | 6 ++++++ test/dummy/app/models/namespaced/thing.rb | 6 ++++++ 4 files changed, 17 insertions(+) create mode 100644 test/dummy/app/models/namespaced/thing.rb diff --git a/Gemfile b/Gemfile index c71b343..fead97e 100644 --- a/Gemfile +++ b/Gemfile @@ -17,3 +17,5 @@ gemspec gem 'rubyzip' gem 'activeresource', git: 'https://github.com/basecamp/activeresource.git' + +gem 'symbol-fstring', require: 'fstring/all' diff --git a/Gemfile.lock b/Gemfile.lock index f8b5c66..78d3c0f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -198,6 +198,7 @@ GEM rubyzip (2.3.2) sqlite3 (1.6.3-arm64-darwin) sqlite3 (1.6.3-x86_64-linux) + symbol-fstring (1.0.2) thor (1.2.2) timeout (0.4.0) tzinfo (2.0.6) @@ -210,6 +211,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-22 x86_64-linux DEPENDENCIES @@ -227,6 +229,7 @@ DEPENDENCIES rubocop-rails rubyzip sqlite3 + symbol-fstring BUNDLED WITH 2.3.22 diff --git a/test/auditing_test.rb b/test/auditing_test.rb index a9b0024..f5bed1e 100644 --- a/test/auditing_test.rb +++ b/test/auditing_test.rb @@ -42,6 +42,12 @@ class AuditingTest < ActiveSupport::TestCase assert_not Console1984::Command.last.sensitive? end + test "commands in protected mode on namespaced objects are not flagged as sensitive" do + @console.execute "puts ::Namespaced::Thing.last.name" + + assert_not Console1984::Command.last.sensitive?, @console.output + end + test "commands in unprotected mode are justified and flagged as sensitive" do assert_difference -> { Console1984::SensitiveAccess.count }, +1 do type_when_prompted "I need to fix encoding issue with Message 123456" do diff --git a/test/dummy/app/models/namespaced/thing.rb b/test/dummy/app/models/namespaced/thing.rb new file mode 100644 index 0000000..99f6823 --- /dev/null +++ b/test/dummy/app/models/namespaced/thing.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +class Namespaced::Thing < ApplicationRecord + self.table_name = "people" + encrypts :name +end