Skip to content

feat: auth codegen added#221

Closed
shivammittal274 wants to merge 1 commit intomainfrom
feat/auth-codegen
Closed

feat: auth codegen added#221
shivammittal274 wants to merge 1 commit intomainfrom
feat/auth-codegen

Conversation

@shivammittal274
Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jan 14, 2026

Greptile Summary

This PR adds authentication support for the codegen service via HMAC-SHA256 signatures. It introduces a new auth utility that signs requests with a shared secret, and integrates optional authentication into both the GraphService (for code generation and graph creation) and ExtractService (for structured data extraction). The feature is backward-compatible with optional credentials - when not configured, services function without authentication.

Key Changes:

  • Added codegen-auth.ts utility for computing HMAC-SHA256 signatures and creating auth headers
  • Extended GraphService to proxy requests to codegen with conditional auth headers
  • Updated ExtractService to apply auth headers when credentials are available
  • Added configuration support for CODEGEN_SERVICE_URL and CODEGEN_HMAC_SECRET via environment variables
  • Updated HTTP server and SDK routes to pass auth credentials through dependency injection
  • All SDK and Graph routes properly handle SSE streaming with event forwarding

Issues Found:

  • Critical: Variable browserosId referenced but not defined in sdk.ts:195 (verify route handler)

Confidence Score: 2/5

  • This PR has a critical runtime error that will cause the verify endpoint to fail immediately when called
  • The PR introduces a critical syntax error in apps/server/src/api/routes/sdk.ts:195 where browserosId is referenced but not defined in the function scope. This will cause a ReferenceError at runtime when the /sdk/verify endpoint is called. The rest of the implementation is solid and well-integrated, but this blocking issue must be fixed before merge. Score of 2 reflects the critical nature of this bug that makes the verify route non-functional.
  • apps/server/src/api/routes/sdk.ts - critical syntax error in verify route handler

Important Files Changed

Filename Overview
apps/server/src/api/utils/codegen-auth.ts New auth utility for HMAC-SHA256 signing of codegen service requests. Implementation is clean, well-commented, and correctly handles signature computation using node:crypto.
apps/server/src/api/routes/sdk.ts SDK routes configured with auth credentials for extract service. Critical issue: Variable 'browserosId' is referenced but not defined in this scope (line 195).
apps/server/src/api/services/graph-service.ts GraphService correctly implements conditional auth header addition and properly streams UIMessageStreamEvent events. Code is well-structured with clear separation of concerns.
apps/server/src/api/services/sdk/extract.ts ExtractService correctly applies HMAC auth headers when both credentials are present. Optional auth pattern is consistent with graph-service approach.
apps/server/src/api/server.ts HTTP server properly passes codegen config to graph and sdk routes. Clean integration with existing route composition pattern.

Sequence Diagram

sequenceDiagram
    participant Client
    participant HttpServer
    participant GraphRoute as Graph Route
    participant GraphService
    participant CodegenService
    participant ExtractService

    Client->>HttpServer: POST /graph (create)
    HttpServer->>GraphRoute: routes request
    GraphRoute->>GraphService: createGraph(query)
    GraphService->>CodegenService: POST /api/code with auth headers
    CodegenService-->>GraphService: UIMessageStreamEvent (SSE)
    GraphService->>GraphService: parseUIMessageStream()
    GraphService->>GraphService: extractSessionData()
    GraphService-->>GraphRoute: forwards events
    GraphRoute-->>Client: SSE stream response

    Client->>HttpServer: POST /sdk/extract
    HttpServer->>ExtractService: extract(instruction, schema, content)
    ExtractService->>CodegenService: POST /api/extract with auth headers
    CodegenService-->>ExtractService: extracted data
    ExtractService-->>HttpServer: result
    HttpServer-->>Client: JSON response
Loading

@claude
Copy link
Copy Markdown

claude Bot commented Jan 14, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@shadowfax92
Copy link
Copy Markdown
Contributor

Closing stale PR.

