Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
rgetwellknown: support + in tags
Browse files Browse the repository at this point in the history
+ is a fairly common thing to have in a tag. Add it to the wellknown
parsing.
  • Loading branch information
Brandon Philips committed Jul 24, 2019
1 parent b25e652 commit cd122ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ x Take github credentials via environment variables
x Submit automatically after github publish happens - printed out submit instead
x Print out an rget command after submission for a user to test
- Add prometheus metrics exporting for GET requests and submission requests and hook up to stackdriver
- Use a different path for submissions. probably /submit or something
- Introduce rget check to check a URL works and when the certificate was issued, etc
- Make the rget root command output more useful output
x SHA256SUMS file checked
Expand All @@ -55,6 +56,8 @@ x Print out an rget command after submission for a user to test
- Add log-search command that dumps URLs to various log search engines
- https://crt.sh/?Identity=%25.v2-0.releases-test.philips.github.com.established.ifup.org
- https://transparencyreport.google.com/https/certificates?cert_search_auth=&cert_search_cert=&cert_search=include_expired:true;include_subdomains:true;domain:v2-0.releases-test.philips.github.com.established.ifup.org&lu=cert_search
- Add a test script that tries a GitHub project without SHA256SUMS
- Add test script that uses a self-signed TLS certificate not in the log
- Define roadmap for self-hosting

## PR+1 - All file GH Release Test
Expand Down
7 changes: 4 additions & 3 deletions rgetwellknown/wellknown.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ var githubPaths = []*vcsPath{
{
prefix: "api.github.com/",
// https://api.github.com/repos/philips/releases-test/zipball/v2.0
regexp: regexp.MustCompile(`^api\.(?P<root>github\.com)/repos/(?P<org>[A-Za-z0-9_.\-]+)/(?P<repo>[A-Za-z0-9_.\-]+)/(zipball|tarball)/(?P<tag>[A-Za-z0-9_.\-]+)$`),
regexp: regexp.MustCompile(`^api\.(?P<root>github\.com)/repos/(?P<org>[A-Za-z0-9_.\-]+)/(?P<repo>[A-Za-z0-9_.\-]+)/(zipball|tarball)/(?P<tag>[A-Za-z0-9_.\-\+]+)$`),
domain: "{dnstag}.{repo}.{org}.{root}",
sumPrefix: "https://github.com/{org}/{repo}/releases/download/{tag}/",
},
// Github release downloads
{
prefix: "github.com/",
// https://github.com/philips/releases-test/releases/download/v2.0/SHA256SUMS
regexp: regexp.MustCompile(`^(?P<root>github\.com)/(?P<org>[A-Za-z0-9_.\-]+)/(?P<repo>[A-Za-z0-9_.\-]+)/releases/download/(?P<tag>[A-Za-z0-9_.\-]+)/(?P<file>[A-Za-z0-9_.\-]+)$`),
regexp: regexp.MustCompile(`^(?P<root>github\.com)/(?P<org>[A-Za-z0-9_.\-]+)/(?P<repo>[A-Za-z0-9_.\-]+)/releases/download/(?P<tag>[A-Za-z0-9_.\-\+]+)/(?P<file>[A-Za-z0-9_.\-]+)$`),
domain: "{dnstag}.{repo}.{org}.{root}",
sumPrefix: "https://github.com/{org}/{repo}/releases/download/{tag}/",
},
Expand All @@ -49,7 +49,7 @@ var githubPaths = []*vcsPath{
{
prefix: "github.com/",
// https://github.com/philips/releases-test/archive/v2.0.zip
regexp: regexp.MustCompile(`^(?P<root>github\.com)/(?P<org>[A-Za-z0-9_.\-]+)/(?P<repo>[A-Za-z0-9_.\-]+)/archive/(?P<tag>[A-Za-z0-9_.\-]+)\.(zip|tar\.gz)$`),
regexp: regexp.MustCompile(`^(?P<root>github\.com)/(?P<org>[A-Za-z0-9_.\-]+)/(?P<repo>[A-Za-z0-9_.\-]+)/archive/(?P<tag>[A-Za-z0-9_.\-\+]+)\.(zip|tar\.gz)$`),
domain: "{dnstag}.{repo}.{org}.{root}",
sumPrefix: "https://github.com/{org}/{repo}/releases/download/{tag}/",
},
Expand Down Expand Up @@ -139,6 +139,7 @@ func matchesFromURL(downloadURL string, vcsPaths []*vcsPath) (map[string]string,

// https://community.letsencrypt.org/t/dns-name-has-too-many-labels-error/21577
match["dnstag"] = strings.ReplaceAll(match["tag"], ".", "-")
match["dnstag"] = strings.ReplaceAll(match["dnstag"], "+", "-")

if srv.domain != "" {
match["domain"] = expand(match, srv.domain)
Expand Down
1 change: 1 addition & 0 deletions rgetwellknown/wellknown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func TestDomain(t *testing.T) {
}{
{"https://api.github.com/repos/philips/releases-test/zipball/v2.0", "v2-0.releases-test.philips.github.com", false},
{"https://github.com/philips/releases-test/archive/v2.0.zip", "v2-0.releases-test.philips.github.com", false},
{"https://github.com/philips/releases-test/archive/v2.0+nosums.zip", "v2-0-nosums.releases-test.philips.github.com", false},
{"https://github.com/philips/releases-test/archive/v2.0.tar.gz", "v2-0.releases-test.philips.github.com", false},
{"https://github.com/philips/releases-test/releases/download/v2.0/SHA256SUMS", "v2-0.releases-test.philips.github.com", false},
}
Expand Down

0 comments on commit cd122ed

Please sign in to comment.