aboutsummaryrefslogtreecommitdiff
path: root/internal/onionloc/onionloc_test.go
blob: 4d208761d8fe8520125496bbbe0f2d8314a04775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
package onionloc

import (
	"io"
	"net/http"
	"strings"
	"testing"
)

func TestHTML(t *testing.T) {
	for _, table := range []struct {
		desc string
		html string
		want string
	}{
		{"onion location set", htmlNoOnionLocation, ""},
		{"onion location unset", htmlOnionLocation, htmlOnionLocationValue},
	} {
		var r http.Response
		r.Body = io.NopCloser(strings.NewReader(table.html))

		v, ok := HTML(&r)
		if got, want := ok, table.want != ""; got != want {
			t.Errorf("%s: got ok %v but wanted %v", table.desc, got, want)
			continue
		}
		if !ok {
			continue
		}
		if got, want := v, table.want; got != want {
			t.Errorf("%s: got %s but wanted %s", table.desc, got, want)
		}
	}
}

// curl -s https://www.rgdd.se/
const htmlNoOnionLocation = `<!DOCTYPE html>
<html lang=""><head>
	<meta name="generator" content="Hugo 0.105.0">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <title>rgdd.se</title>
    <meta name="description" content="A simple monospaced resume theme for Hugo.">
    <meta name="author" content='Rasmus Dahlberg'>

    <link rel="stylesheet" href="/cdnjs/bootstrap.min.css">
    <link rel="stylesheet" href="/cdnjs/all.min.css">
    <link rel="stylesheet" href="/fontawesome/all.css">

    
    <link rel="stylesheet" href="/sass/researcher.min.css">

    

    <link rel="alternate" type="application/rss+xml" href="https://www.rgdd.se/index.xml" title="rgdd.se" />
    
        
    
</head>

    <body><div class="container mt-5">
    <nav class="navbar navbar-expand-sm flex-column flex-sm-row text-nowrap p-0">
        <a class="navbar-brand mx-0 mr-sm-auto" href="https://www.rgdd.se" title="rgdd.se">
          
          rgdd.se
        </a>
        <div class="navbar-nav flex-row flex-wrap justify-content-center">
            
                
                
                    <a class="nav-item nav-link" href="/post" title="Blog">
                        Blog
                    </a>
                    
                
            
        </div>
    </nav>
</div>
<hr>
<div id="content">
<div class="container">
    <figure class="avatar"><img src="img/author.jpg"
         alt="avatar"/>
</figure>

<p>PhD student at <a href="https://www.kau.se/en/">Karlstad University</a>.  Software engineer at <a href="https://www.glasklarteknik.se/">Glasklar Teknik</a>.
I am passionate about transparency logs, anonymity networks, and Linux.  I have
a keen interest for the overlap between research, engineering, and operations.
Off-work I cook, walk, socialize, lift weights, and spoil my cat.</p>
<h1 id="project-involvement">Project involvement</h1>
<p>I am a core member of the following projects:</p>
<ul>
<li><a href="https://www.sigsum.org/">Sigsum</a>: a free and open source software project that makes a signer&rsquo;s
key-usage transparent.  It can be used as a building block to secure the
supply chain and more.</li>
<li><a href="https://www.system-transparency.org/">System Transparency</a>: an open source project that provides a security
architecture for bare metal servers.  A system&rsquo;s entire boot chain becomes
protected and auditable.</li>
<li><a href="https://www.torproject.org/">Tor</a>: a 501(c)(3) US nonprofit that advance human rights and defend online
privacy through free software and open networks.</li>
</ul>
<h1 id="selected-publications">Selected publications</h1>
<ul>
<li>Rasmus Dahlberg, Tobias Pulls.
<a href="https://www.usenix.org/conference/usenixsecurity23/presentation/dahlberg">Timeless Timing Attacks and Preload Defenses in Tor&rsquo;s DNS Cache</a>.
USENIX Security (2023)</li>
<li>Rasmus Dahlberg, Tobias Pulls, Tom Ritter, and Paul Syverson.
<a href="https://petsymposium.org/2021/files/papers/issue2/popets-2021-0024.pdf">Privacy-Preserving &amp; Incrementally-Deployable Support for Certificate Transparency in Tor</a>.
PETS (2021)</li>
<li>Tobias Pulls and Rasmus Dahlberg.
<a href="https://petsymposium.org/2020/files/papers/issue1/popets-2020-0013.pdf">Website Fingerprinting with Website Oracles</a>.
PETS (2020)</li>
<li>Rasmus Dahlberg, Tobias Pulls, Jonathan Vestin, Toke Høiland-Jørgensen, and Andreas Kassler.
<a href="https://arxiv.org/pdf/1806.08817.pdf">Aggregation-Based Certificate Transparency Gossip</a>.
SECUREWARE (2019)</li>
<li>Tobias Pulls and Rasmus Dahlberg.
<a href="https://eprint.iacr.org/2018/737.pdf">Steady: A Simple End-to-End Secure Logging System</a>.
NordSec (2018)</li>
</ul>
<h1 id="contact">Contact</h1>
<p>Feel free to reach out on email or other platforms as you see fit.</p>

</div>

        </div><div id="footer" class="mb-5">
    <hr>
    
    <div class="container text-center">
        
            <a href="https://www.instagram.com/__rgdd" class="fab fa-instagram fa-1x" title="Instagram"></a>
        
            <a href="https://mastodon.social/@rgdd" class="fab fa-mastodon fa-1x" title="Mastodon"></a>
        
            <a href="https://github.com/rgdd" class="fab fa-github fa-1x" title="GitHub"></a>
        
            <a href="https://gitlab.torproject.org/rgdd" class="fab fa-gitlab fa-1x" title="GitLab"></a>
        
            <a href="https://git.glasklar.is/rgdd" class="fab fa-gitlab fa-1x" title="GitLab"></a>
        
            <a href="mailto:rasmus@rgdd.se" class="fas fa-envelope fa-1x" title="E-mail"></a>
        
    </div>
    
    
        <div class="container text-center">
            <a href="http://cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion" title="cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion"><small>cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion</small></a>
        </div>
    
</div>
</body>
</html>`

