Skip to content

๐Ÿ›ก๏ธ Sentinel: [CRITICAL] Fix hardcoded admin credentials#38

Closed
seonghobae wants to merge 2 commits into
mainfrom
sentinel-fix-hardcoded-admin-credentials-17384522501331634607
Closed

๐Ÿ›ก๏ธ Sentinel: [CRITICAL] Fix hardcoded admin credentials#38
seonghobae wants to merge 2 commits into
mainfrom
sentinel-fix-hardcoded-admin-credentials-17384522501331634607

Conversation

@seonghobae

Copy link
Copy Markdown

๐Ÿšจ Severity: CRITICAL
๐Ÿ’ก Vulnerability: Hardcoded ADMIN_USERNAME and ADMIN_PASSWORD were present in the source code (packages/web/src/lib/server/admin-auth.ts). This is a critical security vulnerability, as anyone with access to the source code (or decompiled artifacts) could obtain the admin credentials and gain unauthorized access.
๐ŸŽฏ Impact: An attacker with these credentials could bypass authentication, accessing the admin panel and performing unauthorized actions, potentially compromising user data and system integrity.
๐Ÿ”ง Fix:

  • Removed the hardcoded credentials from packages/web/src/lib/server/admin-auth.ts.
  • Configured the application to read these values from environment variables (env.ADMIN_USERNAME, env.ADMIN_PASSWORD).
  • Added validation for these variables using Zod in packages/web/src/lib/server/env.ts, ensuring they are non-empty strings (using .trim().min(N)).
  • Updated .env.example with secure placeholders to guide developers during setup.
  • Updated .github/workflows/ci.yml to inject placeholder values for these required environment variables, ensuring the CI build continues to pass.
    โœ… Verification:
  • Verified locally that the code compiles successfully without the hardcoded variables.
  • Verified that pnpm --filter @argos/web build succeeds when the required environment variables are set.
  • Ensured tests continue to run.

PR created automatically by Jules for task 17384522501331634607 started by @seonghobae

Moved hardcoded ADMIN_USERNAME and ADMIN_PASSWORD in admin-auth.ts to environment variables.
Added validation via Zod in env.ts.
Updated .env.example and CI workflow with placeholder values.
@google-labs-jules

Copy link
Copy Markdown

๐Ÿ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a ๐Ÿ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 14 minutes. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

โŒ› How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

๐Ÿšฆ How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

โ„น๏ธ Review info
โš™๏ธ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d39545a7-4c77-48e2-a898-08ec9f73e3c6

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 2e92fa8 and 07e3806.

๐Ÿ“’ Files selected for processing (3)
  • .jules/sentinel.md
  • packages/web/src/app/api/admin/login/route.ts
  • packages/web/src/lib/server/admin-auth.ts
๐Ÿ“ Walkthrough

Walkthrough

ํ•˜๋“œ์ฝ”๋”ฉ๋œ ๊ด€๋ฆฌ์ž ์‚ฌ์šฉ์ž๋ช…(admin)๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค. ํ™˜๊ฒฝ ์Šคํ‚ค๋งˆ์— ํ•„๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ์ตœ์†Œ ๊ธธ์ด ๊ฒ€์ฆ์„ ์ ์šฉํ•˜๊ณ , ๊ด€๋ฆฌ์ž ์ธ์ฆ ๋ชจ๋“ˆ์ด env ๊ธฐ๋ฐ˜ ๊ฐ’์„ ์‚ฌ์šฉํ•˜๋„๋ก ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.

Changes

๊ด€๋ฆฌ์ž ์ž๊ฒฉ ์ฆ๋ช… ํ™˜๊ฒฝ ์„ค์ •