xiaojinhua (jinhuaxiao) added a commit to jinhuaxiao/BrowserOS-agent that referenced this pull request Mar 25, 2026
3cf77630 chore: bump PATCH and OFFSET (browseros-ai#479)
570ae585 chore: update patch
0168a068 chore: bump PATCH and OFFSET
46b93af1 feat: show updates immediaately on macos
c31d4529 fix: sparkle notification for update fix duplication
37c8ddb2 fix: sparkle crash + notification fix for macos (browseros-ai#425)
e047aec8 feat: add missing patches and split sparkle in features.yaml (browseros-ai#424)
7836d13a fix: hidden windows fix
26d7c34b fix: sidepanel request focus fix
36db7974 chore: server ota
2d8e08e7 chore: Merge branch 'main'
f0896963 chore: bump PATCH and OFFSET
e9e82e66 feat: fix hidden window and tab tools (browseros-ai#417)
02ccf6c0 fix: sidepanel request focus fix
89ab15a3 chore: bump PATCH and OFFSET
e71162be fix: grab handle size (browseros-ai#414)
ad2e1699 fix: OTA binary discovery for artifact-extracted structure (browseros-ai#411)
0d94c1ad chore: bump PATCH and OFFSET
def1bbb2 fix: windows header (browseros-ai#407)
075bc0c0 bump offset & version
5f3d25c2 feat: download latest bundled BrowserOS server resources (browseros-ai#401)
49517236 feat: fix macOS icon size to match Apple HIG padding (browseros-ai#396)
0b8eed30 feat: rename bros CLI tool to bdev (browseros-ai#394)
a7a4cc26 feat: chromium 146 upgrade (browseros-ai#393)
b1ec036b feat: default browseros theme
6c7cd37e feat: enable vertical tabs
9e421356 chore: bump PATCH and OFFSET
9d3d8713 chore: bump PATCH and OFFSET
b54eeb05 chore: bump PATCH and OFFSET
35f7da8b chore: Merge branch 'main'
cebc173a fix: ship AppArmor profile in .deb for Ubuntu 23.10+ (browseros-ai#392)
c4f7e638 chore: bump PATCH and OFFSET
d2d90061 feat: ship bun runtime with binary signing (browseros-ai#391)
5efc4fa0 chore: bump PATCH and OFFSET
9c5c940e chore: bump PATCH and OFFSET
6e88ec97 fix: llm chat shortcuts
ac5ae8be fix: first run url
81e56553 fix: onboarding url
12bd0fe7 feat: update browseros-first-run to browseros-welcome
96037a85 fix: clean-up old nxtscape settings page
c1909cc5 feat: bundle install support
98a62f22 fix: clean-up old clawd support
fb1ebe66 fix: update extension manifest url
a0583e5c chore: bump patch version
384ae883 chore: Merge branch 'main'
8abe6c7d fix: cdp port resolve issue
eecddb08 feat: improve bros patch sync pull/push workflows (browseros-ai#386)
9b73cf39 chore: bump patch
30a44ac4 chore: bump patch version
547a7038 chore: bump patch version
4307346b fix: hidden window fix
0c2098a4 Merge branch 'main' of https://github.com/browseros-ai/BrowserOS
2993371e chore: bump patch version
ba8a71c0 feat: incremental bros pull sync with orphan cleanup (browseros-ai#383)
d595eb05 feat: sentry crash dumps
14d6f5a7 chore: bump patch version
069445d0 chore: bump patch
05b7cebb fix: start cdp earlier
849b3588 chore: bump build version
fb95a221 fix: clean third_party/ also now
6ad48c61 chore: bump patch
120cffb0 fix: use last profile when context not available
4f4fb875 chore: bump patch
03f30780 feat: new cdp domains for bookmarks, tab-groups and history
f6de6e1d feat: bump patch
207fb904 feat: New cdp functions in browser.* domain
551abeb4 feat: getTargetForTab CDP command
a379f2e9 fix: cdp race condition on start
5522bc69 chore: bump patch
0165e441 feat: add tabId and windowId in each targetInfo
8da198f5 chore: bump patch
7ad8738f feat: getTabForTarget CDP implementation
2ba8c622 fix: update base commit
c2f30e87 chore: Merge branch 'main'
852b3402 fix: debug builds not fail on un-used args
35f559c5 fix: windows handle fix
051792e3 feat: login session import fix (browseros-ai#364)
b9c8c3a7 fix: gignore
d08e108e feat/new go cli (browseros-ai#363)
8fd9484e feat: update features.yaml
ee2f3c32 feat: series patch enable
f3cd17d5 fix: update series windows patch
d3bde441 feat: update manifestv2 patch
dcb30d63 fix: update patch no
6aa568e2 feat: chromium 145 upgrade (browseros-ai#362)
25abbe0a fix: change hub to council
09d888cc chore: bump PATCH and OFFSET
23ce4614 feat: update keyboard shortcut for llm chat/hub, support disabling
7179b2f3 chore: bump PATCH and OFFSET
ad25034b feat: fix server crash, port resue
dce0c249 feat: new server proxy port (browseros-ai#349)
be0d98e2 fix: fix perf patch
59c9be72 chore: bump PATCH and OFFSET
d89228c9 fix: screenshot api in browseros api (browseros-ai#344)
979de65b fix: memory saver disabled by default
02d82336 fix: llm chat blanking issue
1f02c74a chore: bump PATCH and OFFSET
cb3d640d feat: /shutdown API integration for health check and better restart handling (browseros-ai#340)
359b3b0f feat: clawdbot integration (browseros-ai#339)
52fc6eb7 fix/server fixes (browseros-ai#331)
a019baba chore: bump PATCH and OFFSET
3f776d94 chore: bump PATCH
2ee7b63f chore: bump PATCH
447b3dc5 feat: support windows ota signing on macos (browseros-ai#323)
9eb8575e chore: bump PATCH and OFFSET
207d0dd6 chore: bump PATCH and OFFSET
ebd1f4e7 feat: new choosePath browseros API (browseros-ai#321)
ae02c7b9 fix: windows use base::span directly (browseros-ai#320)
bfb3ab09 fix: update import patch to fix build issue
ad5947a9 chore: bump PATCH and OFFSET
5178be0a fix: features.yaml upate
9850372b feat: support better imports  (browseros-ai#316)
5b254761 fix: sparkle mac updater timeout (browseros-ai#305)
3039a3ab chore: bump PATCH and OFFSET
75dcce8c fix: error code based port restarts (browseros-ai#303)
b3a85ff3 fix: executable flag for download resources
8d682348 fix: add download_resources module for release
73fd4e31 chore: Update offset and patch
6f15fcd7 fix/extension server fixes chromium (browseros-ai#290)
bec452cd feat: new download resources (browseros-ai#289)
77e78c87 feat: cli support for server ota (browseros-ai#286)
37c3879e chore: bump PATCH and OFFSET
0058b1c3 feat: new browseros prefs, better toolbar pin/unpin
bf32343d chore: Merge branch 'main'
e1b8ddfb fix: extract module better patch deletion support
4a4962ec feat: improve extension installer + updater (browseros-ai#278)
74355287 fix: first-run page fix the settings link
5d51d577 chore: release - 0.35.0 (browseros-ai#273)
a2aa77d2 feat: browseros-server OTA support (browseros-ai#272)
5374aa52 fix: remove un-used patch
02fcbc7c release/0.34.0 (browseros-ai#264)
3c0f0e88 feat: windows icon fix (browseros-ai#263)
6e7e7ed9 fix: sparkle build flag (browseros-ai#260)
06339788 chore: bump PATCH and OFFSET
1ea13807 fix: patch: sparkle build flag check only on mac
a7b98dbf Revert "fix(packaging): Correctly enable SUID sandbox for .deb (browseros-ai#243)"
c9a43d51 chore: bump PATCH and OFFSET
b89142f9 feat: windows icon fix, new icon generation (browseros-ai#259)
428d71cb feat: mac sparkle fixes and browseros path refactor (browseros-ai#258)
0e738379 chore: update about page link to use https
43e882f5 chore: Merge branch 'main'
73c93578 fix: release-cli improvements to better list release
6c86ba74 fix(packaging): Correctly enable SUID sandbox for .deb (browseros-ai#243)
5c877019 fix: release-cli - fix github upload and version name
5ccb638d release/0.33.0 (browseros-ai#252)
bd83fb0b Revert "feat/new mac udpater (browseros-ai#249)"
86bc49eb Revert "feat: browseros server fixes (browseros-ai#250)"
bece4bf8 Revert "fix: update extension_managment patch"
ad9036fb fix: update extension_managment patch
e3d61be8 chore: bump PATCH and OFFSET
46d969f2 feat: browseros server fixes (browseros-ai#250)
3dbb1c51 feat/new mac udpater (browseros-ai#249)
d51af600 fix: features.yaml
e7c52fed fix: cli improvements (browseros-ai#248)
827811fd chore: bump PATCH and OFFSET
fcd22e9d fix: brwoseros-server bug fix around port allocation
7d0be97a chore: bump PATCH and OFFSET
cb0fed15 fix: browseros-server patch updates (browseros-ai#244)
61d7f59f fix: package linux include correct icon (browseros-ai#235)
92a6ca86 chore: release/0.32.0.1 (browseros-ai#234)
81d6a366 chore: update features.yaml
3e45ee17 chore: bump PATCH version
ca873e77 feat: remove old browseros extension
17fbd58b ci: Merge branch 'main'
20b1e8d3 feat: extension ota fixes, info bar and new build (browseros-ai#231)
95f0b08d fix: add misisng validation.py module
bc65c9aa fix: --reset-to delete file if not present in old commit
e06302fc fix: features.yaml update
b86b0d49 fix: cli improvements (browseros-ai#230)
a2db974e fix: more features.yaml updates
018267ea fix: clean-up features.yaml with proper naming
caff5104 fix: windows path for server config
50f76aba chore: bump PATCH to 0.31.0.11
2ef14682 fix: add alpha extension url
5733109e Merge branch 'main'
2913e21d chore: bump PATCH to 0.31.0.10
22d2f542 feat: release/0.31.9 + new patches (browseros-ai#228)
3611df1a fix: windows icon fix
b3461da2 fix: windows icon fix
39dfc58f release/0.31.8 (browseros-ai#225)
a8bc5982 feat: download module in release cli
2f45ad17 feat: add download urls in release cli
4e367f23 feat: ship ublock origin
49d3e8de New agent toolbar fixes + few chromium UI flags (browseros-ai#223)
ea647ea9 chore: bump PATCH version
1b97f954 cli improvements (browseros-ai#222)
af4a5c5a fix: enable alpha by default
05434129 fix: minor arg issue
38231f28 release/0.31.2 (browseros-ai#221)
fa3101db patches & fixes for 0.31.1 release (browseros-ai#219)
a6b2a6a4 chore: update PATCH
5b8f4686 chromium patch upates (browseros-ai#217)
71eaabaa bump offset & version
50b2e328 cli improvements, new release cli (browseros-ai#215)
1b1f034a fix: extension pinning
280cd47d clean-up: removed old build files
0264e743 bump offset & version
3dc82182 chromium 142 upgrade, new cli (browseros-ai#214)
2931460f Revert "fix(windows): warning icon when pinned on taskbar on windows"
e5bc6246 fix(windows): warning icon when pinned on taskbar on windows
fe6aa7c1 Update chrome_browser_main.cc patch to handle iCloud Passwords Extension fix
a47b8d9f feat: add new browseros agent v2 extension
dcc20993 Enable light mode as the default
87e9ee97 Added new files to features.yaml
e4c51cf8 New extraction logic for LLM Chat copy button
9792bf77 Merge branch 'main' of https://github.com/browseros-ai/BrowserOS
c5033f02 release-0.30.0 updates
6e69f915 Added missing files to features.yaml
4a1f6e2a Minor change
9a49fea0 Dedup features.yaml and add build_annotate script
bf7651e3 Release - 0.30.0 (browseros-ai#195)
83a39988 Revert "updates to build.py apply/patch"
eb40fafc updates to build.py apply/patch
0756ebc5 add uv project
33c9cac3 resource dir as execution path in macos and windows, only override in linux
4679aca0 Fixes for new agent release (browseros-ai#186)
b15eeaf6 build fixes (browseros-ai#156)
490a2340 release/0.29.0 (browseros-ai#151)
89b9584b bump version
cb082bed browseros api: new get snapshot API
37e6f756 browseros api: fix accessbility tree API
50bba831 Revert "fix: mark browseros domain as safe"
f70979ec browseros mcp support (browseros-ai#135)
cafd2c33 bump version
d905a390 patch: fix llm chat and llm hub to read new prefs
d07ffa63 upload .deb file
b1ef1bcc features yaml
b3f0d9f2 fix: mark browseros domain as safe
b842f8ab Bump version
5de1a3c6 Bump version
8fc5ebdd adding debian package
2044d7ab fix signing in windows as part of build
935f125c hide browseros-ai in settings page
e07c859c browseros settings page url display update
ab97d936 use new pref url in llm hub
cc09815b update llm chat to support configuring urls
80148d89 fix extension disable issue
7ddb3188 update first run page
70735481 fix: first run url for settings
66b224ca mac and windows sign yaml files
1d81999b uplaod to gcs cli
b890e7f2 update build docs and flags
5898a173 bump version
aad7349e Update README
702a63c5 chore(monorepo): move BrowserOS under packages/browseros (preserve history)
REVERT: bf7a49e9 add 补丁
REVERT: 526d5168 chore: update browseros-agent and server prefs
REVERT: afce8eda fix: add canvas fingerprint noise to toDataURL/toBlob/readPixels
REVERT: 75c11fbc feat(build): load app name from branding.yaml config
REVERT: 379cd3c9 feat: BrowserOS with kernel-level fingerprint customization

git-subtree-dir: packages/browseros
git-subtree-split: 3cf776308dbe80092be0f1f22239f69eb3fdf8ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants