Repository navigation
Deny _dirsql_* schema reads in every spelling - #1671
Open
thekevinbot wants to merge 5 commits into
Open
thekevinbot wants to merge 5 commits into
thekevinbot wants to merge 5 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1611
query()denied a_dirsql_*schema read only as a lowercasePRAGMA. Now also denied:is_internal_tablecompares the prefix ASCII-case-insensitively, as SQLite does);pragma_*table-valued functions (pragma_table_info('_dirsql_internal_rows'),pragma_index_list(...), computed arguments): their argument is only known when the statement runs, when the pragma vtab prepares its ownPRAGMA. After the guarded prepare, a narrow authorizer that denies only aPRAGMAwhose value is in the namespace stays installed instead of none; a step-timeSQLITE_AUTHmaps to the sameUnauthorizederror;dbstat(lists every b-tree by name; no per-row filter is possible), denied at prepare.All via the SQLite authorizer, no SQL text matching.
Red: https://github.com/thekevinscott/dirsql/actions/runs/42133043315/job/127614166360 (the three new
db::testsfail on the unfixed code).Not covered (outside the issue):
SELECT name FROM sqlite_schemastill lists the_dirsql_*names.Changelog / Migrations
packages/rust/changelog.d/packages/rust/migrations.d/E2E Verification
cargo test -p dirsql --lib, plus repro by hand with the release CLI)packages/python/e2e-attestations/bot-1611-internal-deny-1105.jsonreceipt writtenpackages/ts/e2e-attestations/bot-1611-internal-deny-1105.jsonreceipt writtentesting-conventions e2e attest 'uv run python -m pytest tests/e2e/query_contract_test.py tests/e2e/on_file_query_test.py -x -q'(packages/python, aftermaturin develop --release);testing-conventions e2e attest 'pnpm exec vitest run --dir tests/e2e query-contract query-params'(packages/ts, afterpnpm run build)pragma_table_infoon a user table still works.