/harness-claude:owasp-auth-patternsfrom harness-claude
Implements OWASP-recommended authentication patterns: password hashing (Argon2id, bcrypt), JWT with algorithm validation, and refresh token rotation with theft detection.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:owasp-auth-patterns still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Implement authentication that resists credential stuffing, session hijacking, and token theft
Never store plaintext or MD5/SHA1 passwords. Use adaptive hashing:
import * as argon2 from 'argon2';
import * as bcrypt from 'bcrypt';
// Argon2id — preferred (winner of Password Hashing Competition)
async function hashPassword(password: string): Promise<string> {
return argon2.hash(password, {
type: argon2.argon2id,
memoryCost: 65536, // 64 MiB
timeCost: 3,
parallelism: 4,
});
}
async function verifyPassword(hash: string, password: string): Promise<boolean> {
return argon2.verify(hash, password);
}
// bcrypt — acceptable alternative, saltRounds >= 12
const hash = await bcrypt.hash(password, 12);
const valid = await bcrypt.compare(password, hash);
import jwt from 'jsonwebtoken';
// Sign — short-lived access tokens + long-lived refresh tokens
function signAccessToken(payload: { sub: string; roles: string[] }): string {
return jwt.sign(payload, process.env.JWT_SECRET!, {
expiresIn: '15m', // short-lived
algorithm: 'HS256',
issuer: 'api.example.com',
audience: 'api.example.com',
});
}
// Verify — always validate algorithm explicitly to prevent alg:none attacks
function verifyToken(token: string): jwt.JwtPayload {
return jwt.verify(token, process.env.JWT_SECRET!, {
algorithms: ['HS256'], // NEVER omit this
issuer: 'api.example.com',
audience: 'api.example.com',
}) as jwt.JwtPayload;
}
Rotate refresh tokens on every use. Detect reuse (theft signal).
async function refreshAccessToken(refreshToken: string) {
const stored = await db.refreshToken.findUnique({ where: { token: refreshToken } });
if (!stored) throw new UnauthorizedException('Invalid refresh token');
if (stored.usedAt) {
// Reuse detected — potential theft. Revoke all tokens for this user.
await db.refreshToken.deleteMany({ where: { userId: stored.userId } });
throw new UnauthorizedException('Token reuse detected');
}
if (stored.expiresAt < new Date()) {
throw new UnauthorizedException('Refresh token expired');
}
// Mark old token as used
await db.refreshToken.update({ where: { id: stored.id }, data: { usedAt: new Date() } });
// Issue new token pair
const newRefreshToken = crypto.randomBytes(32).toString('hex');
await db.refreshToken.create({
data: {
token: newRefreshToken,
userId: stored.userId,
expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000), // 30 days
},
});
return {
accessToken: signAccessToken({ sub: stored.userId, roles: stored.roles }),
refreshToken: newRefreshToken,
};
}
For cookie-based sessions:
import session from 'express-session';
import RedisStore from 'connect-redis';
app.use(
session({
store: new RedisStore({ client: redisClient }),
secret: process.env.SESSION_SECRET!,
resave: false,
saveUninitialized: false,
cookie: {
httpOnly: true, // prevent JS access
secure: true, // HTTPS only
sameSite: 'strict', // CSRF protection
maxAge: 15 * 60 * 1000, // 15 minutes
},
genid: () => crypto.randomUUID(), // cryptographically random IDs
})
);
// Regenerate session ID after login to prevent session fixation
app.post('/login', async (req, res) => {
const user = await authenticate(req.body);
req.session.regenerate((err) => {
if (err) throw err;
req.session.userId = user.id;
res.json({ ok: true });
});
});
import rateLimit from 'express-rate-limit';
// Limit login attempts per IP
const loginLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 5,
skipSuccessfulRequests: true,
standardHeaders: true,
message: 'Too many login attempts, please try again later',
});
app.post('/login', loginLimiter, loginHandler);
Token storage:
Credential stuffing defenses:
Logout:
jti claim, or use short-lived tokens with refresh rotationMulti-factor authentication:
otplib@simplewebauthn/server for phishing-resistant authhttps://owasp.org/www-project-top-ten/
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job