Repository navigation
feat: add the requirement-ID convention, lint and schemas #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brendanjryan
wants to merge
71
commits into
main
Choose a base branch
from
pyramid/f44edc25-47d6-4e3b-985a-b448c8251bea
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
1a21846
feat: add requirement IDs, schemas and a requirement lint
brendanjryan 7794d36
fix: address review on requirement lint and schema
brendanjryan a8608cf
fix: flag keywords in table cells and pin the header value in the schema
brendanjryan be8749b
fix(schemas): type Credential source as a string, as the drafts do
brendanjryan 55bd68c
fix(schemas): constrain method to the core payment-method-id grammar
brendanjryan 8a3a00b
fix(schemas): require Receipt method and constrain intent to the core…
brendanjryan 6325fcc
chore(tempo): keep tempo-charge at -00 instead of bumping to -01
brendanjryan 5cc64e9
fix(lint): flag conditional REQUIRED table cells; list schema differe…
brendanjryan 21fccd6
fix(lint): reject list-item IDs not indented to the item text
brendanjryan 5c41399
fix(lint): keep loose-list continuation paragraphs in their item
brendanjryan dfce681
fix(lint): skip code blocks, quoted and ALD ids; pin proof typed data
brendanjryan d9b47c6
fix(lint): match fence delimiters, split definitions, flag stray ids
brendanjryan d08d1ea
fix(lint): open fences only outside indented code blocks
brendanjryan 800753b
fix(lint): follow kramdown-rfc fences, tabs, quotes and lazy items
brendanjryan 3b251c0
fix(lint): emphasis, block ends, nested quotes, linear joins, boilerp…
brendanjryan 0a02265
fix(lint): skip block HTML comments and deep-indented IALs; order tem…
brendanjryan db18366
fix(lint): read a ~~~ inside an HTML comment as comment text
brendanjryan 24b5a03
fix(lint): an unclosed HTML comment hides nothing
brendanjryan 8a9b8e6
fix(lint): scope quoted comments to their quote; reject req IDs on he…
brendanjryan bdccd21
fix(lint): honor quoted id= attributes, kramdown comment extensions a…
brendanjryan 68b43d5
fix(lint): scope kramdown comment and fence closers to their containe…
brendanjryan a00c792
fix(schemas): require string values for custom Challenge parameters
brendanjryan 8a3e129
fix(lint): leave oversized decimal character references as text
brendanjryan 5e04ba5
fix(lint): fences on list markers, backtracking fence runs, split key…
brendanjryan c4a838b
fix(lint): close code spans only at matching backtick runs, keep IALs…
brendanjryan 982485e
fix(lint): apply consecutive IALs to one block, ignore indented ALDs …
brendanjryan 5a773c4
fix(lint): check indent and quote depth for adjacent IALs; schema: co…
brendanjryan c2ec1c2
fix(schema): require a non-empty, decodable base64url opaque value
brendanjryan 19ba8ce
fix(schemas): require canonical base64url pad bits in Opaque
brendanjryan 1b05603
fix(lint): read ALD-looking prose and comments in table cells as kram…
brendanjryan 4f7a29a
fix(lint): flag escaped comment openers in tables, memoize ALDs, requ…
brendanjryan b6a7559
fix(lint): hide keywords in unescaped comments; dedupe ALD IDs in lin…
brendanjryan 3d55b24
fix(lint): read inline math literally and report ALD cycles
brendanjryan d57c8a6
fix(lint): read unclosed comment openers as prose and pair code and m…
brendanjryan 48c77e5
fix(lint): strip code, math and comment spans in kramdown's earliest-…
brendanjryan df0345c
perf(lint): scan each span pattern once in strip_literal_spans
brendanjryan 6fbb58b
fix(lint): read link destinations literally when pairing math and cod…
brendanjryan 23bba91
fix(lint): skip raw nomarkdown bodies, parse full link destinations; …
brendanjryan 37c979a
fix(schemas): forbid control characters in Challenge expires
brendanjryan d45b98d
fix(schemas): reject a trailing newline under Python regex validators
brendanjryan c71d2b7
docs(schemas): say HttpServerOffer is the adapter command's offer
brendanjryan 78d59b4
fix(schemas): keep protocol patterns RE2-compatible
brendanjryan a1260ca
fix(schemas): enforce RFC 3339 on expires and timestamp with a pattern
brendanjryan 0b0b030
fix(schemas): reject trailing CR, NEL, LS and PS that java.util.regex…
brendanjryan d1448be
fix(lint): accept only ASCII digits and names in requirement IDs
brendanjryan 72d6afa
fix(schemas): reject impossible calendar dates in DateTime
brendanjryan ac5127a
fix(schemas): enforce absolute http(s) URLs in HttpPaymentRequest
brendanjryan cada165
fix(schemas): reject embedded line terminators; check digest and subs…
brendanjryan 1251e47
fix(schemas): accept only decodable base64 in Content-Digest values
brendanjryan c6fd7bd
feat(scripts): read requirements from kramdown-rfc XML and annotate P…
brendanjryan 1a3af1d
fix(schemas): accept second 60 only as 23:59:60 UTC
brendanjryan ae52321
fix(scripts): report a requirement ID an ALD loses to a literal ID
brendanjryan 6e00660
fix(scripts): annotate drafts being tagged first; parse URL structure…
brendanjryan 47e2a72
fix(scripts): report a reused requirement ID that another ID replaces
brendanjryan 4e61ceb
fix(scripts): check requirement IDs shown as code where an IAL misuse…
brendanjryan 7a1a5c6
fix(schemas): place leap seconds on month ends, with any offset
brendanjryan 9c09607
fix(schemas): allow a February 28 leap second only outside leap years
brendanjryan 63f86d6
fix(lint): place requirement IDs by their IALs alone, and report each…
brendanjryan 0cbfd7e
fix(lint): strip code spans in linear time
brendanjryan b5fefa0
fix(lint): scan comments and braces in linear time
brendanjryan d17006b
fix(lint): tighten IP literals, conditions, replaced IDs and comment …
brendanjryan a445afa
perf(lint): dedupe requirement problems with a set
brendanjryan 707ff9c
fix(schema): reject leap seconds with a nonzero UTC offset
brendanjryan 8c0457f
perf(lint): build each line's brace table once
brendanjryan 773c20d
perf(lint): keep only brace positions for the requirement lint's brac…
brendanjryan 99bd80b
fix(lint): scan indentation linearly, check ALD references' placement…
brendanjryan 6f82d27
fix(lint): scope IAL scans to their block, read quoted IAL values and…
brendanjryan 0433f83
perf(lint): keep the brace caches unbounded so shared IDs don't thras…
brendanjryan 9f1a418
fix(lint): treat on and upon as conditions after a presence marker
brendanjryan 3c595c1
chore: move tempo-charge requirement tags to their own pull request
brendanjryan f036918
Merge remote-tracking branch 'origin/main' into b397
brendanjryan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Schemas | ||
|
|
||
| JSON Schemas for MPP protocol values. | ||
|
|
||
| - `protocol.schema.json`: Challenge, Credential and Receipt values | ||
| as parsed objects (`request` decoded from base64url), plus the | ||
| operation, error and fixture types the MPP conformance suite uses. | ||
| Copied from [tempoxyz/mpp-tools](https://github.com/tempoxyz/mpp-tools/blob/6cc6b497763e9c50e738834c7447c9771e85e592/conformance/schemas/protocol.schema.json) | ||
| (`conformance/schemas/`) with its `$id` moved to | ||
| `https://paymentauth.org/schemas/`. Change it there first, then | ||
| copy it here. | ||
| - The `$id` URL is not served yet: the Pages deploy (`.github/workflows/deploy.yml`) | ||
| does not copy `schemas/` into `_site`. Until it does, read the schema from | ||
| this repository. | ||
| - Intentional differences from mpp-tools, which should follow: | ||
| - Receipt `status` is `const: "success"`, as the core draft's | ||
| Receipt Status Semantics require. | ||
| - Receipt requires `method`, as the core draft's Receipt fields do. | ||
| - Challenge and ChallengeIdInput `header` are | ||
| `const: "Payment-Authorization"`. | ||
| - ChallengeIdInput `expires` and `digest` use the Challenge formats | ||
| (`DateTime`, `ContentDigest`), so neither can hold the `|` that | ||
| separates HMAC input slots. mpp-tools' challenge-id vectors use | ||
| digests without the RFC 9530 colons and should add them. | ||
| - Credential `source` is a string. | ||
| - http.payment_request `payment.source` is a string or null, matching Credential `source`. | ||
| - `TempoProofTypedData` pins domain `name` "MPP", `version` "3", `primaryType` | ||
| "Proof" and the `Proof` type, per the tempo-charge draft. | ||
| - `PaymentMethodId` has pattern `^[a-z]+$` and `IntentId` has | ||
| `^[A-Za-z0-9-]+$`, per the core draft's method and intent grammar. | ||
| Challenge, ChallengeIdInput, ServerVerifyRequest and Receipt use | ||
| them for `method` and, where present, `intent`. | ||
| - HttpServerOffer `method` is a `PaymentMethodId`, narrowed from | ||
| `^[a-z][a-z0-9-]*$`. | ||
| - Challenge allows extra members whose names are lowercase RFC 9110 | ||
| tokens (`propertyNames`) and whose values are `ParamValue` strings | ||
| (no control characters but HTA`): custom parameters are auth-params | ||
| (token or quoted-string), and receivers ignore unknown ones. | ||
| - Challenge `digest` is an RFC 9530 Content-Digest value | ||
| (`ContentDigest`), and Receipt `subscriptionId` is unpadded base64url, | ||
| as the core draft and the subscription intent require. | ||
| - Every pattern has a `not` guard that rejects a line terminator | ||
| anywhere in the value, so validators whose `$` also matches before a | ||
| final newline, or at every line (Ruby), accept no multi-line value. | ||
| - Challenge `expires`, Receipt `timestamp` and HttpServerOffer | ||
| `expires` use `DateTime`: `format: date-time` plus an RFC 3339 | ||
| pattern, since 2020-12 validators treat `format` as an annotation | ||
| by default. | ||
| - HttpPaymentRequest `url` adds a pattern to `format: uri`: an | ||
| absolute http or https URL in RFC 3986 characters, for the same reason. | ||
| - Credential allows extra members of any type | ||
| (`additionalProperties: true`), since receivers ignore unknown fields. | ||
| - The drafts are normative. Where a schema and a draft disagree, the | ||
| draft wins and the schema is the bug. | ||
| - JSON Schema draft 2020-12. Nothing in CI validates the drafts' | ||
| examples against these schemas yet. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Low (trigger unconfirmed) · unverified: Schema README says 'HTA`' instead of 'HTAB'
The added schemas/README.md line 37 describes ParamValue as '(no control characters but HTA
)'. The schema's own ParamValue description says 'no control characters but HTAB'. The README line has a typo plus a stray unmatched backtick, so readers see a meaningless 'HTA' where the allowed character (horizontal tab) should be named.Full finding
The added schemas/README.md line 37 describes ParamValue as '(no control characters but HTA
)'. The schema's own ParamValue description says 'no control characters but HTAB'. The README line has a typo plus a stray unmatched backtick, so readers see a meaningless 'HTA' where the allowed character (horizontal tab) should be named. Impact is documentation clarity only. Fix: change 'HTA`' to 'HTAB'.Valid? React with 👍 / 👎.