Skip to content

Feature/base - #3

Merged
gauthamp10 merged 10 commits into
mainfrom
feature/base
Mar 19, 2026
Merged

gauthamp10 merged 10 commits into
mainfrom
feature/base

Conversation

@gauthamp10

Copy link
Copy Markdown
Owner

No description provided.

Rename docs/sceenshots → docs/screenshots (typo fix).
Add a 2-column screenshot grid to README covering login,
repository browser, git graph, merge requests, pipelines,
and insights.

Made-with: Cursor
Upload files
- New UploadFileDialog component: drag-and-drop zone + file picker,
  multi-file support, target-branch field, commit message, base64
  encoding for all file types via FileReader.readAsDataURL
- 'Upload file' button added to the repository toolbar, gated behind
  canWriteRepo (write_repository / api scope) with PermGate tooltip
- On success the tree query is invalidated so the file list refreshes
  without a page reload

Inline editor
- New InlineEditor component: full-height monospace textarea, commit
  message field, target-branch field, 'unsaved changes' indicator,
  Commit / Cancel actions
- 'Edit' button appears in the FileViewer page header for text files,
  hidden for binary files, gated behind canWriteRepo
- On commit the file query is invalidated so the viewer immediately
  shows the updated content; if the target branch differs from the
  current ref the URL is updated accordingly
- last_commit_id is passed to updateFile to prevent overwriting
  concurrent changes (GitLab 409 conflict protection)

API
- repository.ts: added createFile (POST) and updateFile (PUT) methods,
  both accept base64-encoded content
- types/gitlab.ts: added GitLabFileOperation response type

Made-with: Cursor
- useCursorBlob hook: tracks mouse position and drives two gradient
  blobs via requestAnimationFrame + lerp (no React state updates per
  frame — writes directly to DOM refs for zero-overhead animation)
- Primary blob (600px, 18% primary colour): follows cursor at 8% per
  frame for a smooth, slightly-lagging feel
- Secondary blob (400px, 10% primary colour): follows at 40% of the
  primary movement for a parallax depth effect
- Dot-grid texture overlay (opacity 3.5% light / 6% dark) adds subtle
  depth to the background
- Four decorative accent rings in top-right and bottom-left corners
  using the primary colour at low opacity
- All decorative layers are pointer-events:none and kept below the
  form content with z-index layering
- willChange:transform on blobs tells the browser to keep them on the
  GPU compositor layer

Made-with: Cursor
…eholder

Adding the guest-mode host input gave the page two inputs with the same
placeholder 'https://gitlab.com', breaking getByPlaceholderText().
Switched all four affected queries to getByLabelText('GitLab Host URL')
which targets the PAT-form input specifically via its <Label> element.

Made-with: Cursor
normalizeHost was being called on every keystroke, rewriting the first
character typed ('h' → 'https://h') so subsequent characters were
appended to the transformed value instead of the original input.
This made it impossible to type 'http://' and broke the insecure-
connection warning and the related tests.

normalizeHost is still applied on form submit where it belongs.

Made-with: Cursor
Comment thread src/pages/Login.tsx Fixed
@github-actions

github-actions Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

The 'Create token' link constructed its href by interpolating the raw
host text-input directly:

  href={`${host}/-/user_settings/...`}

A user who typed 'javascript:alert(1)' as the host would produce a
javascript: URI in the DOM, which the browser executes on click —
a high-severity DOM XSS vector flagged by static analysis.

Fix: pipe the full URL through safeExternalHref() (which only allows
http: and https: protocols) and conditionally render the link.  The
link simply disappears while the host field contains an invalid or
non-http(s) value, which is correct UX since there is nothing to link
to until a valid GitLab instance URL is entered.

Made-with: Cursor
Comment thread src/pages/Login.tsx Fixed
Two tainted data flows were still tracked by the static analyser
from external sources through to DOM sinks in Login.tsx:

1. User-supplied host interpolated into error string
   setError(`Cannot reach ${host}...`) puts the raw text-input value
   into the error state which is then rendered in JSX.  Replaced with
   a fixed-text message that contains no user-controlled data.

2. API-response error message rendered verbatim
   setError(err.message) propagates data.message from the server JSON
   response body directly to the DOM.  Added .replace(/<[^>]*>/g, '')
   to explicitly strip any HTML tags before display, eliminating the
   network→DOM taint path that static analysers flag even though React
   text nodes are auto-escaped at runtime.

3. API-sourced avatar URL in img src
   instance.user.avatar_url (from GitLab API) was used directly as an
   img src.  Now validated through safeExternalHref() so only http/https
   URLs reach the attribute.

Also: wrap Login test render in QueryClientProvider so useQueryClient()
inside the component does not throw during tests.

Made-with: Cursor
Comment thread src/pages/Login.tsx Fixed
…sages

Two CodeQL-reported issues remain after previous sanitisation passes:

1. createTokenHref (href attribute, CWE-79)
   The prior fix used safeExternalHref() but CodeQL does not model custom
   functions as sanitisers, so the taint from the host input still reached
   the href attribute via the template literal.
   Fix: rebuild the URL from `new URL(host).origin` (a URL-object property,
   not raw user input), which CodeQL recognises as a safe boundary.

2. err.message stored in state → rendered in DOM (CWE-116 / CWE-79)
   The regex /<[^>]*>/g did not strip partial tags such as `<script`
   (no closing `>`), leaving a residual injection vector.
   Fix: never store any API-sourced string in state. The catch block now
   checks `err instanceof ApiError` first and derives every displayed
   message from the numeric `err.status` property — a number cannot
   carry HTML, breaking the taint chain completely.

All 117 tests pass.

Made-with: Cursor
@gauthamp10
gauthamp10 merged commit 9bca6b0 into main Mar 19, 2026
15 checks passed
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.

2 participants