Python SDK attest --json returns status without running advertised attestation flow

Aperta
#8,566 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 10 giorni

@ArtyormSatori ci sta già lavorando.

Dal 29/10/2026.

  • #8599 di @ArtyormSatori — aperta
  • #8610 di @EzeAlfaro — aperta
  • #8681 di @satoshinakamoto666666 — chiusa senza merge
  • #8709 di @tedTorus — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Read sdk/python/rustchain_sdk/cli.py, especially the attest option handling and _attest flow around the linked lines. Run the supplied local reproduction against the pinned commit; compare the recorded operations for plain and --json invocations. Done means both formats run the advertised attestation flow, or a separate status-only operation is explicitly documented; linked PR #8568 is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Reproduced local CLI control-flow bug

Pinned source: c3da95d5e6163d7fe06b9d12a7735976392f2318. attest description and output flag; early return.

The command promises to request and submit attestation. --json says only “Output as JSON.” But _attest prints status and returns before requesting the challenge when JSON output is selected.

Observed with entirely local recording client/wallet seams:

  • Plain invocation exits 0 and records wallet, client, status, challenge, sign, submit.
  • Same arguments plus --json exits 0 and records only wallet, client, status.

Expected: an output-format flag does not silently change an operation into a status-only command. Actual: JSON automation receives success/status without the advertised operation chain. Suggested fix: preserve the same operation flow for both output formats, or explicitly expose/document a separate status-only operation.

This proves only CLI control flow. No real wallet signing, miner start, enrollment, attestation request/submission, security exploit, or network operation was performed; the client/wallet are recording fakes. No protocol correctness or deployed-node impact is claimed.

Environment and exact runnable reproduction

3.14.8
Darwin arm64
click 8.1.8
httpx 0.28.1

Source file SHA-256: d09685c5d0a3829c1db77b69775d01ea83fc50164cbbe0a97f6dd0dd2f5cc616; Git blob 6856b3b091c9b68a5aadf4f6ddfa67b9016469f2.

Save the script below as repro.py, obtain the SDK source at the pinned commit and install its declared dependencies in an isolated virtualenv, then run python repro.py /path/to/Rustchain/sdk/python. The script imports the actual source CLI and controls only callbacks/transport/wallet seams. Connection, bind and DNS operations are audit-blocked. All seed/address values are dummy fixtures.

import sys, socket, json, hashlib
from pathlib import Path
root = Path(sys.argv[1])
sys.path.insert(0, str(root))
def blocked(*args, **kwargs):
    raise AssertionError('NETWORK BLOCKED')
def audit(event, args):
    if event in ('socket.connect', 'socket.bind', 'socket.getaddrinfo', 'socket.gethostbyname', 'socket.gethostbyaddr', 'socket.sendto'):
        blocked()
sys.addaudithook(audit)
socket.create_connection = blocked
socket.getaddrinfo = blocked
from click.testing import CliRunner
from rustchain_sdk import cli
trace = []
async def send(*args): trace.append(['send', list(args)])
async def node(*args): trace.append(['node', list(args)])
async def epoch(*args): trace.append(['epoch', list(args)])
cli._wallet_send, cli._node_status, cli._epoch_info = send, node, epoch
class Wallet:
    address = 'dummy-address'
    public_key_hex = 'dummy-public-key'
    @staticmethod
    def from_seed_phrase(words):
        trace.append(['wallet', words]); return Wallet()
    def sign(self, data):
        trace.append(['sign', data.decode()]); return b'dummy-signature'
class Client:
    def __init__(self, **kwargs): trace.append(['client', kwargs])
    async def __aenter__(self): return self
    async def __aexit__(self, *args): pass
    async def get_attestation_status(self, key):
        trace.append(['status', key]); return {'status': 'fixture-status'}
    async def attest_challenge(self, key):
        trace.append(['challenge', key]); return {'challenge': 'fixture-challenge'}
    async def attest_submit(self, *args):
        trace.append(['submit', list(args)]); return {'accepted': True}
cli.RustChainWallet, cli.RustChainClient = Wallet, Client
cases = [
 ['wallet','send','dummy-from','dummy-to','0.5','--seed','dummy'],
 ['wallet','send','dummy-from','dummy-to','1','--fee','0.01','--seed','dummy'],
 ['wallet','send','dummy-from','dummy-to','1','--fee','1','--seed','dummy'],
 ['node','status'], ['epoch','info'], ['node'], ['epoch'],
 ['attest','dummy-address','--seed','dummy','--node','https://invalid.test'],
 ['attest','dummy-address','--seed','dummy','--node','https://invalid.test','--json'],
]
results=[]
for args in cases:
    trace.clear()
    result = CliRunner().invoke(cli.main, args)
    record={'argv':args,'exit_code':result.exit_code,'stdout':result.stdout,'output':result.output,'trace':list(trace),'exception':repr(result.exception) if result.exception else None}
    results.append(record)
assert [r['exit_code'] for r in results] == [2,2,0,2,2,0,0,0,0]
assert not results[0]['trace'] and not results[1]['trace']
assert not results[3]['trace'] and not results[4]['trace']
assert results[5]['trace'][0][0] == 'node' and results[6]['trace'][0][0] == 'epoch'
assert [t[0] for t in results[7]['trace']] == ['wallet','client','status','challenge','sign','submit']
assert [t[0] for t in results[8]['trace']] == ['wallet','client','status']
print(json.dumps({'commit':'c3da95d5e6163d7fe06b9d12a7735976392f2318','cli_sha256':hashlib.sha256((root/'rustchain_sdk/cli.py').read_bytes()).hexdigest(),'network':'socket creation, connection, DNS blocked before SDK import','results':results},indent=2))

The runner exits 0 when it observes the described current failures and working controls; its printed per-case exit codes/recorded operations are the evidence. This is a reproduction, not a passing regression test or a fix. No production calls or funds movement.

Duplicate checks searched both source/bounty repos, all states: fractional CLI (11 results, no exact parser report identified), quoted unexpected-extra-argument (0), attest/as_json (0), _attest/json (0); broader CLI-attestation-JSON 188 results screened, no exact symptom in returned bodies. Existing #5678 signed-payload work does not change cli.py. First-reporter/eligibility remains maintainer decision.

AI assistance disclosure: source investigation, local reproduction and report preparation used AI assistance.

Lingua principale
Python
Stelle
850
Fork
589
Merge medio
11g 7h
PR unite (30g)
29

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Scottcjn/Rustchain

Tutte le issue di Scottcjn/Rustchain

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.