const htmlOnionLocationValue = "http://cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion/"

// curl -s https://www.rgdd.se/
// then add <meta http-equiv="onion-location" content="http://cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion/" />
// somewhere in the head portion
const htmlOnionLocation = `<!DOCTYPE html>
<html lang=""><head>
	<meta name="generator" content="Hugo 0.105.0">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <title>rgdd.se</title>
    <meta name="description" content="A simple monospaced resume theme for Hugo.">
    <meta name="author" content='Rasmus Dahlberg'>
    <meta http-equiv="onion-location" content="http://cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion/" />

    <link rel="stylesheet" href="/cdnjs/bootstrap.min.css">
    <link rel="stylesheet" href="/cdnjs/all.min.css">
    <link rel="stylesheet" href="/fontawesome/all.css">

    
    <link rel="stylesheet" href="/sass/researcher.min.css">

    

    <link rel="alternate" type="application/rss+xml" href="https://www.rgdd.se/index.xml" title="rgdd.se" />
    
        
    
</head>

    <body><div class="container mt-5">
    <nav class="navbar navbar-expand-sm flex-column flex-sm-row text-nowrap p-0">
        <a class="navbar-brand mx-0 mr-sm-auto" href="https://www.rgdd.se" title="rgdd.se">
          
          rgdd.se
        </a>
        <div class="navbar-nav flex-row flex-wrap justify-content-center">
            
                
                
                    <a class="nav-item nav-link" href="/post" title="Blog">
                        Blog
                    </a>
                    
                
            
        </div>
    </nav>
</div>
<hr>
<div id="content">
<div class="container">
    <figure class="avatar"><img src="img/author.jpg"
         alt="avatar"/>
</figure>

<p>PhD student at <a href="https://www.kau.se/en/">Karlstad University</a>.  Software engineer at <a href="https://www.glasklarteknik.se/">Glasklar Teknik</a>.
I am passionate about transparency logs, anonymity networks, and Linux.  I have
a keen interest for the overlap between research, engineering, and operations.
Off-work I cook, walk, socialize, lift weights, and spoil my cat.</p>
<h1 id="project-involvement">Project involvement</h1>
<p>I am a core member of the following projects:</p>
<ul>
<li><a href="https://www.sigsum.org/">Sigsum</a>: a free and open source software project that makes a signer&rsquo;s
key-usage transparent.  It can be used as a building block to secure the
supply chain and more.</li>
<li><a href="https://www.system-transparency.org/">System Transparency</a>: an open source project that provides a security
architecture for bare metal servers.  A system&rsquo;s entire boot chain becomes
protected and auditable.</li>
<li><a href="https://www.torproject.org/">Tor</a>: a 501(c)(3) US nonprofit that advance human rights and defend online
privacy through free software and open networks.</li>
</ul>
<h1 id="selected-publications">Selected publications</h1>
<ul>
<li>Rasmus Dahlberg, Tobias Pulls.
<a href="https://www.usenix.org/conference/usenixsecurity23/presentation/dahlberg">Timeless Timing Attacks and Preload Defenses in Tor&rsquo;s DNS Cache</a>.
USENIX Security (2023)</li>
<li>Rasmus Dahlberg, Tobias Pulls, Tom Ritter, and Paul Syverson.
<a href="https://petsymposium.org/2021/files/papers/issue2/popets-2021-0024.pdf">Privacy-Preserving &amp; Incrementally-Deployable Support for Certificate Transparency in Tor</a>.
PETS (2021)</li>
<li>Tobias Pulls and Rasmus Dahlberg.
<a href="https://petsymposium.org/2020/files/papers/issue1/popets-2020-0013.pdf">Website Fingerprinting with Website Oracles</a>.
PETS (2020)</li>
<li>Rasmus Dahlberg, Tobias Pulls, Jonathan Vestin, Toke Høiland-Jørgensen, and Andreas Kassler.
<a href="https://arxiv.org/pdf/1806.08817.pdf">Aggregation-Based Certificate Transparency Gossip</a>.
SECUREWARE (2019)</li>
<li>Tobias Pulls and Rasmus Dahlberg.
<a href="https://eprint.iacr.org/2018/737.pdf">Steady: A Simple End-to-End Secure Logging System</a>.
NordSec (2018)</li>
</ul>
<h1 id="contact">Contact</h1>
<p>Feel free to reach out on email or other platforms as you see fit.</p>

</div>

        </div><div id="footer" class="mb-5">
    <hr>
    
    <div class="container text-center">
        
            <a href="https://www.instagram.com/__rgdd" class="fab fa-instagram fa-1x" title="Instagram"></a>
        
            <a href="https://mastodon.social/@rgdd" class="fab fa-mastodon fa-1x" title="Mastodon"></a>
        
            <a href="https://github.com/rgdd" class="fab fa-github fa-1x" title="GitHub"></a>
        
            <a href="https://gitlab.torproject.org/rgdd" class="fab fa-gitlab fa-1x" title="GitLab"></a>
        
            <a href="https://git.glasklar.is/rgdd" class="fab fa-gitlab fa-1x" title="GitLab"></a>
        
            <a href="mailto:rasmus@rgdd.se" class="fas fa-envelope fa-1x" title="E-mail"></a>
        
    </div>
    
    
        <div class="container text-center">
            <a href="http://cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion" title="cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion"><small>cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion</small></a>
        </div>
    
</div>
</body>
</html>`