Skip to content

Commit 3535a03

Browse files
Merge pull request #69 from step-security/implicit-endpoints
Implicit endpoints
2 parents f78b9cd + e6f0b89 commit 3535a03

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

agent.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer,
142142

143143
// Start network monitor
144144
go netMonitor.MonitorNetwork(nflog, errc) // listens for NFLOG messages
145-
146-
for _, endpoint := range config.Endpoints {
145+
endpoints := addImplicitEndpoints(config.Endpoints)
146+
for _, endpoint := range endpoints {
147147
// this will cause domain, IP mapping to be cached
148148
ipAddress, err := dnsProxy.getIPByDomain(endpoint.domainName)
149149
if err != nil {
@@ -181,6 +181,18 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer,
181181
}
182182
}
183183

184+
func addImplicitEndpoints(endpoints []Endpoint) []Endpoint {
185+
implicitEndpoints := []Endpoint{
186+
{domainName: "agent.api.stepsecurity.io", port: 443}, // Should be implicit based on user feedback
187+
{domainName: "pipelines.actions.githubusercontent.com", port: 443}, // GitHub
188+
{domainName: "codeload.github.com", port: 443}, // GitHub
189+
{domainName: "token.actions.githubusercontent.com", port: 443}, // GitHub
190+
{domainName: "vstoken.actions.githubusercontent.com", port: 443}, // GitHub
191+
}
192+
193+
return append(endpoints, implicitEndpoints...)
194+
}
195+
184196
func RevertChanges(iptables *Firewall, nflog AgentNflogger,
185197
cmd Command, resolvdConfigPath, dockerDaemonConfigPath string, dnsConfig DnsConfig) {
186198
err := RevertFirewallChanges(iptables)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"repo":"owner/repo","run_id":"1287185438","correlation_id":"d942cc6c-d349-49da-ad54-a1bf92538567", "api_url":"https://apiurl/v1", "allowed_endpoints":"github.com:443 pipelines.actions.githubusercontent.com:443"
2+
"repo":"owner/repo","run_id":"1287185438","correlation_id":"d942cc6c-d349-49da-ad54-a1bf92538567", "api_url":"https://apiurl/v1", "allowed_endpoints":"github.com:443 www.google.com:443"
33
}

0 commit comments

Comments
 (0)