Skip to content

Commit 543a140

Browse files
authored
Merge pull request #103 from eclipse-biscuit/push-yxnprpptzwxq
Cleanup and documentation
2 parents 91abccf + 69cb114 commit 543a140

File tree

10 files changed

+199
-119
lines changed

10 files changed

+199
-119
lines changed

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Contributing
2+
3+
This repository is part of the [eclipse-biscuit](https://projects.eclipse.org/projects/technology.biscuit) project. It is licensed under `BSD-3-Clause` and requires contributors to sign the [Eclipse Contributor Agreement](https://www.eclipse.org/legal/ECA.php) (see #eclipse-contributor-agreement below).
4+
5+
## Before contributing
6+
7+
This is an implementation of the biscuit specification. All changes pertaining to the specification must be discussed in the [specification repo](https://github.com/eclipse-biscuit/biscuit) first.
8+
9+
Unless you’re fixing a trivial issue, it is a good idea to start by opening an issue, in order to gather feedback about the changes you have in mind.
10+
11+
You can also ask questions on the [implementers matrix chat](https://matrix.to/#/!suybZZpOqChdTNuIVA:matrix.org).
12+
13+
## Code organization
14+
15+
- `biscuit` provides core support for biscuit-auth
16+
- `biscuit-servant` provides support for protecting servant applications
17+
- `biscuit-wai` provides WAI middlewares for protecting WAI applications
18+
19+
## Project communication
20+
21+
The discussion space is a [matrix chat](https://matrix.to/#/!MXwhyfCFLLCfHSYJxg:matrix.org).
22+
Updates are also posted on [bluesky](https://bsky.app/profile/biscuitsec.org) and [mastodon](https://hachyderm.io/@biscuitauth).
23+
24+
Security issues can be reported via [github](https://github.com/eclipse-biscuit/biscuit-haskell/security).
25+
26+
## Eclipse Contributor Agreement
27+
28+
From the [ECA FAQ](https://www.eclipse.org/legal/eca/faq/):
29+
30+
The purpose of the ECA is to provide a written record that you have agreed to provide your contributions of code and documentation under the licenses used by the Eclipse project(s) you're contributing to. It also makes it clear that you are promising that what you are contributing to Eclipse is code that you wrote, and you have the necessary rights to contribute it to our projects. And finally, it documents a commitment from you that your open source contributions will be permanently on the public record.
31+
32+
In order to sign the ECA, you can follow these steps:
33+
34+
- [Create an account](https://dev.eclipse.org/site_login/createaccount.php) on dev.eclipse.org
35+
- Open your [Account Settings tab](https://dev.eclipse.org/site_login/myaccount.php#open_tab_accountsettings), enter your GitHub ID and click Update Account
36+
- Read and [sign the ECA](https://dev.eclipse.org/site_login/myaccount.php#open_tab_cla)
37+
- Use the exact same email address for your Eclipse account and your commit author.

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ You will find below the main lib and its companions:
88

99
* [biscuit](./biscuit/) — Main library, providing minting and signature verification of biscuit tokens, as well as a datalog engine allowing to compute the validity of a token in a given context
1010
* [biscuit-servant](./biscuit-servant) — Servant combinators, for a smooth integration in your API
11+
* [biscuit-wai](./biscuit-wai) — WAI middlewares for protecting WAI applications with biscuits
1112

1213
## Supported biscuit versions
1314

14-
The core library supports [`v3` and `v4` biscuits][spec] (both open and sealed).
15+
The core library supports [`v3.0` to `v3.3` biscuits][spec] (both open and sealed).
16+
17+
Only `ed25519` signatures are supported. `p256r1` signatures are not supported yet.
1518

1619
[CI-badge]: https://img.shields.io/github/actions/workflow/status/biscuit-auth/biscuit-haskell/github-actions.yml?style=flat-square&branch=main
17-
[CI-url]: https://github.com/biscuit-auth/biscuit-haskell/actions
20+
[CI-url]: https://github.com/eclipse-biscuit/biscuit-haskell/actions
1821
[Hackage]: https://img.shields.io/hackage/v/biscuit-haskell?color=purple&style=flat-square
1922
[hackage-url]: https://hackage.haskell.org/package/biscuit-haskell
2023
[gcouprie]: https://github.com/geal
2124
[biscuit]: https://biscuitsec.org
22-
[spec]: https://github.com/biscuit-auth/biscuit/blob/master/SPECIFICATIONS.md
25+
[spec]: https://github.com/eclipse-biscuit/biscuit/blob/main/SPECIFICATIONS.md

biscuit-servant/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog for biscuit-servant
22

3+
## 0.5.0.0 (not released yet)
4+
5+
- use biscuit-haskell 0.5.0.0
6+
37
## 0.4.0.0
48

59
- use biscuit-haskell 0.4.0.0

biscuit-servant/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
## Usage
88

9-
```Haskell
9+
```haskell
1010
type AppM = WithAuthorizer Handler
1111
type API = RequireBiscuit :> ProtectedAPI
1212

biscuit-wai/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<img src="https://raw.githubusercontent.com/biscuit-auth/biscuit-haskell/main/assets/logo-black-white-bg.png" align=right>
2+
3+
# biscuit-wai [![Hackage][hackage]][hackage-url]
4+
5+
> **WAI middlewares to enable biscuit validation in your WAI applications**
6+
7+
## Usage
8+
9+
```haskell
10+
import Network.WAI (Application)
11+
import Network.Wai.Middleware.Biscuit (parseBiscuit, getBiscuit)
12+
import Auth.Biscuit (PublicKey)
13+
14+
app :: PublicKey -> Application
15+
app publicKey req respond = parseBiscuit publicKey $ do
16+
let verifiedBiscuit = getBiscuit req
17+
in error "TODO: authorize biscuit and return a response"
18+
```
19+
20+
[Hackage]: https://img.shields.io/hackage/v/biscuit-wai?color=purple&style=flat-square
21+
[hackage-url]: https://hackage.haskell.org/package/biscuit-wai

biscuit/ChangeLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog for biscuit-haskell
22

3+
## 0.5.0.0 (not released yet)
4+
5+
- biscuit v3.3 support
6+
- drop support for GHC <9.6
7+
- support for GHC 9.6, 9.8, 9.10, 9.12
8+
- dependencies update (including removal of cryptonite in favor of crypton)
9+
310
## 0.4.0.0
411

512
- abort authorization on evaluation error as mandated by the spec

biscuit/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ Main library for biscuit tokens support, providing minting and signature verific
66

77
## Supported biscuit versions
88

9-
The core library supports [`v2` biscuits][v2spec] (both open and sealed).
9+
The core library supports [`v3.0` to `v3.3` biscuits][spec] (both open and sealed).
10+
11+
Only `ed25519` signatures are supported. `p256r1` signatures are not supported yet.
1012

1113
## How to use this library
1214

@@ -103,7 +105,7 @@ creation = do
103105
[gcouprie]: https://github.com/geal
104106
[biscuit]: https://www.clever-cloud.com/blog/engineering/2021/04/12/introduction-to-biscuit/
105107
[biscuittutorial]: https://www.clever-cloud.com/blog/engineering/2021/04/15/biscuit-tutorial/
106-
[v2spec]: https://github.com/CleverCloud/biscuit/blob/2.0/SPECIFICATIONS.md
108+
[spec]: https://github.com/eclipse-biscuit/biscuit/blob/main/SPECIFICATIONS.md
107109
[quasiquotes]: https://wiki.haskell.org/Quasiquotation
108-
[biscuitexample]: https://github.com/biscuit-auth/biscuit-haskell/blob/main/biscuit/src/Auth/Biscuit/Example.hs
109-
[packagedoc]: https://hackage.haskell.org/package/biscuit-haskell-0.1.0.0/docs/Auth-Biscuit.html
110+
[biscuitexample]: https://github.com/eclipse-biscuit/biscuit-haskell/blob/main/biscuit/src/Auth/Biscuit/Example.hs
111+
[packagedoc]: https://hackage.haskell.org/package/biscuit-haskell-0.4.0.0/docs/Auth-Biscuit.html

biscuit/biscuit-haskell.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ test-suite biscuit-haskell-test
9696
, bytestring
9797
, cereal
9898
, containers
99-
, cryptonite
10099
, lens
101100
, lens-aeson
102101
, megaparsec

biscuit/src/Auth/Biscuit/Proto.hs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ module Auth.Biscuit.Proto
2121
, Block (..)
2222
, Scope (..)
2323
, ScopeType (..)
24-
, FactV2 (..)
25-
, RuleV2 (..)
24+
, Fact (..)
25+
, Rule (..)
2626
, CheckKind (..)
27-
, CheckV2 (..)
28-
, PredicateV2 (..)
29-
, TermV2 (..)
30-
, ExpressionV2 (..)
27+
, Check (..)
28+
, Predicate (..)
29+
, Term (..)
30+
, Expression (..)
3131
, TermSet (..)
3232
, TermArray (..)
3333
, TermMap (..)
@@ -103,14 +103,14 @@ data PublicKey = PublicKey
103103
deriving anyclass (Decode, Encode)
104104

105105
data Block = Block {
106-
symbols :: Repeated 1 (Value Text)
107-
, context :: Optional 2 (Value Text)
108-
, version :: Optional 3 (Value Int32)
109-
, facts_v2 :: Repeated 4 (Message FactV2)
110-
, rules_v2 :: Repeated 5 (Message RuleV2)
111-
, checks_v2 :: Repeated 6 (Message CheckV2)
112-
, scope :: Repeated 7 (Message Scope)
113-
, pksTable :: Repeated 8 (Message PublicKey)
106+
symbols :: Repeated 1 (Value Text)
107+
, context :: Optional 2 (Value Text)
108+
, version :: Optional 3 (Value Int32)
109+
, facts :: Repeated 4 (Message Fact)
110+
, rules :: Repeated 5 (Message Rule)
111+
, checks :: Repeated 6 (Message Check)
112+
, scope :: Repeated 7 (Message Scope)
113+
, pksTable :: Repeated 8 (Message PublicKey)
114114
} deriving stock (Generic, Show)
115115
deriving anyclass (Decode, Encode)
116116

@@ -125,15 +125,15 @@ data Scope =
125125
deriving stock (Generic, Show)
126126
deriving anyclass (Decode, Encode)
127127

128-
newtype FactV2 = FactV2
129-
{ predicate :: Required 1 (Message PredicateV2)
128+
newtype Fact = Fact
129+
{ predicate :: Required 1 (Message Predicate)
130130
} deriving stock (Generic, Show)
131131
deriving anyclass (Decode, Encode)
132132

133-
data RuleV2 = RuleV2
134-
{ head :: Required 1 (Message PredicateV2)
135-
, body :: Repeated 2 (Message PredicateV2)
136-
, expressions :: Repeated 3 (Message ExpressionV2)
133+
data Rule = Rule
134+
{ head :: Required 1 (Message Predicate)
135+
, body :: Repeated 2 (Message Predicate)
136+
, expressions :: Repeated 3 (Message Expression)
137137
, scope :: Repeated 4 (Message Scope)
138138
} deriving stock (Generic, Show)
139139
deriving anyclass (Decode, Encode)
@@ -144,19 +144,19 @@ data CheckKind =
144144
| Reject
145145
deriving stock (Show, Enum, Bounded)
146146

147-
data CheckV2 = CheckV2
148-
{ queries :: Repeated 1 (Message RuleV2)
147+
data Check = Check
148+
{ queries :: Repeated 1 (Message Rule)
149149
, kind :: Optional 2 (Enumeration CheckKind)
150150
} deriving stock (Generic, Show)
151151
deriving anyclass (Decode, Encode)
152152

153-
data PredicateV2 = PredicateV2
153+
data Predicate = Predicate
154154
{ name :: Required 1 (Value Int64)
155-
, terms :: Repeated 2 (Message TermV2)
155+
, terms :: Repeated 2 (Message Term)
156156
} deriving stock (Generic, Show)
157157
deriving anyclass (Decode, Encode)
158158

159-
data TermV2 =
159+
data Term =
160160
TermVariable (Required 1 (Value Int64))
161161
| TermInteger (Required 2 (Value Int64))
162162
| TermString (Required 3 (Value Int64))
@@ -176,12 +176,12 @@ data Empty = Empty {}
176176

177177

178178
newtype TermSet = TermSet
179-
{ set :: Repeated 1 (Message TermV2)
179+
{ set :: Repeated 1 (Message Term)
180180
} deriving stock (Generic, Show)
181181
deriving anyclass (Decode, Encode)
182182

183183
newtype TermArray = TermArray
184-
{ array :: Repeated 1 (Message TermV2)
184+
{ array :: Repeated 1 (Message Term)
185185
} deriving stock (Generic, Show)
186186
deriving anyclass (Decode, Encode)
187187

@@ -193,7 +193,7 @@ data MapKey =
193193

194194
data MapEntry = MapEntry
195195
{ key :: Required 1 (Message MapKey)
196-
, value :: Required 2 (Message TermV2)
196+
, value :: Required 2 (Message Term)
197197
} deriving stock (Generic, Show)
198198
deriving anyclass (Decode, Encode)
199199

@@ -202,13 +202,13 @@ newtype TermMap = TermMap
202202
} deriving stock (Generic, Show)
203203
deriving anyclass (Decode, Encode)
204204

205-
newtype ExpressionV2 = ExpressionV2
205+
newtype Expression = Expression
206206
{ ops :: Repeated 1 (Message Op)
207207
} deriving stock (Generic, Show)
208208
deriving anyclass (Decode, Encode)
209209

210210
data Op =
211-
OpVValue (Required 1 (Message TermV2))
211+
OpVValue (Required 1 (Message Term))
212212
| OpVUnary (Required 2 (Message OpUnary))
213213
| OpVBinary (Required 3 (Message OpBinary))
214214
| OpVClosure (Required 4 (Message OpClosure))
@@ -254,7 +254,7 @@ data BinaryKind =
254254
| Any
255255
| Get
256256
| BinaryFfi
257-
| Try
257+
| TryOr
258258
deriving stock (Show, Enum, Bounded)
259259

260260
data OpBinary = OpBinary

0 commit comments

Comments
 (0)