Commit Graph

188 Commits

Author SHA1 Message Date
r1ckstardev
717f55d2a6 BTCMaps v2: enforce https on BtcMap import endpoint before bearer auth
Per CodeRabbit review on PR #226. A misconfigured
BTCMAPS:BtcMapImportEndpoint over http:// would silently leak the
scoped token to anyone on the network path between plugin-builder
and btcmap. Parse the configured value as an absolute https URI
before building the request, throwing InvalidOperationException
with the offending value if the parse / scheme check fails. The
exception fires before SendAsync, so the token never reaches a
HttpRequestMessage header.

Adds 3 tests: http-rejected, non-absolute-rejected, token-missing
maps to BtcMapTokenMissingException (controller-ladder regression
guard). 40/40 BtcMapsServiceTests passing.
2026-05-25 15:06:27 +00:00
r1ckstardev
3836fe6b38 BTCMaps v2: add btcmap import-RPC submit path alongside directory submission
Adds a second downstream lane to /apis/btcmaps/v1/submit that forwards
the merchant payload to teambtcmap/btcmap-api's submit_place RPC
(merged 2026-05-24 in teambtcmap/btcmap-api#91).

Request schema:

- New fields Lat, Lon, Category, ExternalId on BtcMapsSubmitRequest,
  required iff SubmitToBtcMap=true. Validator enforces lat/lon
  ranges, lowercase-identifier category, and 1-200 char external_id.
  Plugin side (rollforsats/BTCPayServerPlugins) composes external_id
  as hostname:storeId so the namespace stays unique per BTCPay
  instance.
- New SubmitToDirectory + SubmitToBtcMap routing flags. The
  directory flag defaults true to preserve existing callers; btcmap
  defaults false so new callers must opt in.
- New Phone field forwarded as OSM Key:phone in extra_fields.

Service layer:

- BtcMapsService.SubmitToBtcMapAsync POSTs a JSON-RPC 2.0 envelope
  ({jsonrpc, method, params, id}) to BTCMAPS:BtcMapImportEndpoint
  (default https://api.btcmap.org/rpc) with method=submit_place,
  origin=btcpayserver, and the merchant payload mapped to the
  documented param shape. Bearer auth from BTCMAPS:BtcMapImportToken.
- Optional fields (website, description, twitter, github, onion,
  phone, country) ride along in extra_fields using OSM tag keys
  (contact:twitter, addr:country, etc.) plus the implicit
  payment:bitcoin=yes marker.
- New BtcMapTokenMissingException parallels the existing
  DirectoryTokenMissingException so the controller can return 503
  with a distinct error code when ops haven't provisioned the
  scoped token yet.

Controller:

- /apis/btcmaps/v1/submit branches on SubmitToDirectory +
  SubmitToBtcMap. At least one must be true (rejected 400 otherwise).
- Each lane has its own exception ladder symmetric to the existing
  directory path: token-missing 503 (directory-not-configured /
  btcmap-not-configured), caller-cancel rethrow, upstream-timeout
  504, generic-failure 502 - error codes namespaced by lane so ops
  can tell them apart.

HttpClient registration:

- New HttpClientNames.BtcMap named client registered with 15s
  per-call timeout and JSON Accept header, matching the
  BtcMapsDirectory budget for bounded worst-case behavior.

Tests:

- 12 new validation tests in BtcMapsServiceTests covering the
  SubmitToBtcMap=true required-field paths (Lat / Lon / Category /
  ExternalId; range checks; lowercase-identifier policy; overlong
  external_id) plus the default-false directory-only-still-works
  baseline. 37/37 BtcMapsServiceTests passing.
2026-05-25 14:45:46 +00:00
thgO.O
8ffea888af
Merge pull request #222 from btcpayserver/ft/request_listing_flow
Some checks failed
PluginBuilder Tests / test (push) Has been cancelled
Improve plugin listing request flow
2026-05-18 11:02:33 -03:00
Chukwuleta Tobechi
21c2a93fdd revert changes 2026-05-14 11:21:20 +01:00
Chukwuleta Tobechi
5c29872ca4 resolve test failure 2026-05-11 21:33:38 +01:00
r1ckstardev
b84538f2c2 btcmaps v1: IHttpClientFactory + markdown-safe PR body + idempotent branch + ISO whitelist
Addresses post-#224 review feedback from @rollforsats + CodeRabbit:

- IHttpClientFactory + named HttpClientNames.BtcMapsDirectory client
  replaces per-request `new HttpClient()`. 15s per-call timeout caps the
  ~5-7 GitHub round-trips at a bounded worst case instead of the default
  100s x N. Bearer token stays per-request (the BTCMAPS token is distinct
  from the global PluginBuilder GitHub token; must not leak into the
  singleton handler).
- Markdown injection guard on the PR body. User fields (Name, Type,
  SubType, Country, Twitter, GitHub) are wrapped in inline code spans
  with backtick-escape so a doctored merchant name can't render as a
  clickable link in the maintainer-facing PR description. Description
  goes inside a fenced code block. URL is rendered as <bare-url> autolink
  so the maintainer always sees the actual destination.
- Idempotent branch name: SHA-1-derived suffix from the normalized URL
  replaces the random GUID. Two concurrent same-URL submissions now
  collide on `git/refs` create instead of racing through preflight and
  opening duplicate PRs. The 422 "Reference already exists" surface is
  caught and mapped to the open-PR lookup or `branch-exists-no-open-pr`.
- NormalizeUrl lowercases scheme + host only and preserves path + query
  case verbatim. Lowercasing the whole URL falsely de-duplicates
  case-sensitive paths.
- Country code validation moves to an actual ISO 3166-1 alpha-2 set
  built from CultureInfo at startup. Replaces the
  `length==2 && IsUpper` shape that accepted reserved/unassigned codes
  like ZZ.
- Missing BTCMAPS:DirectoryGithubToken throws
  DirectoryTokenMissingException at the service layer; controller maps
  it to 503 with `directory-not-configured`. Previously surfaced as a
  200 OK with `Skipped` which a client could misread as "accepted".

5 new tests:
- Validate_RejectsNonAssignedTwoLetterCountry (ZZ)
- NormalizeUrl_PreservesPathCase
- NormalizeUrl_PreservesQueryCase
- BuildBranchName_DeterministicForSameUrl
- BuildBranchName_DiffersForDifferentUrls

25/25 BtcMapsServiceTests pass on Release build.
2026-05-11 16:32:04 +00:00
r1ckstardev
33148aafcd BTCMaps v1: directory-only submission API
Supersedes PR #211. Per-store OSM OAuth moves to the BTC Map
plugin side (rollforsats/BTCPayServerPlugins PR #5); the
plugin-builder side keeps only the directory PR submission.

Drops vs PR #211:
- TagOnOsmAsync / UnlistFromOsmAsync service paths and all
  OSM XML + changeset infrastructure (~430 lines)
- TagOnOsm / UnlistFromOsm / OsmNodeId / OsmNodeType /
  Latitude / Longitude / OsmCategory / AcceptsLightning
  request fields
- BtcMapsOsmResult response shape + Address sub-model
- OSM-specific validators

Keeps:
- POST /apis/btcmaps/v1/submit opens a PR against
  btcpayserver/directory.btcpayserver.org's merchants.json
- GET /apis/btcmaps/v1/ping
- Rate limit: 5 submissions / 24h per source IP
- Validation for name / url / description / type / subType /
  country / twitter / github / onionUrl

Build clean (Release); 20 unit tests cover validation, slug,
URL normalization.
2026-05-10 18:52:16 +00:00
Khushvendra Singh
e0c8972366
Align antiforgery error details flow with BTCPay UI handling (#196) (#197)
* Align antiforgery error details flow with BTCPay UI handling (#196)

- add UIControllerAntiforgeryTokenAttribute equivalent and register it globally in MVC\n- populate UIErrorController.ErrorDetailsKey on antiforgery validation failures\n- keep UI-only/non-safe-method antiforgery behavior aligned with BTCPay policy semantics\n- add focused unit tests for validation, existing failure enrichment, GET bypass, API bypass, and IgnoreAntiforgeryToken bypass\n- add integration-style error page test to verify generic UI error view renders CSRF details

* Align antiforgery policy precedence for UI error handling

* Fix antiforgery error details and exempt NIP-07 verify endpoint

* Preserve detailed antiforgery error messages

* Keep antiforgery PR focused

* fix: keep antiforgery details generic

* test: focus antiforgery coverage

---------

Co-authored-by: thgO.O <thgo.o.btc@proton.me>
2026-05-08 18:40:12 -03:00
Chukwuleta Tobechi
0750690a44 Include tests 2026-05-06 16:48:14 +01:00
thgO.O
cf99e25872
Merge pull request #214 from makeentosch/feature/api-validation
Some checks failed
PluginBuilder Tests / test (push) Has been cancelled
Api validation implemented
2026-05-04 18:01:08 -03:00
thgO.O
68058ed408
test: assert api build validation does not create build 2026-05-04 17:22:31 -03:00
makeentosch
53472297c1 fix: tests 2026-05-04 21:18:42 +03:00
makeentosch
ee45a5464c tests implementation 2026-05-03 21:20:07 +03:00
thgO.O
04a64d9178
Handle local loopback plugin downloads
Add an explicit local artifact download proxy flag for development and tests.

Keep the public download endpoint as a redirect while routing enabled loopback artifacts through the internal proxy.
2026-04-26 12:45:37 -03:00
Chukwuleta Tobechi
fa9e2673d9
Merge pull request #207 from btcpayserver/ft/remove_logo_on_Create_plugin
clean up create plugin page
2026-04-21 21:00:46 +01:00
thgO.O
02df725394
Merge pull request #210 from btcpayserver/fix/flaky-rate-limit-test
Some checks are pending
PluginBuilder Tests / test (push) Waiting to run
Fix flaky rate limit window reset test
2026-04-21 15:12:45 -03:00
thgO.O
3faa08f350
Fix flaky rate limit window test 2026-04-21 14:43:13 -03:00
psycarlo
d9460f8818 chore: resolve GitLab commit authors via Users API 2026-04-21 16:04:05 +01:00
psycarlo
7c67548270 fix: match configured GitLab hosts with ports via uri.Authority 2026-04-21 12:44:50 +01:00
Chukwuleta Tobechi
1bed813873 Test: remove enforcing of image on plugin create 2026-04-17 15:36:44 +01:00
Chukwuleta Tobechi
382831cd38 resolve related image media test on create plugin 2026-04-17 15:14:08 +01:00
Chukwuleta Tobechi
f0ddd89293 clean up create plugin page 2026-04-17 13:53:50 +01:00
psycarlo
b7158cda4f chore: update with coderabbit suggestion 2026-04-14 12:06:19 +01:00
psycarlo
55315d1f1b fix: resolve GitLab contributor avatars via /avatar API 2026-04-13 18:54:38 +01:00
psycarlo
4829306bb5 feat: gitlab provider and IGitHostingProvider abstraction 2026-04-13 18:49:04 +01:00
thgO.O
ed621aae24
test : cover create media failure flow 2026-04-11 22:28:49 -03:00
Tim
91ae5f726c
Merge branch 'btcpayserver:master' into master 2026-04-11 11:20:06 +02:00
thgO.O
b881066eb9
Merge pull request #200 from SusanGithaigaN/align-tab-content
Some checks failed
PluginBuilder Tests / test (push) Has been cancelled
align plugin page tabs with BTCPay reporting layout
2026-04-08 00:50:00 -03:00
thgO.O
ebf197210b
test: use stable AddUser selector in owners flow 2026-04-08 00:34:50 -03:00
Timothé
78c0629823 test : fix pw tests 2026-04-03 16:29:06 +02:00
thgO.O
8c50b6aad3
fix(api): accept RC BTCPay host versions in compatibility filters 2026-04-02 08:21:59 -03:00
Timothé
05f89ab06c refactor : test screenshots -> images 2026-04-01 10:18:03 +02:00
Timothé
ed1454e408 rm : screenshots -> images 2026-03-31 19:36:40 +02:00
1amKhush
ab399f77a7 Align BTCPay error pages and lock special-route behavior with focused tests 2026-03-31 18:29:47 +05:30
1amKhush
691768c3a4 use UI error DOM marker, fail fast on admin role setup 2026-03-30 22:27:54 +05:30
Timothé
f6c07cd6fd
Merge branch 'btcpayserver:master' into master 2026-03-30 17:05:10 +02:00
Timothé
9b63e29fb4 test : add pw tests 2026-03-30 16:45:06 +02:00
1amKhush
14cdb9b005 harden error-response coverage and dedupe Playwright test helpers 2026-03-30 10:32:18 +05:30
1amKhush
89cf35af26 exercise 500 page via real exception middleware flow 2026-03-30 10:04:42 +05:30
1amKhush
175369acb1 correct exception handler route and add 500 error-page coverage 2026-03-30 02:58:13 +05:30
1amKhush
37a1f709e0 Port BTCPay-style error pages and pipeline (404/500) 2026-03-30 02:20:49 +05:30
Chukwuleta Tobechi
929655a08e
Merge pull request #183 from btcpayserver/fix/review-userid-cleanup
Remove legacy plugin_reviews.user_id link
2026-03-28 22:15:33 +01:00
Khushvendra Singh
c605d61c72
Merge branch 'btcpayserver:master' into chore/remove-redundant-usings-182 2026-03-27 13:27:27 +05:30
1amKhush
c21c4b262a chore: remove redundant explicit usings (issue #182) 2026-03-27 13:26:33 +05:30
thgO.O
4ce22e92e5
test: add migration coverage for legacy plugin review schema 2026-03-27 00:22:53 -03:00
thgO.O
a9212c900e
refactor: remove legacy plugin review user link 2026-03-27 00:22:53 -03:00
thgO.O
7178d48a39
refactor: align user cleanup naming and formatting 2026-03-26 19:59:48 -03:00
1amKhush
7be1cd8612 Fixed all the related code changes with corresponding reviews. 2026-03-26 22:12:20 +05:30
1amKhush
47e1e19c68 Cleanup stale unconfirmed users 2026-03-26 01:50:37 +05:30
thgO.O
1818a94a3b
fix(api): align BTCPay manifest dependency with effective compatibility 2026-03-23 15:17:33 -03:00