omen 0.9.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/lib/omen/bound.rb +1 -1
- data/lib/omen/grants.rb +10 -4
- data/lib/omen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9698c59cc037f0a9ccbe6b100af4a7137df0d26c8a54b3a8e5c37e9effe5e5e6
|
|
4
|
+
data.tar.gz: 792f03229094807c6ca995cc1271a199cc158db1f54ecfebee4a3e5db242712d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4395ce363d33978256ce75d72d6495c873af06299c140f0a61bf0fc637bda94bde5cbb129744447a01b6603ebbcaf4fb5567920d3a32c859ba86c097ef206354
|
|
7
|
+
data.tar.gz: 8f5c0384edd2be88dcaacb5a60cb9256c4f8c2139a5fcb351a7eae9fce3ff5619bf5403a919c9ebb6e61fe64103c94bcc80a58d9f656552568862f34ac6f8e9c
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
For more information about changelogs, check [Keep a Changelog](http://keepachangelog.com) and
|
|
6
6
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
|
7
7
|
|
|
8
|
+
## 0.10.1 - 2026-10-14
|
|
9
|
+
|
|
10
|
+
* [Change] The narrowed role is granted the connection's current schema rather than `public`,
|
|
11
|
+
so a host keeping its tables in a schema of its own -- sharing a database with another app,
|
|
12
|
+
each in a schema -- gets a role that reads its tables and no one else's. A host that never
|
|
13
|
+
set a search path reads `public` as before.
|
|
14
|
+
|
|
8
15
|
## 0.9.0 - 2026-09-18
|
|
9
16
|
|
|
10
17
|
* [Fix] An answer landing touches the reading it belongs to, so a page watching one refreshes
|
data/README.md
CHANGED
data/lib/omen/bound.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Omen
|
|
|
9
9
|
SELECT p.tablename, p.policyname, r.rolname FROM pg_policies p
|
|
10
10
|
CROSS JOIN LATERAL unnest(p.roles) AS named(rolname)
|
|
11
11
|
JOIN pg_roles r ON pg_has_role(r.oid, named.rolname::regrole::oid, 'USAGE')
|
|
12
|
-
WHERE p.permissive = 'RESTRICTIVE' AND p.schemaname =
|
|
12
|
+
WHERE p.permissive = 'RESTRICTIVE' AND p.schemaname = current_schema() AND NOT r.rolsuper
|
|
13
13
|
ORDER BY p.tablename, p.policyname, r.rolname
|
|
14
14
|
SQL
|
|
15
15
|
|
data/lib/omen/grants.rb
CHANGED
|
@@ -17,12 +17,13 @@ module Omen
|
|
|
17
17
|
# @return [Array<String>] the statements to run, in order.
|
|
18
18
|
def self.statements(connection, members)
|
|
19
19
|
role = connection.quote_table_name Omen.config.narrow_role
|
|
20
|
+
read = schema connection
|
|
20
21
|
[
|
|
21
22
|
*made(connection, Omen.config.narrow_role),
|
|
22
23
|
*members.map { |member| "GRANT #{role} TO #{connection.quote_table_name member}" },
|
|
23
|
-
"GRANT USAGE ON SCHEMA
|
|
24
|
-
"GRANT SELECT ON ALL TABLES IN SCHEMA
|
|
25
|
-
"ALTER DEFAULT PRIVILEGES IN SCHEMA
|
|
24
|
+
"GRANT USAGE ON SCHEMA #{read} TO #{role}",
|
|
25
|
+
"GRANT SELECT ON ALL TABLES IN SCHEMA #{read} TO #{role}",
|
|
26
|
+
"ALTER DEFAULT PRIVILEGES IN SCHEMA #{read} GRANT SELECT ON TABLES TO #{role}",
|
|
26
27
|
*revoked(connection, role),
|
|
27
28
|
*Omen::Renamed.statements,
|
|
28
29
|
*Omen::TimeZone.statements(connection),
|
|
@@ -42,10 +43,15 @@ module Omen
|
|
|
42
43
|
role = connection.quote_table_name name
|
|
43
44
|
[
|
|
44
45
|
*members.map { |member| apart role, connection.quote_table_name(member) },
|
|
45
|
-
"GRANT USAGE ON SCHEMA
|
|
46
|
+
"GRANT USAGE ON SCHEMA #{schema connection} TO #{role}",
|
|
46
47
|
]
|
|
47
48
|
end
|
|
48
49
|
|
|
50
|
+
# The schema a host keeps its tables in: the first of its search path, `public` by default.
|
|
51
|
+
# @param connection [ActiveRecord::ConnectionAdapters::AbstractAdapter] a writing one.
|
|
52
|
+
# @return [String] its name, quoted.
|
|
53
|
+
def self.schema(connection) = connection.quote_table_name connection.current_schema
|
|
54
|
+
|
|
49
55
|
# @param role [String] the role, quoted.
|
|
50
56
|
# @param member [String] the role that may enter it, quoted.
|
|
51
57
|
# @return [String] the statement that lets it in without handing it what the role holds.
|
data/lib/omen/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Claudio Baccigalupo
|
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
146
146
|
- !ruby/object:Gem::Version
|
|
147
147
|
version: '0'
|
|
148
148
|
requirements: []
|
|
149
|
-
rubygems_version: 4.0.
|
|
149
|
+
rubygems_version: 4.0.20
|
|
150
150
|
specification_version: 4
|
|
151
151
|
summary: Ask Claude about your own data
|
|
152
152
|
test_files: []
|