Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
44d898e8
Commit
44d898e8
authored
Mar 04, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] disable xsrf for cookie GET requests
Also, list API works now. Only the file isn't downloaded yet.
parent
03d73fca
Pipeline
#767
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
8 deletions
+6
-8
API.hs
src/Gargantext/API.hs
+1
-1
List.hs
src/Gargantext/API/Ngrams/List.hs
+1
-5
Settings.hs
src/Gargantext/API/Settings.hs
+4
-2
No files found.
src/Gargantext/API.hs
View file @
44d898e8
...
@@ -208,7 +208,7 @@ type GargAPI' =
...
@@ -208,7 +208,7 @@ type GargAPI' =
-- auth and capabilities.
-- auth and capabilities.
:<|>
GargPrivateAPI
:<|>
GargPrivateAPI
type
GargPrivateAPI
=
SA
.
Auth
'[
S
A
.
JWT
]
AuthenticatedUser
:>
GargPrivateAPI'
type
GargPrivateAPI
=
SA
.
Auth
'[
S
A
.
JWT
,
SA
.
Cookie
]
AuthenticatedUser
:>
GargPrivateAPI'
type
GargAdminAPI
type
GargAdminAPI
-- Roots endpoint
-- Roots endpoint
...
...
src/Gargantext/API/Ngrams/List.hs
View file @
44d898e8
...
@@ -24,11 +24,8 @@ module Gargantext.API.Ngrams.List
...
@@ -24,11 +24,8 @@ module Gargantext.API.Ngrams.List
where
where
import
Data.Aeson
import
Data.Aeson
-- import qualified Data.ByteString.Lazy as BSL
import
Data.List
(
zip
)
import
Data.List
(
zip
)
import
Data.Map
(
Map
,
toList
,
fromList
)
import
Data.Map
(
Map
,
toList
,
fromList
)
-- import qualified Data.Text as T
-- import qualified Data.Text.Encoding as TE
import
Network.HTTP.Media
((
//
),
(
/:
))
import
Network.HTTP.Media
((
//
),
(
/:
))
import
Servant
import
Servant
...
@@ -52,7 +49,7 @@ type API = Get '[JSON] NgramsList
...
@@ -52,7 +49,7 @@ type API = Get '[JSON] NgramsList
:<|>
Get
'[
H
TML
]
NgramsList
:<|>
Get
'[
H
TML
]
NgramsList
api
::
ListId
->
GargServer
API
api
::
ListId
->
GargServer
API
api
l
=
get
l
:<|>
put
l
:<|>
get
l
api
l
=
get
l
:<|>
put
l
:<|>
get
Html
l
get
::
RepoCmdM
env
err
m
get
::
RepoCmdM
env
err
m
=>
ListId
->
m
NgramsList
=>
ListId
->
m
NgramsList
...
@@ -65,7 +62,6 @@ getHtml :: RepoCmdM env err m
...
@@ -65,7 +62,6 @@ getHtml :: RepoCmdM env err m
getHtml
lId
=
do
getHtml
lId
=
do
lst
<-
get
lId
lst
<-
get
lId
return
lst
return
lst
--return $ TE.decodeUtf8 $ BSL.toStrict $ encode lst
-- TODO : purge list
-- TODO : purge list
...
...
src/Gargantext/API/Settings.hs
View file @
44d898e8
...
@@ -48,7 +48,7 @@ import Data.ByteString (ByteString)
...
@@ -48,7 +48,7 @@ import Data.ByteString (ByteString)
import
qualified
Data.ByteString.Lazy
as
L
import
qualified
Data.ByteString.Lazy
as
L
import
Servant
import
Servant
import
Servant.Auth.Server
(
defaultJWTSettings
,
JWTSettings
,
CookieSettings
,
default
CookieSettings
,
readKey
,
writeKey
)
import
Servant.Auth.Server
(
defaultJWTSettings
,
JWTSettings
,
CookieSettings
(
..
),
XsrfCookieSettings
(
..
),
defaultCookieSettings
,
defaultXsrf
CookieSettings
,
readKey
,
writeKey
)
import
Servant.Client
(
BaseUrl
,
parseBaseUrl
)
import
Servant.Client
(
BaseUrl
,
parseBaseUrl
)
import
qualified
Servant.Job.Core
import
qualified
Servant.Job.Core
import
Servant.Job.Async
(
newJobEnv
,
defaultSettings
,
HasJobEnv
(
..
),
Job
)
import
Servant.Job.Async
(
newJobEnv
,
defaultSettings
,
HasJobEnv
(
..
),
Job
)
...
@@ -106,9 +106,11 @@ devSettings jwkFile = do
...
@@ -106,9 +106,11 @@ devSettings jwkFile = do
,
_sendLoginEmails
=
LogEmailToConsole
,
_sendLoginEmails
=
LogEmailToConsole
,
_scrapydUrl
=
fromMaybe
(
panic
"Invalid scrapy URL"
)
$
parseBaseUrl
"http://localhost:6800"
,
_scrapydUrl
=
fromMaybe
(
panic
"Invalid scrapy URL"
)
$
parseBaseUrl
"http://localhost:6800"
,
_fileFolder
=
"data"
,
_fileFolder
=
"data"
,
_cookieSettings
=
defaultCookieSettings
-- TODO-SECURITY tune
,
_cookieSettings
=
defaultCookieSettings
{
cookieXsrfSetting
=
Just
xsrfCookieSetting
}
-- TODO-SECURITY tune
,
_jwtSettings
=
defaultJWTSettings
jwk
-- TODO-SECURITY tune
,
_jwtSettings
=
defaultJWTSettings
jwk
-- TODO-SECURITY tune
}
}
where
xsrfCookieSetting
=
defaultXsrfCookieSettings
{
xsrfExcludeGet
=
True
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment