xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
Commit 7f079cf057ae0545827ba0090b816ac181bd2139

Lots of fixes, mostly CSS
Also fixes for regular expression.
Author: Catalin(ux) M. BOIE
Author date (UTC): 2015-04-22 18:39
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2015-04-22 18:39
Parent(s): 12b0f0dc0503557effe906b6f7bf519768fdf766
Signing key:
Tree: 74ac94531fa0923c82ed0c86646fce7468dac4e8
File Lines added Lines deleted
TODO 11 4
duilder.conf 1 1
inc/feedback/suggestion.php 5 8
inc/git.inc.php 3 3
inc/repo.inc.php 3 2
inc/user.inc.php 5 4
inc/util.inc.php 3 2
root/themes/default/main.css 1 1
samples/config.php 3 3
samples/rg.conf 7 2
tests/config.php 2 2
tests/repo.php 5 5
tests/user.php 1 1
File TODO changed (mode: 100644) (index 9498d65..c462954)
1 1 == Where I stopped last time == == Where I stopped last time ==
2 [ ] Switch to startssl certificates.
3 [ ] Add "Spread the word!" on website.
4 [ ] Run unit testing.
5 [ ] SPF? mail-ul ajunge in spam!
6 2 [ ] Rebuild virtual machine with the latest rocketgit version. [ ] Rebuild virtual machine with the latest rocketgit version.
3 [ ] Add "Spread the word!" on website.
7 4 [ ] [ ]
8 5
9 6 == BEFORE NEXT RELEASE == == BEFORE NEXT RELEASE ==
7 [ ] SPF? mail-ul ajunge in spam!
8 L-am redirectionat prin mail.embedromix.ro, si am pus si SPF-uri.
9 Trebuie sa reverific cu google-ul.
10 Astept confirmare si de la Ionut.
11 [ ] Users should be able to check the plans.
12 [ ] Use a separate template for main rocketgit.com site. The other users
13 should not see the same pages.
14 [ ] git-filter-branch is very powerful: offer it to the clients!
15 [ ] word-break: break-all; pentru tabelele cu cod. asta permite wrap-ul
16 oriunde - still needed?!
10 17 [ ] On upgrade, we must restart the cache daemon? [ ] On upgrade, we must restart the cache daemon?
11 18 [ ] Real SSL certificates. [ ] Real SSL certificates.
12 19 [ ] Backup for rg2! [ ] Backup for rg2!
File duilder.conf changed (mode: 100644) (index 768ac23..629c96e)
1 1 PRJ="rocketgit" PRJ="rocketgit"
2 VER="0.28"
2 VER="0.29"
3 3 REV="1" REV="1"
4 4 EXCLUDE=".exclude" EXCLUDE=".exclude"
5 5 EXPORT_PATH="/data/www/umbrella/kernel/us/rocketgit" EXPORT_PATH="/data/www/umbrella/kernel/us/rocketgit"
File inc/feedback/suggestion.php changed (mode: 100644) (index fe80600..a401489)
... ... rg_log("FILE: /feedback/suggestion");
4 4 $_suggestion = ""; $_suggestion = "";
5 5
6 6 $errmsg = array(); $errmsg = array();
7 $show_form = 1;
8 7
9 8 while (1) { while (1) {
10 9 if ($rg['doit'] != 1) { if ($rg['doit'] != 1) {
 
... ... while (1) {
37 36 break; break;
38 37 } }
39 38
40 $show_form = 0;
39 $suggestion = '';
41 40 $_suggestion .= rg_template("suggestion_sent.html", $rg); $_suggestion .= rg_template("suggestion_sent.html", $rg);
42 41 break; break;
43 42 } }
44 43
45 if ($show_form == 1) {
46 $rg['suggestion'] = $suggestion;
47 $rg['HTML:errmsg'] = rg_template_errmsg($errmsg);
48 $rg['rg_form_token'] = rg_token_get($db, $rg);
49 $_suggestion .= rg_template("suggestion.html", $rg);
50 }
44 $rg['suggestion'] = $suggestion;
45 $rg['HTML:errmsg'] = rg_template_errmsg($errmsg);
46 $rg['rg_form_token'] = rg_token_get($db, $rg);
47 $_suggestion .= rg_template("suggestion.html", $rg);
51 48
52 49 ?> ?>
File inc/git.inc.php changed (mode: 100644) (index 54743d1..8062559)
... ... function rg_git_reference($refname)
284 284 return FALSE; return FALSE;
285 285 } }
286 286
287 $pattern = "[-a-zA-Z0-9\/_.]*";
288 $r = preg_match('/^' . $pattern . '$/uD', $refname);
287 $pattern = "/^[-a-zA-Z0-9\/_.]*$/uD";
288 $r = preg_match($pattern, $refname);
289 289 if ($r === FALSE) { if ($r === FALSE) {
290 290 rg_internal_error("preg_match failed!"); rg_internal_error("preg_match failed!");
291 291 return ""; return "";
292 292 } }
293 293 if ($r !== 1) { if ($r !== 1) {
294 $chars = preg_replace('/' . $pattern . '/', '', $refname);
294 $chars = preg_replace($pattern, '', $refname);
295 295 rg_git_set_error('we do not accept [' . $chars rg_git_set_error('we do not accept [' . $chars
296 296 . '] inside a ref name'); . '] inside a ref name');
297 297 return FALSE; return FALSE;
File inc/repo.inc.php changed (mode: 100644) (index b47487b..1a2c90f)
... ... function rg_repo_ok($repo)
570 570 return FALSE; return FALSE;
571 571 } }
572 572
573 if (rg_chars_allow($repo, $rg_repo_allow) === FALSE) {
574 rg_repo_set_error("invalid repository name (invalid chars)");
573 if (rg_chars_allow($repo, $rg_repo_allow, $invalid) !== TRUE) {
574 rg_repo_set_error("invalid repository name"
575 . " (invalid chars: '$invalid')");
575 576 return FALSE; return FALSE;
576 577 } }
577 578
File inc/user.inc.php changed (mode: 100644) (index 67cedfc..8feceba)
... ... function rg_user_ok($user)
213 213 global $rg_user_min_len; global $rg_user_min_len;
214 214 global $rg_user_max_len; global $rg_user_max_len;
215 215
216 if (rg_chars_allow($user, $rg_user_allow) !== TRUE) {
217 rg_log("invalid user name (invalid chars [$user] [$rg_user_allow])");
218 rg_user_set_error("invalid user name (invalid chars)");
216 if (rg_chars_allow($user, $rg_user_allow, $invalid) !== TRUE) {
217 rg_user_set_error("invalid user name (invalid chars: '$invalid')");
219 218 return FALSE; return FALSE;
220 219 } }
221 220
 
