<commit_before># camouflage

![camo](http://farm5.static.flickr.com/4116/4857328881_fefb8e2134_z.jpg)

Camouflage is all about making insecure assets looks secure, bro.  This is an SSL image proxy to prevent mixed content warnings on secure pages served from https://github.com.

We wanted to allow people to keep embedding image links in their comments and README files.  This also handles inlining google charts images.

[More Info Here](https://github.com/blog/743-sidejack-prevention-phase-3-ssl-proxied-assets)

We share a key between this proxy and the GitHub main app.  We encrypt the URL with [hmac](http://en.wikipedia.org/wiki/HMAC) so we're not an open proxy.  These keys come from the shell environment and are unique per deployment environment.  I'm not 100% sure this step is necessary.

When the GitHub app renders markdown it replaces all of the `src` attributes on any `img` tags with the an appropriate URL to hit the proxies.

## Testing Functionality

### Start the server
    % coffee server.coffee

### In another shell

    % rake

### Debugging

To see the full URL resclient is hitting etc, try this.

    % RESTCLIENT_LOG=stdout rake

### Deployment

You can see an example [god config](https://gist.github.com/675038) here.

To enable useful line numbers in stacktraces you probably want to
compile the server.coffee file to native javascript when deploy

    % coffee -c server.coffee
    % node server.js
<commit_msg>readme fixups<commit_after># camo

![camo](http://farm5.static.flickr.com/4116/4857328881_fefb8e2134_z.jpg)

Camouflage is all about making insecure assets looks secure.  This is an SSL image proxy to prevent mixed content warnings on secure pages served from [github](https://github.com).

We wanted to allow people to keep embedding image links in their comments and README files.  This also handles inlining google charts images.

[More Info Here](https://github.com/blog/743-sidejack-prevention-phase-3-ssl-proxied-assets)

We share a key between this proxy and the GitHub main app.  We encrypt the URL with [hmac](http://en.wikipedia.org/wiki/HMAC) so we're not an open proxy.  These keys come from the shell environment and are unique per deployment environment.  I'm not 100% sure this step is necessary.

When the GitHub app renders markdown it replaces all of the `src` attributes on any `img` tags with the an appropriate URL to hit the proxies.

## Testing Functionality

### Start the server
    % coffee server.coffee

### In another shell

    % rake

### Debugging

To see the full URL resclient is hitting etc, try this.

    % RESTCLIENT_LOG=stdout rake

### Deployment

You can see an example [god config](https://gist.github.com/675038) here.

To enable useful line numbers in stacktraces you probably want to
compile the server.coffee file to native javascript when deploy

    % coffee -c server.coffee
    % node server.js

{'fraction_non_alphanumeric': 0.07367692839847803, 'fraction_numerical': 0.02282947077135939, 'mean_word_length': 4.012131715771231, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1932447', 'n_tokens_mistral': 891, 'n_tokens_neox': 813, 'n_words': 372}