Layer / File(s) Summary
ํ™˜๊ฒฝ ์Šคํ‚ค๋งˆ ๋ฐ ๊ด€๋ฆฌ์ž ์ž๊ฒฉ ์ฆ๋ช… ๊ฒ€์ฆ
packages/web/src/lib/server/env.ts
EnvSchema์— ADMIN_USERNAME๊ณผ ADMIN_PASSWORD๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ๊ฐ๊ฐ ์ตœ์†Œ 1์ž, 8์ž ์ด์ƒ์˜ ํŠธ๋ฆผ๋œ ๋ฌธ์ž์—ด๋กœ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.
๊ด€๋ฆฌ์ž ์ธ์ฆ์—์„œ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์‚ฌ์šฉ
packages/web/src/lib/server/admin-auth.ts
ADMIN_USERNAME๊ณผ ADMIN_PASSWORD๋ฅผ ํ•˜๋“œ์ฝ”๋”ฉ ๊ฐ’์—์„œ env ๊ฐ์ฒด ๊ธฐ๋ฐ˜ ์ฐธ์กฐ๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.
ํ™˜๊ฒฝ ์˜ˆ์‹œ, CI ์›Œํฌํ”Œ๋กœ์šฐ, ๋ณด์•ˆ ๋ฌธ์„œ
packages/web/.env.example, .github/workflows/ci.yml, .jules/sentinel.md
.env.example์— ๊ด€๋ฆฌ์ž ๋ณ€์ˆ˜ ์˜ˆ์‹œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ , CI ๋นŒ๋“œ ๋‹จ๊ณ„์— ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ๊ตฌ์„ฑํ•˜๋ฉฐ, ํ•˜๋“œ์ฝ”๋”ฉ๋œ ์‹œํฌ๋ฆฟ์˜ ๋ณด์•ˆ ์œ„ํ—˜์„ ๋ฌธ์„œํ™”ํ•ฉ๋‹ˆ๋‹ค.

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~10 ๋ถ„

Poem

๐Ÿฐ ํ•˜๋“œ์ฝ”๋”ฉ ์•ˆ๋…•, ํ™˜๊ฒฝ๋ณ€์ˆ˜ ํ™˜์˜!
๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” ์•ˆ์ „ํ•œ ์ง‘์œผ๋กœ ์ด์‚ฌ ๊ฐ€๊ณ ,
Zod์˜ ๊ฒ€์ฆ์ด ๋“ ๋“ ํ•œ ํŒŒ์ˆ˜๊พผ,
๊ด€๋ฆฌ์ž ๊ณ„์ •๋„ ํ™˜๊ฒฝ์— ๋งก๊ธฐ๋‹ˆ
๋…ธ ํ•˜๋“œ์ฝ”๋”ฉ, ๋…ธ ๋ฌธ์ œ! ๐Ÿ”โœจ

๐Ÿšฅ Pre-merge checks | โœ… 5
โœ… Passed checks (5 passed)
Check name Status Explanation
Title check โœ… Passed PR ์ œ๋ชฉ์ด ๋ณ€๊ฒฝ ์‚ฌํ•ญ์˜ ํ•ต์‹ฌ์„ ๋ช…ํ™•ํ•˜๊ฒŒ ์„ค๋ช…ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜๋“œ์ฝ”๋”ฉ๋œ ๊ด€๋ฆฌ์ž ์ž๊ฒฉ ์ฆ๋ช… ๋ฌธ์ œ๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์ด ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค.
Description check โœ… Passed PR ์„ค๋ช…์ด ๋ณ€๊ฒฝ ์‚ฌํ•ญ๊ณผ ์™„์ „ํžˆ ๊ด€๋ จ์ด ์žˆ์œผ๋ฉฐ, ๋ณด์•ˆ ์ทจ์•ฝ์ , ์ˆ˜์ • ์‚ฌํ•ญ, ๊ฒ€์ฆ ๋ฐฉ๋ฒ•์„ ์ƒ์„ธํžˆ ์„ค๋ช…ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check โœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check โœ… Passed Check skipped because no linked issues were found for this pull request.

โœ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.

โœจ Finishing Touches
๐Ÿงช Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-fix-hardcoded-admin-credentials-17384522501331634607
โœจ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch sentinel-fix-hardcoded-admin-credentials-17384522501331634607

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

๐Ÿค– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/web/src/lib/server/env.ts`:
- Line 8: Session validation breaks when ADMIN_USERNAME contains '.' because
admin session format in admin-auth.ts is username.expiresAt.nonce.signature and
validation splits on '.' expecting 4 parts; update the ADMIN_USERNAME schema in
env.ts to forbid dots (e.g., require no '.' via a regex or refine) so usernames
like "admin.ops" cannot be created, and ensure the change references
ADMIN_USERNAME and the session creation/validation logic in admin-auth.ts to
keep the 4-part split invariant.
๐Ÿช„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

โ„น๏ธ Review info
โš™๏ธ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e0e77c05-aa3a-4730-9d03-cdbd5ad8b72d

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between cdf4ce8 and 2e92fa8.

๐Ÿ“’ Files selected for processing (5)
  • .github/workflows/ci.yml
  • .jules/sentinel.md
  • packages/web/.env.example
  • packages/web/src/lib/server/admin-auth.ts
  • packages/web/src/lib/server/env.ts

DATABASE_URL: z.string().min(1),
DIRECT_URL: z.string().min(1),
JWT_SECRET: z.string().min(32),
ADMIN_USERNAME: z.string().trim().min(1),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โš ๏ธ Potential issue | ๐ŸŸ  Major | โšก Quick win

ADMIN_USERNAME์— . ํ—ˆ์šฉ ์‹œ ๊ด€๋ฆฌ์ž ์„ธ์…˜ ๊ฒ€์ฆ์ด ๊นจ์ง‘๋‹ˆ๋‹ค.

packages/web/src/lib/server/admin-auth.ts์˜ ์„ธ์…˜ ๊ฐ’์€ username.expiresAt.nonce.signature ํ˜•ํƒœ๋กœ ์ƒ์„ฑ๋˜๊ณ (Line 40), ๊ฒ€์ฆ ์‹œ split('.') ๊ฒฐ๊ณผ๋ฅผ 4๊ฐœ๋กœ ๊ณ ์ • ๊ฒ€์‚ฌํ•ฉ๋‹ˆ๋‹ค(Line 64).
ํ˜„์žฌ ์Šคํ‚ค๋งˆ๋Š” ADMIN_USERNAME์— .๋ฅผ ํ—ˆ์šฉํ•˜๋ฏ€๋กœ(์˜ˆ: admin.ops), ์ •์ƒ ๋กœ๊ทธ์ธ ํ›„์—๋„ ์„ธ์…˜์ด ํ•ญ์ƒ ๋ฌดํšจ ์ฒ˜๋ฆฌ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ”ง ์ œ์•ˆ ์ˆ˜์ •
 const EnvSchema = z.object({
   DATABASE_URL: z.string().min(1),
   DIRECT_URL: z.string().min(1),
   JWT_SECRET: z.string().min(32),
-  ADMIN_USERNAME: z.string().trim().min(1),
+  ADMIN_USERNAME: z
+    .string()
+    .trim()
+    .min(1)
+    .regex(/^[^.]+$/, 'ADMIN_USERNAME must not contain "."'),
   ADMIN_PASSWORD: z.string().trim().min(8),
 })
๐Ÿค– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/web/src/lib/server/env.ts` at line 8, Session validation breaks when
ADMIN_USERNAME contains '.' because admin session format in admin-auth.ts is
username.expiresAt.nonce.signature and validation splits on '.' expecting 4
parts; update the ADMIN_USERNAME schema in env.ts to forbid dots (e.g., require
no '.' via a regex or refine) so usernames like "admin.ops" cannot be created,
and ensure the change references ADMIN_USERNAME and the session
creation/validation logic in admin-auth.ts to keep the 4-part split invariant.

