Skip to content

feat(gateway): read order books and balances without signing in - #1452

Merged
MicBun merged 1 commit into
mainfrom
feat/gateway-public-reads
Oct 26, 2026
Merged

MicBun merged 1 commit into
mainfrom
feat/gateway-public-reads

Conversation

@MicBun

@MicBun MicBun commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Related:

Summary

  • The gateway now answers 18 public views without a session: order books, markets, and a wallet's positions, collateral, order events and balances. Each of them takes the market or the wallet as an argument and never reads @caller, directly or through an action it calls, so a session added nothing to them.
  • This lets a dapp in a wallet's in-app browser show an order book and a wallet's balances. Those browsers drop the gateway's session cookie when the dapp is not served from truf.network, so until now every one of these reads failed there.
  • Every other action still needs a session. Stream reads check @caller for private streams, and whoami, get_user_positions and get_user_collateral answer for the caller.
  • The list lives in kgw-config.pkl, so it is reviewed here. One list covers both networks, because a name a network does not have is ignored. AUTHN_EXEMPT_ACTIONS (comma separated, no spaces) replaces the list for one deployment.

How I checked

  • I evaluated the file with the gateway's own pkl 0.25.3. The default gives the 18 names, an override replaces them, and an empty override falls back to the default. authn_exempt_actions is the only new key in the output.
  • I read each listed action's live definition from info.actions on testnet and mainnet, together with every action it calls. None of them reads @caller or @signer. The same check does flag whoami, get_user_positions and get_record.
  • I applied the file to the testnet gateway and then the mainnet gateway on 26 Oct, each after a --test-config dry run, keeping the old file as a backup.
  • On both gateways, with no session, list_markets, get_market_info, get_order_book, get_positions_by_wallet and the bridge balance view now answer 200, both with no wallet and with a wallet that never signed in. Before the change they answered 400 sender not set or 401 cookie not found.
  • whoami and get_user_positions still answer 401 without a session, and signing in with the cookie works as before.
  • The mainnet indexer, which reads through the gateway, stayed at the tip after the restart.

Summary by CodeRabbit

  • New Features
    • Gateway deployments can now configure authentication-exempt actions through the AUTHN_EXEMPT_ACTIONS environment variable. Provide a comma-separated list to replace the default actions; if unset, the value is empty.

@MicBun MicBun self-assigned this Oct 26, 2026
@holdex

holdex Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Time Submission Status

Member # Time Running Total Status Last Update
MicBun 1h ✅ Submitted Oct 26, 2026, 1:07 PM

Submit or update total time with:

@holdex pr submit-time 2h

Add time on top of previous submission with:

@holdex pr add-time 1h30m

See available commands to help comply with our Guidelines.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f5bcd249-5a07-467e-9927-3589cdbb98d9
Commits

Reviewing files that changed from the base of the PR and between ca0d812 and 511ee68.

Files ignored due to path filters: 1
  • deployments/gateway/kgw-config.pkl is excluded by !**/*.pkl
Files selected for processing: 1
  • deployments/gateway/gateway-compose.yaml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The gateway Compose configuration now passes AUTHN_EXEMPT_ACTIONS to the kwil-gateway service. The setting defaults to an empty value.

Changes: Gateway configuration

Layer / File(s) Summary
Expose exempt actions setting
deployments/gateway/gateway-compose.yaml
The kwil-gateway service now accepts AUTHN_EXEMPT_ACTIONS, defaulting to empty. Its comment describes a comma-separated value that replaces the default list in kgw-config.pkl.

Priority: Normal

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Feature · Severity of issue fixed: Medium

Possibly related issues

  • trufnetwork/node#1436 — The new environment setting allows configuring authentication-exempt actions, addressing part of the issue’s gateway configuration objective.
Merge Risk: Minimal · up to 511ee

No concrete merge-blocking risk remains.

Pre-merge checks: Passed 3 · Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive [#1451] Requirements: testnet and mainnet gateways must serve order book, market, and wallet balance and position reads without a session. Reads that depend on the caller must still require a session.… Provide reviewable evidence of the exempt action list. Needed items: the default list in deployments/gateway/kgw-config.pkl at head (or a reviewable copy), and the source of each listed action with its called actions. The source must show w…
Out of Scope Changes check Inconclusive The reviewed change in deployments/gateway/gateway-compose.yaml is in scope. It passes the new AUTHN_EXEMPT_ACTIONS override to the kwil-gateway service, which the feature for #1451 requires.

The mai…
Provide reviewable contents of deployments/gateway/kgw-config.pkl at head. This allows a check that each listed action matches the scope of #1451. Reassess after this evidence is available.
Passed Passed checks: 3 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the primary change: allowing gateway reads of order books and balances without signing in.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Full details: Linked Issues check

Explanation

[#1451] Requirements: testnet and mainnet gateways must serve order book, market, and wallet balance and position reads without a session. Reads that depend on the caller must still require a session.

The exempt action list is in deployments/gateway/kgw-config.pkl. That path is excluded by the rule !**/*.pkl with no inclusion rule, so its contents were not reviewed.

Reviewed evidence: deployments/gateway/gateway-compose.yaml adds AUTHN_EXEMPT_ACTIONS to the kwil-gateway service. The default is empty. The comment states that the value replaces the default list in kgw-config.pkl. This wiring matches the feature, but it does not show which actions are exempt.

The PR description names 18 actions and reports checks of their live definitions on testnet and mainnet. These are author claims. They are not reviewable evidence in this assessment.

Unresolved: whether the exempt list covers the requested reads, and whether it excludes identity-dependent reads such as whoami, get_user_positions, get_user_collateral, and stream reads that check @caller.

Resolution

Provide reviewable evidence of the exempt action list. Needed items: the default list in deployments/gateway/kgw-config.pkl at head (or a reviewable copy), and the source of each listed action with its called actions. The source must show whether each action reads @caller or @signer. Reassess after this evidence is available.

Full details: Out of Scope Changes check

Explanation

The reviewed change in deployments/gateway/gateway-compose.yaml is in scope. It passes the new AUTHN_EXEMPT_ACTIONS override to the kwil-gateway service, which the feature for #1451 requires.

The main change, the exempt action list in deployments/gateway/kgw-config.pkl, is excluded by the rule !**/*.pkl with no inclusion rule. Its contents were not reviewed. Whether it lists only the reads named in #1451 is unknown.

No unrelated change was found in the reviewed evidence. That evidence covers the whole-PR summary and the compose file only.

Resolution

Provide reviewable contents of deployments/gateway/kgw-config.pkl at head. This allows a check that each listed action matches the scope of #1451. Reassess after this evidence is available.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MicBun

MicBun commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

@holdex pr submit-time 1h

@MicBun
MicBun merged commit bb9d019 into main Oct 26, 2026
9 checks passed
@MicBun
MicBun deleted the feat/gateway-public-reads branch October 26, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem: wallet browser users can't see order books on dapps

1 participant