<!-- XE-0104 · node: `LeaseAcceptPolicy` is only consulted for `lease_open` — a unilateral `lease_renew` bypasses the provider's duration and cost caps · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0104>. The page is the record; this is the same page for reading.*

XE-0104 · Bounty

# node: \`LeaseAcceptPolicy\` is only consulted for \`lease\_open\` — a unilateral \`lease\_renew\` bypasses the provider's duration and cost caps

Triaging
claimed Medium
[xe#162](https://github.com/xeprotocol/xe/issues/162)
filed 2026-10-29 02:54 UTC
by memekomik

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Medium

Area
:   Leasing / ledger

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-10 00:11 UTC

Told
:   2026-11-08 20:32 UTC

### Patches

- [xe#180](https://github.com/xeprotocol/xe/pull/180) open by fangjian-bit
  core, node: enforce provider lease duration and cost caps on renewals via committed caps (#162)
- [xe#346](https://github.com/xeprotocol/xe/pull/346) open by arturbarszcz78
  fix(node): enforce LeaseAcceptPolicy duration and cost caps on renewals (#162)

### History

- [94548](https://bounty.xe.network/log/94548) 2026-11-10 22:05 UTC patch.linked
- [45021](https://bounty.xe.network/log/45021) 2026-11-08 20:32 UTC github.labels
- [45020](https://bounty.xe.network/log/45020) 2026-11-08 20:32 UTC reply.mirrored
- [44995](https://bounty.xe.network/log/44995) 2026-11-08 20:32 UTC proposal.adopted
- [44994](https://bounty.xe.network/log/44994) 2026-11-08 20:32 UTC reply.sent
- [44877](https://bounty.xe.network/log/44877) 2026-11-08 20:32 UTC proposal.adopted
- [44876](https://bounty.xe.network/log/44876) 2026-11-08 20:32 UTC ticket.facts area
- [44875](https://bounty.xe.network/log/44875) 2026-11-08 20:32 UTC proposal.adopted
- [44874](https://bounty.xe.network/log/44874) 2026-11-08 20:32 UTC ticket.facts
- [44873](https://bounty.xe.network/log/44873) 2026-11-08 20:32 UTC proposal.adopted
- [44872](https://bounty.xe.network/log/44872) 2026-11-08 20:32 UTC ticket.facts
- [44871](https://bounty.xe.network/log/44871) 2026-11-08 20:32 UTC proposal.adopted

[Full history](https://bounty.xe.network/log?ref=XE-0104) · [JSON](https://bounty.xe.network/v1/tickets/XE-0104) · [markdown](https://bounty.xe.network/XE-0104.md)

### Report

**Suggested tier:** Medium (2,500 XE) — an accepted lease can be extended 8,760× past the
provider's own policy limits without the provider's consent.
**Repo pin:** `978785929bc17a2f4ab30c383e5fc9cf4d634512` (testnet-0005)
**Area:** `node/policy.go`, `node/node.go` (renewal path), `core/lease_renew.go`

## Summary

Providers configure `LeaseAcceptPolicy` — `MaxDurationSec`, `MaxCostXUSD`, resource ceilings —
and the node applies it in exactly one place: `acceptPolicy.Allow` is called only from
`autoAcceptLease` (`node/node.go:1477`), which only runs for a `BlockLease`
(`node/node.go:721`). `lease_renew` never consults it: `validateAndAddLeaseRenew` caps the
cumulative duration at `LeaseMaxDuration` (1 year) and recomputes the price, but knows nothing
about the provider's policy. The consumer signs renewals unilaterally; the provider's node has
no say.

So a 1-hour lease accepted under a 1-hour policy can be walked to 31,536,000 s and past the
provider's `MaxCostXUSD` one renewal at a time, while the same commitment as a fresh
`lease_open` would be refused outright.

## Where

`node/node.go:1477` — the only caller in the tree (`grep -rn 'acceptPolicy.Allow'` → one hit):

```
if !n.acceptPolicy.Allow(leaseBlock, core.Now()) {
    log.Printf("Auto-accept policy rejected lease %s: %v", shortHash(leaseBlock.Hash), err)
    return
}
```

`core/lease_renew.go:39-52` — the renewal path only bounds duration against the protocol cap:

```
newEffective, ok := safeAdd(lease.EffectiveDurationSecs(), b.Duration)
if !ok || newEffective > LeaseMaxDuration {
    return fmt.Errorf("lease_renew: cumulative duration %d + %d exceeds max %d",
        lease.EffectiveDurationSecs(), b.Duration, LeaseMaxDuration)
}
```

and `node/policy.go` is not referenced from it at all.

## Reproduction

Full lease lifecycle against the real ledger, with a provider policy of
`MaxDurationSec = 3600`, `MaxCostXUSD = 500000000`:

```
cd /root/xe-audit/poc-D
nice -n 15 taskset -c 0-1 go test ./auditpoc/ -run TestD3 -count=1 -v
```

Observed (`poc-D/observed-D.log`):

```
d3_policy_renew_test.go:49:  policy allows the 1h lease (cost 80000 micro-XUSD)
d3_policy_renew_test.go:62:  control: the same policy rejects a lease_open for 31536000s (700800000 micro-XUSD): duration 31536000s > policy max 3600s
d3_policy_renew_test.go:94:  renewal accepted: +31532400s for 700720000 micro-XUSD (701 XUSD) — over the policy by 8760× in duration and 1.40× in price
d3_policy_renew_test.go:112: lease now expires 8759h0m0s after the point where the provider's policy would have ended it
d3_policy_renew_test.go:115: RESULT: LeaseAcceptPolicy.MaxDurationSec=3600 and MaxCostXUSD=500000000 were enforced on lease_open and bypassed by a unilateral lease_renew to 31536000s / 700720000 micro-XUSD
```

The control line is the point: the identical commitment is **rejected** as a `lease_open` by the
provider's own policy and **accepted** as a renewal.

## Impact

- The provider's advertised terms (`MaxDurationSec`, `MaxCostXUSD`, resource caps) are one-shot:
  they bind the initial lease and then stop mattering. A provider that prices capacity hourly and
  caps at one hour is committed for a year at that price.
- The consumer needs no cooperation from the provider: `lease_renew` is consumer-signed, and the
  renewal is admitted by the ledger as long as the attestations, certificate and price check out.
- Practical consequence for providers: capacity sold on the assumption of hourly re-pricing is
  rented for a year, and the price is pinned to the certificate multiplier in force at the
  renewal — the same class of commitment risk #97 describes, but for *size* rather than *price*.

## Why this is not a duplicate of #97 / #105 / #120 / #93

- **#97 / #105 / #120** fix *which certificate* a renewal may use (the provider's *current* one)
  and thus the price multiplier. They do not bound the duration or total cost a renewal may
  commit to; even with the current certificate, the 1-year extension in the PoC passes.
- **#93 / #110 / #152** are about the signature threshold on `lease_accept`.
- **#21 / #90** are about settling without service.

The policy-compulsion gap is not covered by any of them.

## Suggested fix

1. Call `acceptPolicy.Allow` for renewals too, evaluating the *projected* lease
   (`EffectiveDurationSecs()+b.Duration`, `Cost+ΣrenewalCost+b.Amount`) rather than the original
   block.
2. If the policy rejects a renewal, the provider's node should not attest it (the attestation is
   the provider's consent point — `validateAndAddLeaseRenew` already requires timekeeper
   attestations gathered by the provider's node).
3. Surface `MaxDurationSec` / `MaxCostXUSD` in `GET /providers` so a renter can see the caps the
   provider will actually enforce.

## Notes

Source-level only; no traffic to testnet-0005. PoC in `/root/xe-audit/poc-D/auditpoc/d3_policy_renew_test.go`.

### Thread

**fangjian-bit**2026-10-29 08:59 UTCgithub

Submitted architectural fix and comprehensive regression test suite in #180.

Resolves the unilateral renewal bypass by introducing consensus-level committed lease caps (`FeatureLeaseCaps`), binding provider duration/cost policies into `lease_accept` caps, enforcing immutable `WithinRenewalCaps` verification in `validateAndAddLeaseRenew`, and hardening VM orphan cleanup. Verified with full unit tests and builds in native Linux Go 1.27.3.

**Joseph Denne**team2026-11-08 20:32 UTCgithub

Thanks for the report. We have read it against the code and the behaviour you describe is as designed today; we are reviewing whether renewals should be bound by provider policy and will update this ticket when a decision is made.