... ... function rg_user_over_limit($db, $ui, &$max)
1402 1401 */ */
1403 1402 function rg_user_edit_high_level($db, &$rg) function rg_user_edit_high_level($db, &$rg)
1404 1403 { {
1404 global $rg_session_time;
1405
1405 1406 rg_log("user_edit_high_level"); rg_log("user_edit_high_level");
1406 1407 rg_log_ml("user_edit_high_level:rg:" . print_r($rg, TRUE)); rg_log_ml("user_edit_high_level:rg:" . print_r($rg, TRUE));
1407 1408
 
... ... function rg_user_edit_high_level($db, &$rg)
1451 1452 $ui['is_admin'] = "0"; $ui['is_admin'] = "0";
1452 1453 $ui['rights'] = rg_rights_checkboxes("user", "rights", "C"); // TODO $ui['rights'] = rg_rights_checkboxes("user", "rights", "C"); // TODO
1453 1454 $ui['plan_id'] = 0; $ui['plan_id'] = 0;
1454 $ui['session_time'] = 600;
1455 $ui['session_time'] = $rg_session_time;
1455 1456 } }
1456 1457 } }
1457 1458
File inc/util.inc.php changed (mode: 100644) (index ce9ab9b..6c379a6)
... ... function rg_var_cookie_re($name, $re)
319 319 /* /*
320 320 * Enforce chars in a name. It is used for user and repo. * Enforce chars in a name. It is used for user and repo.
321 321 */ */
322 function rg_chars_allow($name, $allowed_regexp)
322 function rg_chars_allow($name, $allowed_regexp, &$invalid)
323 323 { {
324 if (preg_match($allowed_regexp, $name) !== 1) {
324 if (preg_match('/^[' . $allowed_regexp . ']*$/uUD', $name) !== 1) {
325 $invalid = preg_replace('/[' . $allowed_regexp . ']/', '', $name);
325 326 rg_log("chars_allow: [$name] does not match [$allowed_regexp]"); rg_log("chars_allow: [$name] does not match [$allowed_regexp]");
326 327 return FALSE; return FALSE;
327 328 } }
File root/themes/default/main.css changed (mode: 100644) (index 552211c..cd66efc)
... ... th, td {
35 35 .xcode { .xcode {
36 36 margin-left: 5px; margin-left: 5px;
37 37 border-left: 1px solid #000; border-left: 1px solid #000;
38 font-size: 9pt;
38 font-size: 11pt;
39 39 padding-left: 5px; padding-left: 5px;
40 40 } }
41 41
File samples/config.php changed (mode: 100644) (index ab7d4ba..1067e69)
... ... $rg_sql = "host=localhost user=rocketgit dbname=rocketgit"
10 10 $rg_sql_debug = 1; $rg_sql_debug = 1;
11 11
12 12 // Session // Session
13 $rg_session_time = 7200;
13 $rg_session_time = 3600;
14 14
15 15 // Keys // Keys
16 16 $rg_keys_file = $rg_base . "/.ssh/authorized_keys"; $rg_keys_file = $rg_base . "/.ssh/authorized_keys";
 
... ... $rg_keys_file = $rg_base . "/.ssh/authorized_keys";
19 19 $rg_scripts = "/usr/share/rocketgit"; $rg_scripts = "/usr/share/rocketgit";
20 20
21 21 // Allowed repo names (regular expression) // Allowed repo names (regular expression)
22 $rg_repo_allow = '/^[\pL\pN\pP]*$/uUD';
22 $rg_repo_allow = '\pL\pN\pP';
23 23
24 24 // Allowed repo name length // Allowed repo name length
25 25 $rg_repo_min_len = 2; $rg_repo_min_len = 2;
26 26 $rg_repo_max_len = 64; $rg_repo_max_len = 64;
27 27
28 28 // Allowed user names (negated regular expression) // Allowed user names (negated regular expression)
29 $rg_user_allow = '/^[\pL\pN\pP]*$/uUD';
29 $rg_user_allow = '\pL\pN\pP';
30 30
31 31 // Allowed user name length // Allowed user name length
32 32 $rg_user_min_len = 3; $rg_user_min_len = 3;
File samples/rg.conf changed (mode: 100644) (index c9231d6..b51e584)
37 37 #RewriteLog /var/log/httpd/rg-Rewrite.log #RewriteLog /var/log/httpd/rg-Rewrite.log
38 38 #RewriteLogLevel 3 #RewriteLogLevel 3
39 39
40 # If you do not want HTTPS, comment the following lines and the HTTPS
41 # virtual host, below.
42 RewriteCond %{HTTPS} off
43 RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [redirect=301,last,qsappend]
44
40 45 # Allow .ico, 'themes' folder and robots.txt # Allow .ico, 'themes' folder and robots.txt
41 46 # Also, avoid scripts that are looking for exploits # Also, avoid scripts that are looking for exploits
42 47 RewriteCond %{REQUEST_URI} ^/(favicon\.ico|themes/.*|robots\.txt|.*\.php.*|.*\.html)$ RewriteCond %{REQUEST_URI} ^/(favicon\.ico|themes/.*|robots\.txt|.*\.php.*|.*\.html)$
 
49 54 # Security # Security
50 55 <IfModule mod_headers.c> <IfModule mod_headers.c>
51 56 Header always append X-Frame-Options DENY Header always append X-Frame-Options DENY
52 # Add this for SSL
53 Header set Strict-Transport-Security "max-age=31536000"
54 57 </IfModule> </IfModule>
55 58
56 59 # Compress # Compress
 
85 88 # Security # Security
86 89 <IfModule mod_headers.c> <IfModule mod_headers.c>
87 90 Header always append X-Frame-Options DENY Header always append X-Frame-Options DENY
91 # Add this for SSL
92 Header set Strict-Transport-Security "max-age=31536000"
88 93 </IfModule> </IfModule>
89 94
90 95 LogLevel warn LogLevel warn
File tests/config.php changed (mode: 100644) (index 230b1b7..6b47d20)
... ... $rg_sql_debug = 1;
7 7 $rg_session_time = 3600; $rg_session_time = 3600;
8 8 $rg_keys_file = "afile.txt"; $rg_keys_file = "afile.txt";
9 9 $rg_scripts = dirname(dirname(__FILE__)); $rg_scripts = dirname(dirname(__FILE__));
10 $rg_repo_allow = '/^[\pL\pN\pP_<>]*$/uUD';
10 $rg_repo_allow = '\pL\pN\pP_<>';
11 11 $rg_repo_min_len = 1; $rg_repo_min_len = 1;
12 12 $rg_repo_max_len = 100; $rg_repo_max_len = 100;
13 $rg_user_allow = '/^[\pL\pN\pP_<>]*$/uUD';
13 $rg_user_allow = '\pL\pN\pP_<>';
14 14 $rg_user_min_len = 1; $rg_user_min_len = 1;
15 15 $rg_user_max_len = 50; $rg_user_max_len = 50;
16 16 $rg_ssh_paras = "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty"; $rg_ssh_paras = "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty";
File tests/repo.php changed (mode: 100644) (index bbc8e43..284338f)
... ... if (strcmp($c, $e) != 0) {
48 48 } }
49 49
50 50 rg_log("test if repo_allow works correctly (0)"); rg_log("test if repo_allow works correctly (0)");
51 $rg_repo_allow = '/^[A-Za-z0-9]*$/';
51 $rg_repo_allow = 'A-Za-z0-9';
52 52 $v = "xx"; $v = "xx";
53 53 $c = rg_repo_ok($v); $c = rg_repo_ok($v);
54 54 if ($c !== TRUE) { if ($c !== TRUE) {
 
... ... if ($c !== TRUE) {
57 57 } }
58 58
59 59 rg_log("test if repo_allow works correctly (1)"); rg_log("test if repo_allow works correctly (1)");
60 $rg_repo_allow = '/^[A-Za-z0-9]*$/';
60 $rg_repo_allow = 'A-Za-z0-9';
61 61 $v = "eyhtmcmet_"; $v = "eyhtmcmet_";
62 62 $c = rg_repo_ok($v); $c = rg_repo_ok($v);
63 63 if ($c !== FALSE) { if ($c !== FALSE) {
 
... ... if ($c !== FALSE) {
66 66 } }
67 67
68 68 rg_log("test if repo_allow works correctly (2)"); rg_log("test if repo_allow works correctly (2)");
69 $rg_repo_allow = '/^[A-Za-z0-9_.-]*$/';
69 $rg_repo_allow = 'A-Za-z0-9_.-';
70 70 $v = ".e&y.h-tmcmet&_.-"; $v = ".e&y.h-tmcmet&_.-";
71 71 $c = rg_repo_ok($v); $c = rg_repo_ok($v);
72 72 if ($c !== FALSE) { if ($c !== FALSE) {
 
... ... if ($c !== FALSE) {
75 75 } }
76 76
77 77 rg_log("check if we allow '..'"); rg_log("check if we allow '..'");
78 $rg_repo_allow = '/^[A-Za-z0-9_.-]*$/';
78 $rg_repo_allow = 'A-Za-z0-9_.-';
79 79 $v = "a..b"; $v = "a..b";
80 80 $c = rg_repo_ok($v); $c = rg_repo_ok($v);
81 81 if ($c !== FALSE) { if ($c !== FALSE) {
 
... ... if ($c !== FALSE) {
85 85
86 86 rg_log("check len test"); rg_log("check len test");
87 87 $v = "0123456789A"; $v = "0123456789A";
88 $rg_repo_allow = '/^[A-Za-z0-9]*$/';
88 $rg_repo_allow = 'A-Za-z0-9';
89 89 $rg_repo_max_len = 10; $rg_repo_max_len = 10;
90 90 $c = rg_repo_ok($v); $c = rg_repo_ok($v);
91 91 if ($c !== FALSE) { if ($c !== FALSE) {
File tests/user.php changed (mode: 100644) (index 15f5e54..fb88144)
... ... $rg_sql_debug = 1;
21 21 $rg_repos = "ubase"; $rg_repos = "ubase";
22 22 $rg_user_max_len = 20; $rg_user_max_len = 20;
23 23 $rg_session_time = 3600; $rg_session_time = 3600;
24 $rg_user_allow = '/^[A-Za-z0-9_.-]*$/';
24 $rg_user_allow = 'A-Za-z0-9_.-';
25 25 $rg_admin_email = "rg@embedromix.ro"; $rg_admin_email = "rg@embedromix.ro";
26 26 $rg_admin_name = "RocketGit Admin"; $rg_admin_name = "RocketGit Admin";
27 27 $_SERVER['HTTP_HOST'] = "fake.tld"; $_SERVER['HTTP_HOST'] = "fake.tld";
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master