Skip to content

Commit 19d9194

Browse files
committed
chore: update default & local cfgs
1 parent 85fb8df commit 19d9194

5 files changed

Lines changed: 88 additions & 98 deletions

File tree

.claude/settings.json

Lines changed: 0 additions & 68 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ packetline-*.txt
6060
### Data ###
6161
.data/
6262

63-
### Claude Code memory (local only) ###
64-
memory/
6563

6664
### Gitea smoke test secrets (generated by docker/gitea-setup.sh) ###
6765
test/gitea/tokens.env
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package org.finos.gitproxy.db.memory;
2+
3+
import java.util.Comparator;
4+
import java.util.List;
5+
import java.util.Map;
6+
import java.util.Optional;
7+
import java.util.concurrent.ConcurrentHashMap;
8+
import org.finos.gitproxy.db.UrlRuleRegistry;
9+
import org.finos.gitproxy.db.model.AccessRule;
10+
11+
/** In-memory {@link UrlRuleRegistry}. Data is lost on restart. */
12+
public class InMemoryUrlRuleRegistry implements UrlRuleRegistry {
13+
14+
private final Map<String, AccessRule> store = new ConcurrentHashMap<>();
15+
16+
@Override
17+
public void initialize() {}
18+
19+
@Override
20+
public void save(AccessRule rule) {
21+
store.put(rule.getId(), rule);
22+
}
23+
24+
@Override
25+
public void update(AccessRule rule) {
26+
store.put(rule.getId(), rule);
27+
}
28+
29+
@Override
30+
public void delete(String id) {
31+
store.remove(id);
32+
}
33+
34+
@Override
35+
public Optional<AccessRule> findById(String id) {
36+
return Optional.ofNullable(store.get(id));
37+
}
38+
39+
@Override
40+
public List<AccessRule> findAll() {
41+
return store.values().stream()
42+
.sorted(Comparator.comparingInt(AccessRule::getRuleOrder).thenComparing(AccessRule::getId))
43+
.toList();
44+
}
45+
46+
@Override
47+
public List<AccessRule> findEnabledForProvider(String provider) {
48+
return store.values().stream()
49+
.filter(AccessRule::isEnabled)
50+
.filter(r -> r.getProvider() == null || r.getProvider().equals(provider))
51+
.sorted(Comparator.comparingInt(AccessRule::getRuleOrder).thenComparing(AccessRule::getId))
52+
.toList();
53+
}
54+
}

git-proxy-java-server/src/main/resources/git-proxy-local.yml

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ server:
1717
# push-identity-codeberg.sh expects "Identity Not Linked" as the failure scenario.
1818
#
1919
# Password format: {noop}plaintext (dev only).
20+
auth:
21+
provider: local
22+
2023
users:
2124
- username: admin
2225
password-hash: "{noop}admin"
@@ -130,9 +133,31 @@ rules:
130133
# also matches, and vice versa.
131134
#
132135
# If no allow rules are configured at all, the proxy operates in fail closed mode (all requests denied).
133-
allow:
136+
deny:
137+
# Guard: never allow pushes to this proxy's own source repository through the proxy.
138+
# /finos/git-proxy is allowed above (for dev testing), but git-proxy-java itself is not.
134139
- enabled: true
135140
order: 10
141+
operations:
142+
- PUSH
143+
providers:
144+
- github
145+
slugs:
146+
- /coopernetes/git-proxy-java
147+
148+
# GitHub Pages repositories are presentation sites — block pushes even if the
149+
# owner is covered by an allow rule (e.g. a future finos/* allow entry).
150+
- enabled: true
151+
order: 20
152+
operations:
153+
- PUSH
154+
providers:
155+
- github
156+
names:
157+
- "*.github.io"
158+
allow:
159+
- enabled: true
160+
order: 30
136161
operations:
137162
- FETCH
138163
providers:
@@ -142,7 +167,7 @@ rules:
142167
- /coopernetes/git-proxy-java
143168
- /coopernetes/test-repo
144169
- enabled: true
145-
order: 20
170+
order: 40
146171
operations:
147172
- FETCH
148173
- PUSH
@@ -151,7 +176,7 @@ rules:
151176
slugs:
152177
- /coopernetes/test-repo-gitlab
153178
- enabled: true
154-
order: 30
179+
order: 50
155180
operations:
156181
- FETCH
157182
- PUSH
@@ -160,33 +185,10 @@ rules:
160185
slugs:
161186
- /coopernetes/test-repo-codeberg
162187
- enabled: true
163-
order: 40
188+
order: 60
164189
operations:
165190
- FETCH
166191
owners:
167192
- finos
168193
providers:
169-
- github
170-
171-
deny:
172-
# Guard: never allow pushes to this proxy's own source repository through the proxy.
173-
# /finos/git-proxy is allowed above (for dev testing), but git-proxy-java itself is not.
174-
- enabled: true
175-
order: 10
176-
operations:
177-
- PUSH
178-
providers:
179-
- github
180-
slugs:
181-
- /coopernetes/git-proxy-java
182-
183-
# GitHub Pages repositories are presentation sites — block pushes even if the
184-
# owner is covered by an allow rule (e.g. a future finos/* allow entry).
185-
- enabled: true
186-
order: 20
187-
operations:
188-
- PUSH
189-
providers:
190-
- github
191-
names:
192-
- "*.github.io"
194+
- github

git-proxy-java-server/src/main/resources/git-proxy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ secret-scan:
167167
# {noop}plaintext — no hashing, for local dev only
168168
# {bcrypt}$2a$12$.. — bcrypt; generate with: htpasswd -bnBC 12 "" yourpassword | tr -d ':\n'
169169
#
170+
# Enable local auth with a single admin user. Not recommended for production!
171+
auth:
172+
provider: local
173+
170174
users:
171175
- username: admin
172176
password-hash: "{noop}admin"

0 commit comments

Comments
 (0)