Resolved CodeQL \`js/insecure-password-hashing\` alert by replacing fast HMAC-SHA256 with \`pbkdf2\`. Target hash is precomputed synchronously at module load time to avoid runtime blocking, and incoming password is hashed asynchronously to prevent DoS. Updated route.ts to await the now-asynchronous verifyAdminCredentials function.
@seonghobae

Copy link
Copy Markdown
Author

์ตœ์‹  upstream/main ๊ธฐ์ค€์œผ๋กœ ์ด PR์€ 82๊ฐœ ํŒŒ์ผ์˜ stale diff๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. ํŠนํžˆ .claude agent/skill ํŒŒ์ผ ์‚ญ์ œ์™€ ์˜ค๋ž˜๋œ ์›Œํฌํ”Œ๋กœ์šฐ/lockfile/env ๋ณ€๊ฒฝ์ด ์„ž์—ฌ ์žˆ์–ด ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜๊ฑฐ๋‚˜ upstream์— ์˜ฌ๋ฆฌ๋ฉด ์ด๋ฏธ ๋ฐ˜์˜๋œ ๋ณ€๊ฒฝ์„ ๋˜๋Œ๋ฆด ์œ„ํ—˜์ด ํฝ๋‹ˆ๋‹ค.

ํ˜„์žฌ ํ๋Š” upstream #30 โ†’ upstream #21 ์ˆœ์„œ๋กœ ์ •๋ฆฌ ์ค‘์ž…๋‹ˆ๋‹ค. ์ด PR์˜ ์•„์ด๋””์–ด๊ฐ€ ์—ฌ์ „ํžˆ ํ•„์š”ํ•˜๋ฉด ์ตœ์‹  upstream/main์—์„œ ๋‹จ์ผ ๋ชฉ์  ๋ธŒ๋žœ์น˜๋กœ ๊นจ๋—ํ•˜๊ฒŒ ๋‹ค์‹œ ์ถ”์ถœํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. stale PR๋กœ ๋‹ซ์Šต๋‹ˆ๋‹ค.

@seonghobae seonghobae closed this Jun 10, 2026
@google-labs-jules

Copy link
Copy Markdown

์ตœ์‹  upstream/main ๊ธฐ์ค€์œผ๋กœ ์ด PR์€ 82๊ฐœ ํŒŒ์ผ์˜ stale diff๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. ํŠนํžˆ .claude agent/skill ํŒŒ์ผ ์‚ญ์ œ์™€ ์˜ค๋ž˜๋œ ์›Œํฌํ”Œ๋กœ์šฐ/lockfile/env ๋ณ€๊ฒฝ์ด ์„ž์—ฌ ์žˆ์–ด ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜๊ฑฐ๋‚˜ upstream์— ์˜ฌ๋ฆฌ๋ฉด ์ด๋ฏธ ๋ฐ˜์˜๋œ ๋ณ€๊ฒฝ์„ ๋˜๋Œ๋ฆด ์œ„ํ—˜์ด ํฝ๋‹ˆ๋‹ค.

ํ˜„์žฌ ํ๋Š” upstream #30 โ†’ upstream #21 ์ˆœ์„œ๋กœ ์ •๋ฆฌ ์ค‘์ž…๋‹ˆ๋‹ค. ์ด PR์˜ ์•„์ด๋””์–ด๊ฐ€ ์—ฌ์ „ํžˆ ํ•„์š”ํ•˜๋ฉด ์ตœ์‹  upstream/main์—์„œ ๋‹จ์ผ ๋ชฉ์  ๋ธŒ๋žœ์น˜๋กœ ๊นจ๋—ํ•˜๊ฒŒ ๋‹ค์‹œ ์ถ”์ถœํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. stale PR๋กœ ๋‹ซ์Šต๋‹ˆ๋‹ค.

Understood. Acknowledging that this PR is closed as obsolete and stopping work on this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant