Commit Graph

65 Commits

Author SHA1 Message Date
r1ckstardev
2119281141 BTCMaps v2: tighten /apis/btcmaps/v1/submit rate limit to 3/24h per IP
Per CREATOR direction on PR #226. Tightening the existing endpoint-wide
fixed-window from 5/24h to 3/24h per source IP. The BTC Map import-RPC
lane forwards submissions into the upstream reviewer queue (not an
instant publish), and rate-limit is the primary spam control on the
public endpoint.
2026-05-25 17:30:22 +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
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
psycarlo
4829306bb5 feat: gitlab provider and IGitHostingProvider abstraction 2026-04-13 18:49:04 +01:00
1amKhush
ab399f77a7 Align BTCPay error pages and lock special-route behavior with focused tests 2026-03-31 18:29:47 +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
1amKhush
47e1e19c68 Cleanup stale unconfirmed users 2026-03-26 01:50:37 +05:30
Timothé
a25739d454 feat : health check endpoint 2026-03-19 22:01:00 +01:00
rockstardev
9155403234
Merge pull request #168 from btcpayserver/bumpnet10
Bump the builder to dotnet 10.0
2026-03-13 22:26:11 -05:00
rockstardev
da7851ab3c
Adding comment on ForwardedHeaders and KnownNetworks/Proxies Clear 2026-03-13 20:28:31 -05:00
Nicolas Dorier
6ddcdedee8
Bump the builder to dotnet 10.0 2026-03-13 15:32:06 +09:00
thgO.O
c805e91419
refactor: centralize version lifecycle and add API coverage 2026-03-11 21:49:37 -03:00
rollforsats
c65b6ab1cc feat: add IP-based rate limiting (429) on public plugin endpoints
Add fixed-window rate limiter to public plugin endpoints using ASP.NET
  Core's built-in RateLimiter middleware, keyed by client IP. Rate limit
  settings (permit limit, window seconds) are stored in the database and
  cached via AdminSettingsCache, with sensible defaults of 30 req/60s.
2026-03-07 17:45:31 -06:00
Andrew Camilleri
5b5f1a7ff1
feat: add OpenAPI spec and Redocly docs page for /api/v1 endpoints
Hand-crafted OpenAPI 3.0.3 spec covering all 8 REST API endpoints.
Redocly-powered interactive docs served at /docs.
README simplified to link to the new docs page.
2026-02-16 21:52:06 +01:00
Jon
d6785a95ed extract cleanup logic to PluginCleanupRunner (Scoped) for testability 2026-01-22 07:27:03 -06:00
Jon
ba720268ec implement cleanup hosted service for stale plugins 2026-01-20 11:33:02 -06:00
rockstardev
57637b4c16
Updating editorconfig and cleaning up solution 2026-01-15 23:47:43 -06:00
rockstardev
d482e6bf52
Merge pull request #133 from btcpayserver/feat/github-auth-client
[Chore] Configure GitHub HttpClient with token auth for API calls
2025-12-21 13:54:22 +09:00
thgO.O
b83f988312 feat: add named GitHub HttpClient 2025-12-19 15:31:07 -03:00
thgO.O
8c83a77e2b feat: add reusable plugin ownership service 2025-12-16 12:22:25 -03:00
rockstardev
ae7bd9df41
Merge pull request #109 from btcpayserver/feat/nostr-verification
[Feature] Add Nostr verification (NIP-07/manual) + relay fetch
2025-11-14 00:05:47 -06:00
thgO.O
4a9a630836 feat: admin-driven Nostr relays + AdminSettingsCache 2025-11-12 14:41:00 -03:00
thgO.O
90db907b89 feat: add nostr verification (NIP-07/manual) + relay fetch 2025-11-12 09:28:34 -03:00
thgO.O
4a41905b6e feat: add output caching for plugins list api 2025-11-10 21:38:15 -03:00
Chukwuleta Tobechi
182f6f04f3 initial gpg implementation 2025-10-20 11:48:45 +01:00
rockstardev
87bb60ebed
Revert Merge pull request #89 from btcpayserver/gpg_key_encryption 2025-10-16 09:36:55 -05:00
Chukwuleta Tobechi
a9aae6435c Initiate GPG key flow 2025-10-03 16:28:38 +01:00
thgO.O
72d26f4443 chore: flush Serilog on shutdown 2025-09-26 16:27:18 -03:00
thgO.O
b7ca729287 refactor: align log filters and file sink with BTCPay 2025-09-26 00:28:34 -03:00
thgO.O
bdc85a90c2 chore: add PluginBuilderOptions and Serilog (console+file) 2025-09-26 00:26:28 -03:00
thgO.O
a27c7e8fcf feat: add GitHubVerified setting toggle and refactor to UserVerified 2025-09-23 18:07:19 -03:00
thgO.O
e9bafa12ab refactor: remove OwnershipService and exceptions from NpgsqlConnectionExtensions 2025-09-20 11:47:01 -03:00
thgO.O
8c930849ff feat: add OwnershipService and controller endpoints (get/add/remove/transfer/leave) 2025-09-16 23:41:16 -03:00
rockstardev
b9aab4b472
Switching to sending email on first build instead of release 2025-08-11 00:32:39 -05:00
rockstardev
840752b3ad
Abstracting navigation storing in service 2025-08-02 00:16:33 +02:00
thgO.O
4a79d020c6 chore: refactor Program.cs to allow test bootstrapping via WebApplicationOptions 2025-07-04 00:16:22 -03:00
rockstardev
95de855d66
Adding top level exception handling 2025-06-27 19:53:07 +02:00
rockstardev
b0052eb951
Refactoring root namespace classes 2025-06-11 19:50:22 +02:00
rockstardev
e83de24fc1
Finishing caching logic and exposing it in Login page 2025-06-06 23:05:40 +02:00
rockstardev
77126b8d39
Caching email verified requirement 2025-06-06 22:43:03 +02:00
rockstardev
bb99ffba31
Improving .editorconfig and cleaning up project 2025-04-24 22:54:41 -05:00
rockstardev
0649bf31cb
Moving Extensions into dedicated namespace 2025-03-31 12:22:39 -05:00
rockstardev
426f28cd00
Extracting email verified logic 2025-03-20 18:01:43 -05:00
TChukwuleta
4acc53bd8e
update VerifiedEmailForPluginPublish flow 2025-03-20 17:36:24 -05:00
TChukwuleta
e641ae2d29
Include VerifiedEmailForPluginPublish feature flag to prevent unverified plugin publish 2025-03-20 17:36:23 -05:00
TChukwuleta
d7dae57f8d Github verification 2024-11-15 13:51:44 +01:00
rockstardev
973e38967f Validating smtp credentials and saving them to database 2024-10-27 16:02:52 -05:00