Skip to content

Instantly share code, notes, and snippets.

View wojtha's full-sized avatar

Vojtěch Kusý wojtha

View GitHub Profile
Ok!
If you (like me) are wondering what's up with there being 3 separate OpenID critical issues between D8 and D7 and what on earth it all means, and more importantly how to fix it, you're in luck! wojtha kindly spent about an hour with me in IRC today walking me through the state of things.
Here's the skinny:
There are two main issues where core's OpenID module is violating spec, and this leads to consequences ranging from certain OpenID providers just plain not working to possible impersonation risks:
[#575810]: When you enter an OpenID provider like "webchick.openid.com", Drupal normalize it into a fully-qualified domain for you, like "http://webchick.openid.com", sets it as a user Claimed Ideintifier and sends a request to that URL to retrieve supported services from the provider and that kind of stuff. The problem is that all public providers (and probably all of the providers around the world) redirects "http://webchick.openid.com" to more secure https://webchick.openid.com or sometimes to completel
@wojtha
wojtha / gitutils.ps1
Created June 19, 2011 10:16 — forked from markembling/gitutils.ps1
Powershell functions for git information
# Git functions
# Mark Embling (http://www.markembling.info/)
# Is the current directory a git repository/working copy?
function isCurrentDirectoryGitRepository {
if ((Test-Path ".git") -eq $TRUE) {
return $TRUE
}
# Test within parent dirs
@wojtha
wojtha / profile.ps1
Created June 19, 2011 10:18 — forked from markembling/profile.ps1
My preferred prompt for Powershell - includes git info.
# My preferred prompt for Powershell.
# Displays git branch and stats when inside a git repository.
# See http://gist.github.com/180853 for gitutils.ps1.
. (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1)
function prompt {
$path = ""
$pathbits = ([string]$pwd).split("\", [System.StringSplitOptions]::RemoveEmptyEntries)
if($pathbits.length -eq 1) {
@wojtha
wojtha / controller_macros.rb
Created November 26, 2012 17:04 — forked from feroult/controller_macros.rb
Rails Controller Macros (with scaffold default)
module ControllerMacros
def self.included(base)
base.extend(GroupMethods)
end
def mock_access(user = mock_model(User))
controller.stub('require_user').and_return(true)
controller.stub('current_user').and_return(user)
end
require 'spec_helper'
describe LineItemsController do
mock :order
mock :customer
# GET /orders/11/line_items
get :index, :order_id => 11 do
default :stub => :off
@wojtha
wojtha / macros_base.rb
Created November 26, 2012 17:04 — forked from feroult/macros_base.rb
RSpec Macros Recorder
module MacrosBase
def self.included(base)
base.extend(GroupMethods)
end
module GroupMethods
def mock(model_name)
class_eval <<-EOFMOCK
def mock_#{model_name}(stubs={})
(@mock_#{model_name} ||= mock_model(#{model_name.to_s.classify}).as_null_object).tap do |#{model_name}|
@wojtha
wojtha / README.md
Created December 5, 2012 18:39 — forked from coreyward/README.md
@wojtha
wojtha / Chef Bootstrap Ruby 1.9.3-p194
Created December 9, 2012 17:35 — forked from tjsingleton/Chef Solo Bootstrap with Ruby 2.2.2
Chef Solo Bootstrap with Ruby 1.9.3-p327
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
apt-get -y install autoconf curl git-core bzip2
apt-get -y autoremove
apt-get -y clean
cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
tar -xvzf ruby-1.9.3-p327.tar.gz
@wojtha
wojtha / gist:4503703
Created January 10, 2013 16:52 — forked from dhh/gist:1975644
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@wojtha
wojtha / gist:4506860
Created January 11, 2013 00:02 — forked from dhh/gist:1014971
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end