<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Softcore software development &#187; Web</title>
	<atom:link href="http://tea.cesaroliveira.net/archives/tag/web/feed" rel="self" type="application/rss+xml" />
	<link>http://tea.cesaroliveira.net</link>
	<description>It&#039;s all about the cycles</description>
	<lastBuildDate>Sun, 01 Aug 2010 02:04:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Allowing mixing insecure and secure content</title>
		<link>http://tea.cesaroliveira.net/archives/92</link>
		<comments>http://tea.cesaroliveira.net/archives/92#comments</comments>
		<pubDate>Mon, 31 Aug 2009 02:38:12 +0000</pubDate>
		<dc:creator>Cesar</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[crazy]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://tea.cesaroliveira.net/?p=92</guid>
		<description><![CDATA[This is something that&#8217;s been floating in my head. Not sure how much this is worth advancing, or whether it is deeply flawed. Or whether it was considered at some point but not indexed by Google good enough. Many sites do mix HTTP and HTTPS content. Sites that do this are no-longer considered secure (Larry [...]]]></description>
			<content:encoded><![CDATA[<p>This is something that&#8217;s been floating in my head. Not sure how much this is worth advancing, or whether it is deeply flawed. Or whether it was considered at some point but not indexed by Google good enough.</p>
<p>Many sites do mix HTTP and HTTPS content. Sites that do this are no-longer considered secure (Larry goes away, the lock has a warning symbol over it) for good reason, the insecure content cannot be trusted. It may have been tampered with. If the content was a javascript file for instance, it could be very bad news.</p>
<p>But if we know that data from a secure source can&#8217;t be tampered with, could it vouch for content that isn&#8217;t secure? Let&#8217;s take an example of a fictitious webpage :</p>
<p><code><br />
&lt;script type="text/javascript" src="http://media.cesaroliveira.net/badass-javascript.js"&gt;&lt;/script&gt;<br />
&lt;img src="http://media.cesaroliveira.net/panda.jpg" alt="look out!" /&gt;<br />
Credit card number : &lt;input type="text" ...<br />
</code></p>
<p>Even though the site is served securely, some important information is sent insecurely. I am proposing that the secure content is able to pass along a hash (sha1, not md5) of the content that it expects. If the content in the insecure channel meets the has the same hash value, then we can be reasonably assured that the data has not been tampered with during transport. Let&#8217;s see the code again :</p>
<p><code><br />
&lt;script type="text/javascript" src="http://media.cesaroliveira.net/badass-javascript.js" data-hash="sha1:12b36be3076d357b2d390b2df3f9b65cd55b93e1" &gt;&lt;/script&gt;<br />
&lt;img src="http://media.cesaroliveira.net/panda.jpg" alt="look out!" data-hash="sha1:bcf31e777fa69753f8ecf9701fc9b6f1518b51b3" /&gt;<br />
Credit card number : &lt;input type="text" ...<br />
</code></p>
<p>Starts with data- because I doubt something like this would be implemented outside of my head. But it seems to solve the problem of tampering with the data. If the hashes don&#8217;t match, the website is still broken. If they do match then we should be able to breathe easily.</p>
<p>Of course, in time people will figure out vulnerabilities. Hash collisions is a problem. But this is <a href="http://www.win.tue.nl/hashclash/rogue-ca/" onclick="pageTracker._trackPageview('/outgoing/www.win.tue.nl/hashclash/rogue-ca/?referer=');">something that web had to deal with before</a>. Maybe a nice edition would be allowing multiple hash values, like :</p>
<p>&lt;img src=&#8221;http://media.cesaroliveira.net/panda.jpg&#8221; alt=&#8221;look out!&#8221; data-hash=&#8221;sha1:bcf31e777fa69753f8ecf9701fc9b6f1518b51b3;md5:953c78ac57ca68bfe532eb50120c8aa1&#8243; /&gt;</p>
<p>Yeah. I know I said no md5 <img src='http://tea.cesaroliveira.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://tea.cesaroliveira.net/archives/92/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Maps and geolocation</title>
		<link>http://tea.cesaroliveira.net/archives/61</link>
		<comments>http://tea.cesaroliveira.net/archives/61#comments</comments>
		<pubDate>Fri, 10 Jul 2009 05:37:34 +0000</pubDate>
		<dc:creator>Cesar</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[hugs]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[browser compatibility]]></category>
		<category><![CDATA[google chrome]]></category>

		<guid isPermaLink="false">http://tea.cesaroliveira.net/?p=61</guid>
		<description><![CDATA[I was first made aware of the fact that maps.google.com now uses geolocation by sdwilsh, which is new in Firefox 3.5. But when I loaded maps, I was surprised to see that it didn&#8217;t work when I visited the site. And I was using something even more recent than Firefox 3.5, Minefield. Surely, it has [...]]]></description>
			<content:encoded><![CDATA[<p>I was first made aware of the fact that <a href="http://maps.google.com" onclick="pageTracker._trackPageview('/outgoing/maps.google.com?referer=');">maps.google.com</a> now uses <a href="https://developer.mozilla.org/En/Using_geolocation" onclick="pageTracker._trackPageview('/outgoing/developer.mozilla.org/En/Using_geolocation?referer=');">geolocation</a> by <a href="http://twitter.com/sdwilsh/status/2553543365" onclick="pageTracker._trackPageview('/outgoing/twitter.com/sdwilsh/status/2553543365?referer=');">sdwilsh</a>, which is new in <a href="http://www.spreadfirefox.com" onclick="pageTracker._trackPageview('/outgoing/www.spreadfirefox.com?referer=');">Firefox 3.5</a>. But when I loaded maps, I was surprised to see that it didn&#8217;t work when I visited the site. And I was using something even more recent than Firefox 3.5, Minefield. Surely, it has geolocation, so what is going on?</p>
<p>The reason maps doesn&#8217;t support Minefield is because of  *<a href="http://www.youtube.com/watch?v=NNaZedAWmlE" onclick="pageTracker._trackPageview('/outgoing/www.youtube.com/watch?v=NNaZedAWmlE&amp;referer=');">drumrolls</a>* &#8230; browser sniffing. Developers&#8230; no wait&#8230; GOOGLE web developers, I thought we moved on?</p>
<p>The actual bit of code is here unminimized and tidied up ;<br />
<code>
<pre>
function isBrowserGeolocationSupported(){
    if (window.navigator &#038;&#038;
        navigator.userAgent.search("Firefox") != -1 &#038;&#038;
        navigator.geolocation)
        return true;
    if (window.navigator &#038;&#038;
        navigator.userAgent.search("Chrome") != -1)
        return Number(String(/Chrome\/[0-9]+/.exec(navigator.userAgent)).substr(7))>=2;
    var gearsFactory=null;
</pre>
<p></code></p>
<p>The hell? Ok, so I understand they do a bit of browser sniffing because it looks like Chrome had a old/broken implementation of geolocation. But I wish there was a more graceful way of doing this (maybe something like navigator.geolocation.version < 1). One that didn't break every application that may implement geolocation that isn't named Firefox. Because, those <a href="http://flock.com/" onclick="pageTracker._trackPageview('/outgoing/flock.com/?referer=');">exist</a> <a href="http://www.getsongbird.com/" onclick="pageTracker._trackPageview('/outgoing/www.getsongbird.com/?referer=');">too</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tea.cesaroliveira.net/archives/61/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A (Use) Case for self-signed certs</title>
		<link>http://tea.cesaroliveira.net/archives/43</link>
		<comments>http://tea.cesaroliveira.net/archives/43#comments</comments>
		<pubDate>Fri, 14 Nov 2008 08:21:02 +0000</pubDate>
		<dc:creator>Cesar</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[hugs]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.cesaroliveira.net/?p=43</guid>
		<description><![CDATA[There was a bunch of GPG tinkering trying to get GPG to generate a ssh-compatible (ie. one you get from id_rsa.pub) key using my private key. While it turned into a epic fail costing me a good chunk of the day. I dived a bit into the security stuff that everyone hates. While going about [...]]]></description>
			<content:encoded><![CDATA[<p>There was a bunch of <acronym title="GNU Privacy Guard"><a href="http://www.gnupg.org/" onclick="pageTracker._trackPageview('/outgoing/www.gnupg.org/?referer=');">GPG</a></acronym> tinkering trying to get GPG to generate a ssh-compatible (ie. one you get from id_rsa.pub) key using my private key. While it turned into a epic fail costing me a good chunk of the day. I dived a bit into the security stuff that everyone hates.</p>
<p>While going about my day, I wondering if self-signed certs can be used in a way that wouldn&#8217;t get you ostracized from a security conscious community. Johnathon has <a href="http://blog.johnath.com/2008/08/05/ssl-question-corner/" onclick="pageTracker._trackPageview('/outgoing/blog.johnath.com/2008/08/05/ssl-question-corner/?referer=');">warned the blogosphere</a> at large why self-signed certs are bad and why Firefox makes you jump through hoops to allow a self-signed cert to get through. But I thought of a good use case for why you may want to use it :</p>
<ol>
<li>Self-signed certs provide little value for your users (fe. blog comments are public anyways)</li>
<li> You may not have the means (eg. credit card, unique ip if your with Dreamhost) to buy one</li>
<li> You only <em>really</em> need them for some basic stuff that users shouldn&#8217;t interact with at all. Like logging in to wordpress.</li>
</ol>
<p>In which case, you can generate a self-signed cert and configure a web server to serve you it on some uncommon port such as port 43034. The benefit is that its transparent to users. It will not interfere with their browsing. And you get the benefit of encryption and authorization, and knowing for certain that the certificate is yours (you have access to the certificate&#8217;s fingerprints).</p>
<p>I tried this on <a href="http://www.dreamhost.com/" onclick="pageTracker._trackPageview('/outgoing/www.dreamhost.com/?referer=');">Dreamhost</a> and I failed. Or, rather, Apache doesn&#8217;t you set up a &lt;VirtualHost&gt; in a <a href="http://httpd.apache.org/docs/2.0/howto/htaccess.html" onclick="pageTracker._trackPageview('/outgoing/httpd.apache.org/docs/2.0/howto/htaccess.html?referer=');">.htaccess</a> file. Dreamhost didn&#8217;t have anything in their web panel that would fix this. You can enable SSL for a site, but they force you into port 443 and don&#8217;t let you have both HTTP and HTTPS.</p>
<p>Another excellent educational learning opportunity <strong>ruined</strong> by over-zealous security zealots.</p>
]]></content:encoded>
			<wfw:commentRss>http://tea.cesaroliveira.net/archives/43/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Now for something completely different</title>
		<link>http://tea.cesaroliveira.net/archives/42</link>
		<comments>http://tea.cesaroliveira.net/archives/42#comments</comments>
		<pubDate>Fri, 31 Oct 2008 05:41:31 +0000</pubDate>
		<dc:creator>Cesar</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[hugs]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ria]]></category>

		<guid isPermaLink="false">http://www.cesaroliveira.net/?p=42</guid>
		<description><![CDATA[This post is a mashup of a few things I have been tinkering with over the last week that I think is fun to share. So if it seems I have been unfocused or whatever, this is pretty much why. The first project I started doing for fun was working on canvas. This was different [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a mashup of a few things I have been tinkering with over the last week that I think is fun to share. So if it seems I have been unfocused or whatever, this is pretty much why.</p>
<p>The first project I started doing for fun was working on canvas. This was different then some canvas stuff I have done <a href="http://www.cesaroliveira.net/tea/archives/37" onclick="pageTracker._trackPageview('/outgoing/www.cesaroliveira.net/tea/archives/37?referer=');">in the past</a>, The interesting people at <a href="http://www.nihilogic.dk/" onclick="pageTracker._trackPageview('/outgoing/www.nihilogic.dk/?referer=');">nihilogic</a> did a <a href="http://www.nihilogic.dk/labs/imagefx/" onclick="pageTracker._trackPageview('/outgoing/www.nihilogic.dk/labs/imagefx/?referer=');">sepia filter</a> using canvas. I wondered if it was possible to do filter so you can see an image with a red-green colour blindness. After some substandard research, I finally managed to do it. Though the quality is poor because it tends to be inaccurate. YMMV.</p>
<p>I wondered if you can do something like this for an entire webpage. So I moved the Javascript to an extension so I can use canvas&#8217; drawWindow() method and take a picture of the entire website. Though I noticed that doing this on large image was computationally expensive and locking up the UI for an unreasonable amount of time.</p>
<p>I then tried to move all the calculations out of the main thread into a <a href="http://www.whatwg.org/specs/web-workers/current-work/" onclick="pageTracker._trackPageview('/outgoing/www.whatwg.org/specs/web-workers/current-work/?referer=');">DOM worker thread</a>. It was an interesting experience. I noticed though that while the main thread (and therefore, the UI) did not lock up, it was still sluggish and impractical to use. So I decided not to develop the extension further.</p>
<p><img src="/files/2008-10-29/firefox-transfer.png" alt="Image under Deuteranopia colour-blindness" /><br />
You can see the full demo <a href="http://www.cesaroliveira.net/samples/blindness/" onclick="pageTracker._trackPageview('/outgoing/www.cesaroliveira.net/samples/blindness/?referer=');">here</a>.</p>
<p>I then thought about what this would look like on other browsers. I didn&#8217;t expect anything requiring DOM worker threads to work on Safari/Opera. And sure enough, it didn&#8217;t. But I found out that DOM worker threads was based off of <a href="http://code.google.com/apis/gears/api_summary.html" onclick="pageTracker._trackPageview('/outgoing/code.google.com/apis/gears/api_summary.html?referer=');">Google gears</a>! So I looked into that and made a separate webpage that uses gears. Unfortunately, I found out that my efforts were largely wasted, as it only increased support to Firefox 2 and Mac Safari (Gears isn&#8217;t compatible with Windows Safari or Opera, and IE doesn&#8217;t have canvas support).</p>
<p>Either way, I made the Gears version available <a href="http://www.cesaroliveira.net/samples/blindness-gears/" onclick="pageTracker._trackPageview('/outgoing/www.cesaroliveira.net/samples/blindness-gears/?referer=');">here</a>.</p>
<p>Going away from canvas, I spent most of another day working on <a href="http://code.google.com/apis/maps/documentation/introduction.html" onclick="pageTracker._trackPageview('/outgoing/code.google.com/apis/maps/documentation/introduction.html?referer=');">Google Maps API</a>. The problem I was trying to solve was to see if I can highlight a 1 square kilometre radius from a pinpoint. This was difficult, as points on a map had a latitude, longitude co-ordinate, and I had to blindly figure out how much to reposition for a half-kilometre. Finding the distance between two points was also helpful, but hard getting a <a href="http://www.movable-type.co.uk/scripts/latlong.html" onclick="pageTracker._trackPageview('/outgoing/www.movable-type.co.uk/scripts/latlong.html?referer=');">good formula</a> for.</p>
<p><iframe src="/samples/gmaps-distance/" width="600px" height="410px"></iframe><br />
Of course, I am highlighting all the accomplishments and not mentioning the frustrating obstacles. There were  several lessons learn on the way. Including a lot about incompatibility and how much I still don&#8217;t know how to do the kind of algorithmic research that you sometimes need. I&#8217;m starting to wonder if the BSD course taught me more than just to be a code monkey with a business touch, and made me wonder whether the theoretical/mathematical part will ever stop me doing something because “I just won&#8217;t get it”. Though, at the same time, I wasn&#8217;t willing to put the time and effort of research into pet projects. So this will probably be a problem for almost everyone, and not just me (honestly, mapping out longitude and latitude to distance is not something you learn anywhere).</p>
]]></content:encoded>
			<wfw:commentRss>http://tea.cesaroliveira.net/archives/42/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
