Maj terminée. Pour consulter la release notes associée voici le lien :
https://about.gitlab.com/releases/2021/07/07/critical-security-release-gitlab-14-0-4-released/

Commit 22c99056 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

When importing an election, copy its public static data to our own dir

parent 3e312658
......@@ -41,6 +41,7 @@
<main-election uuid="6d122f00-2650-4de8-87de-30037a21f943"/>
<log file="_RUNDIR_/log/security.log"/>
<import dir="demo/data"/>
<spool dir="_RUNDIR_/spool"/>
</eliom>
</host>
......
......@@ -14,6 +14,7 @@ mkdir -p \
$BELENIOS_RUNDIR/log \
$BELENIOS_RUNDIR/lib \
$BELENIOS_RUNDIR/upload \
$BELENIOS_RUNDIR/spool \
$BELENIOS_TMPDIR/run
sed \
......
......@@ -309,11 +309,13 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRATION = struct
)
)
let ( / ) = Filename.concat
let f_raw user () =
return W.params_fname
return @@ W.dir/"election.json"
let f_keys user () =
return W.public_keys_fname
return @@ W.dir/"public_keys.jsons"
let f_creds user () =
lwt creds = W.B.extract_creds () in
......
......@@ -37,6 +37,7 @@ let () = CalendarLib.Time_Zone.(change Local)
(** Parse configuration from <eliom> *)
let spool_dir = ref None
let import_dirs = ref []
let source_file = ref None
let main_election_uuid = ref None
......@@ -54,6 +55,8 @@ let () =
source_file := Some file
| Element ("import", ["dir", dir], []) ->
import_dirs := dir :: !import_dirs
| Element ("spool", ["dir", dir], []) ->
spool_dir := Some dir
| Element ("rewrite-prefix", ["src", src; "dst", dst], []) ->
set_rewrite_prefix ~src ~dst
| Element ("main-election", ["uuid", uuid], []) ->
......@@ -107,12 +110,18 @@ lwt source_file =
)
| None -> failwith "missing <source> in configuration"
let spool_dir =
match !spool_dir with
| Some d -> d
| None -> failwith "missing <spool> in configuration"
(** Build up the site *)
module Site_config = struct
let name = "site"
let path = []
let source_file = source_file
let spool_dir = spool_dir
let auth_config = !auth_instances
end
......
......@@ -229,8 +229,7 @@ end
module type WEB_PARAMS = sig
val metadata : metadata
val featured : bool
val params_fname : string
val public_keys_fname : string
val dir : string
end
module type WEB_ELECTION_RO = sig
......
......@@ -31,6 +31,7 @@ module type CONFIG = sig
val name : string
val path : string list
val source_file : string
val spool_dir : string
val auth_config : auth_config list
end
......@@ -180,16 +181,28 @@ module Make (C : CONFIG) : SITE = struct
if exists then (
return None
) else (
let ( / ) = Filename.concat in
let dir = C.spool_dir/uuid in
lwt metadata =
Lwt_io.chars_of_file f.f_metadata |>
Lwt_stream.to_string >>=
wrap1 metadata_of_string
in
lwt () =
Lwt_unix.mkdir dir 0o700 >>
Lwt_io.(with_file Output (dir/"election.json") (fun oc ->
write_line oc raw_election
)) >>
Lwt_io.(with_file Output (dir/"public_keys.jsons") (fun oc ->
with_file Input f.f_public_keys (fun ic ->
read_chars ic |> write_chars oc
)
))
in
let module X = struct
let metadata = metadata
let featured = featured
let params_fname = f.f_election
let public_keys_fname = f.f_public_keys
let dir = dir
end in
let web_params = (module X : WEB_PARAMS) in
Ocsipersist.add election_ptable uuid (raw_election, web_params) >>
......
......@@ -26,6 +26,7 @@ module type CONFIG = sig
val name : string
val path : string list
val source_file : string
val spool_dir : string
val auth_config : auth_config list
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment