Skip to content

Fix handling of --quiet flag in fleetctl query - #2

Merged
zwass merged 1 commit into
fleetdm:masterfrom
zwass:fix-fleetctl-query-quiet
Nov 3, 2020
Merged

zwass merged 1 commit into
fleetdm:masterfrom
zwass:fix-fleetctl-query-quiet

Conversation

@zwass

@zwass zwass commented Nov 3, 2020 •

Copy link
Copy Markdown
Member

Fixes an issue in which the status was erroneously displayed after results were printed.

@zwass zwass added the bug Something isn't working as documented label Nov 3, 2020
@zwass zwass closed this Nov 3, 2020
@zwass zwass reopened this Nov 3, 2020
@zwass
zwass merged commit 72b0efc into fleetdm:master Nov 3, 2020
@zwass
zwass deleted the fix-fleetctl-query-quiet branch November 3, 2020 23:50
@noahtalerman noahtalerman mentioned this pull request May 6, 2022
3 tasks done
@ghernandez345 ghernandez345 mentioned this pull request Jan 25, 2023
17 tasks done
@sharon-fdm sharon-fdm mentioned this pull request May 1, 2023
14 tasks done
@marcosd4h marcosd4h mentioned this pull request Sep 20, 2023
2 tasks done
RachelElysia added a commit that referenced this pull request Jul 21, 2026
- (#1) Swap useEffect/[showSearch] focus for native autoFocus on the
  search input. react-select unmounts <Menu> on close, so the input is a
  fresh DOM node on each open — autoFocus fires reliably without
  depending on effect deps semantics.
- (#2) Key CustomMenuList's useLayoutEffect on React.Children.count(...)
  so it only re-measures scroll dimensions when the option list actually
  changes (search filter shrink/expand). onScroll still covers user-
  driven position changes.
- (#3) menu.zIndex 6 -> 99 (page-overlay tier), __scroll-fade z-index
  1 -> 9 (in-flow overlay tier), matching the 9/99/999 convention.
- (#4) Add optional onAddFleet callback prop. If provided, fires
  instead of the browserHistory.push fallback — lets consumers use
  their own router.push. Nine current callers unaffected.
- (#8) TODOL -> TODO: typo in the tests file (inherited from the
  deleted TeamsDropdown.tests.tsx).
RachelElysia added a commit that referenced this pull request Jul 21, 2026
- (#1) Extract getHiddenInput() helper. The double-cast to reach
  react-select's undocumented `inputRef` field was duplicated at two
  sites (menu-open focus effect + forwardNavKey bridge). Both now
  read through the helper — if react-select ever renames the field,
  the escape hatch fails in one place, not two.

- (#2) Stash onClose in onCloseRef so an inline callback from a
  parent doesn't retrigger the menuIsOpen-transition effect on every
  parent render. The effect deps are back to [menuIsOpen] alone and
  reads onCloseRef.current?.() at fire time.

- (#5) Extract isPrimoModeEnabled / isGitOpsModeEnabled locals
  instead of inlining the three nested optional-chain checks. Matches
  the permissions.isPrimoMode / permissions.isSandboxMode naming
  used elsewhere in the codebase and reads at a glance.
RachelElysia added a commit that referenced this pull request Jul 22, 2026
  stale comment, side effects in state updater

- (#2) Rework the scroll-fade to a 0-height sticky anchor with an
  absolutely-positioned ::before pseudo-element toggled via opacity on
  a --visible modifier. The old approach mounted/unmounted a 35px
  sticky div, so MenuList.scrollHeight grew and shrank as the fade
  toggled — browsers can clamp scrollTop when scrollHeight shrinks,
  causing a visible jump near the end of the list. The anchor is
  always in the DOM at 0 flow height; scroll metrics stay stable.

- (#3) Chain react-select's own innerProps.onScroll and innerProps.
  onMouseDown before our custom logic. The previous spread-then-
  override pattern silently dropped whatever react-select provided,
  which could break its own scroll-to-highlighted-option or focus
  tracking on a future version.

- (#5) Fix stale comment on the hidden-input-focus useEffect. It said
  "CustomMenuList focuses the search input on mount," but the search
  input now lives in CustomMenu and uses native autoFocus. Corrected
  the comment to reflect where focus actually comes from.

- (#6) Move side effects (onOpen? / setSearchQuery) out of the
  setMenuIsOpen state updater in toggleMenu. React's Strict Mode
  double-invokes state updaters, which would double-fire onOpen and
  double-clear searchQuery. Reading menuIsOpen directly is safe — a
  single user click can't race with itself.
RachelElysia added a commit that referenced this pull request Jul 22, 2026
- (#1) preventDefault on Enter in addFleetKeyDown. Fleet Button's own
  handleKeyDown synthesizes onClick from Enter, so without preventDefault
  the browser ALSO synthesizes a native click after keyup, firing
  onClickAddFleet a second time. jsdom didn't catch this (it doesn't
  synthesize click from keyDown); the double-fire only manifests in a
  real browser. Space is left with stopPropagation only — Fleet Button
  has no Space handler, and native click synthesis is Space's only
  activation path.

- (#2) Dev-only console.warn in getHiddenInput() when
  SelectInstance.inputRef is unexpectedly missing. Surfaces a
  react-select upgrade breaking the keydown-forwarding bridge loudly
  in dev instead of silently regressing keyboard nav.

- (#4) Consolidate searchQuery clearing into the menuIsOpen transition
  effect. The same setSearchQuery("") was duplicated at 5 close origins
  (click-outside, toggleMenu, handleChange, onClickAddFleet,
  onMenuClose). All 5 removed; the transition effect is now the single
  source of truth for close-side state cleanup.

- (#6) Story decorator: height: 600 -> minHeight: 780. The old fixed
  height clipped scrollable-list stories when the open menu grew past
  600px; minHeight 780 (menu maxHeight 715 + trigger + margin) lets the
  full menu render without clipping.
lucasmrod pushed a commit that referenced this pull request Aug 6, 2026
**Related issue:** Resolves #49483

## What & why

The `/os_versions` API endpoint returned misleading success responses
for three invalid inputs. This PR makes each return a proper error:

1. **Invalid `platform` filter** (e.g. `?platform=notrealplatform`)
previously returned `count: 0` with `200 OK`, indistinguishable from "no
matching OS versions." It now returns a `422` validation error listing
the supported platforms (`darwin`, `windows`, `linux`, `chrome`, `ios`,
`ipados`, `android` — matching the documented filter values).

2. **Unknown OS version id** (e.g. `/os_versions/99999`) previously
returned `200 OK` with a null/zero-filled `os_version` object. It now
returns a not-found (`404`) error.

3. **Negative `max_vulnerabilities`** (e.g. `?max_vulnerabilities=-5`)
returned a message reading `must be >= 0` — Go's JSON encoder
HTML-escapes `>`. The message is reworded to `max_vulnerabilities cannot
be negative`, which is clearer and avoids the escaped character.

### ⚠️ Note for reviewer (fix #2)
The single-version handler previously swallowed the datastore's
not-found error and returned an empty result on purpose, with the
comment: *"It is possible the os version exists, but the aggregation job
has not run yet."* This PR removes that swallow so a missing id returns
`404`. If you'd prefer to preserve the empty-result behavior for the
"not yet aggregated" case, I'm happy to adjust — flagging so the change
is intentional and visible.

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented.

## Testing

- [x] Added/updated automated tests (`TestOSVersionsErrorHandling` in
`server/service/hosts_test.go`, covering all three cases).
- [x] QA'd all new/changed functionality manually

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Unsupported OS platform filters now return a clear validation error
instead of an empty-like result.
* Unknown OS version IDs now return HTTP **404 Not Found** rather than a
success response with null/zero fields.
* `max_vulnerabilities` validation now rejects negative values with an
accurate, readable message and consistent HTTP **422** responses.
* Error responses for OS versions endpoints now reflect the correct
status codes.
* **Tests**
* Updated and added coverage to assert the new error-handling and HTTP
status expectations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
RachelElysia added a commit that referenced this pull request Sep 10, 2026
Lint:
- Replace `void el.offsetWidth` with `el.getBoundingClientRect()` for
  the reflow force (no-void).
- Convert for-of loops to forEach (no-restricted-syntax).
- Drop irregular whitespace from helpers.tests.tsx regex chars in
  favor of `\s?`, and update the accompanying comment to name the
  code points instead of pasting them.

Copilot #1 (software.go): swap `x := r.Field; s.Ptr = &x` triples
for Go 1.26 `new(r.Field)` — matches Fleet's pointer convention and
drops the extra locals.

Copilot #2 (chip gating): the auto-update cron in apple_mdm.go's
handleScheduledUpdates only acts on ios_apps / ipados_apps sources,
so surfacing the "Auto updates" chip on a macOS VPP row (if a
schedule row ever exists) would misrepresent behavior. Gate the
details-page chip on isIosOrIpadosApp in addition to VPP + enabled,
and mirror the same gate in the name-cell composite via
getInstallIconType so the list surfaces stay consistent.
allenhouchins added a commit that referenced this pull request Nov 20, 2026
…s are part of the test (#59229)

**Related issue:** N/A. Drafted from an approved pitch in
#_content-news-digest (Wednesday, November 18 digest).

Adds an industry news article on Canonical's opt-in Edge archive for
Ubuntu Pro, which ships security fixes written by its Surge multi-agent
system and approved by a panel of judge models before Canonical's
qualification is finished. The pitch's angle: adopting early AI-written
patches makes verification on the device more important. The article
explains how Surge works and what "before qualification" means, then
shows how to find which Ubuntu hosts opted in (`pro-edge` package, Edge
apt source, installed versions) and how to enforce the team's decision
with a Fleet policy.

**Author:** Aube Paul (`robinedev`). Aube approved the pitch with the
:check: reaction in #_content-news-digest. They were the only approver
on the message, so the article is attributed to them.

**Category:** `industry news`

### Title selection

Last three pipeline titles: "ARTEX agents inventoried the Windows
machines missing CrowdStrike Falcon. Do you have that list?" (statement
+ question), "Microsoft's November slmgr fix is optional and mostly
Catalog-only, so check for it by build number" (statement +
instruction), and "From 120 days to 30: Project Zero's disclosure clock
is closing the gap on your patch cycle" ("From X to Y" colon
trajectory).

Candidates:
1. **If a judge model approved your Ubuntu patch, your servers are part
of the test** (selected, conditional "if X, then Y")
2. Canonical's Surge agents now write Ubuntu security patches that reach
Pro users before human testing ends (straight news statement)
3. Ubuntu's Edge archive puts AI-written patches on 18.04 through 26.04
LTS, one apt install at a time (scope and number lead)
4. Five LTS releases, one opt-in command, and AI-written patches inside
Ubuntu Pro's Edge archive (list lead)
5. "Ubuntu.*Edge" is the apt origin to search for once AI-written
patches reach your Linux hosts (quoted-detail lead)

Picked #1 over runner-up #2 because #2 restates the headline every
outlet already ran. "Judge model" is the most unusual concrete detail in
the story, and the second half turns it into the reader's stake:
Canonical explicitly uses Edge users' feedback to qualify fixes, so
opted-in hosts really are part of the test.

### Claims to verify before publishing
- Facts come from Canonical's November 12 blog post, the Ubuntu
Discourse "How to enable the Edge archive" guide, Help Net Security, The
Register, and OMG! Ubuntu, read through a summarizing fetch tool. Please
spot-check the quoted Canonical lines and the Guillemin CVE claim (via
The Register) against the live pages.
- The `apt_sources` report assumes the Edge Release file's Origin maps
to the `maintainer` column and matches `Ubuntu%Edge` (derived from the
guide's `^Ubuntu.*Edge$` origin pattern). I didn't test it on a host
with Edge enabled; the article tells readers to confirm on a test host.
- The `deb_packages` queries and the policy are untested against a live
host.
- Supported releases (18.04 through 26.04 LTS) and the ESM Infra/ESM
Apps requirement come from the Discourse guide and OMG! Ubuntu;
Canonical's blog doesn't list them.

## Testing

- [x] Description is 150 characters (at the build limit). No em dashes.
`articleTitle` matches the H1. All fleetdm.com links point at pages
other articles already use.

## AI

**AI:** Claude Code (claude-opus-5-5)

https://claude.ai/code/session_015TcYaiLeiedp2tvkea5hjz

---
_Generated by [Claude
Code](https://claude.ai/code/session_015TcYaiLeiedp2tvkea5hjz)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: robinedev <aubedev@outlook.com>
allenhouchins added a commit that referenced this pull request Nov 20, 2026
…owdStrike Falcon. Do you have that list? (#59048)

**Related issue:** N/A. Drafted from an approved pitch in
#_content-news-digest (Tuesday, November 17 digest).

Adds an industry news article on the FBI's November 13 FLASH alert
(FLASH-20261113-001) and Amazon's same-day findings on the ARTEX AI
agent framework. The pitch's angle is the under-three-hour clock. The
article grounds it in one line from the FBI's technique table: the
agents inventoried sensor coverage to find Windows machines without
CrowdStrike Falcon, a list defenders can build first.

**Author:** Aube Paul (`robinedev`). Aube approved the pitch by adding
the :check: reaction in #_content-news-digest (the only approver on the
message), so the article is attributed to them.

**Category:** `industry news`

### Title selection

Last three pipeline titles: "Microsoft's November slmgr fix is optional
and mostly Catalog-only, so check for it by build number" (statement +
instruction), "From 120 days to 30: Project Zero's disclosure clock is
closing the gap on your patch cycle" ("From X to Y" trajectory), and
"Two of Citrix's 12 November fixes belong on your laptops, not the
gateway" (numeric claim + contrast).

Candidates:
1. **ARTEX agents inventoried the Windows machines missing CrowdStrike
Falcon. Do you have that list?** (selected, named detail + direct
question)
2. The FBI clocked ARTEX at under three hours to privileged access. A
weekly scan won't see it. (timed claim + consequence)
3. "Compressed detection window" is the FBI's phrase for ARTEX, and it
lands on whoever manages the devices (quoted-phrase lead)
4. SSH keys, new accounts, and vshell are the host traces in the FBI's
ARTEX alert (list lead)
5. ARTEX is loud enough to trip alerts, the FBI says, and finishes
before anyone answers them (paradox statement)

Picked #1 over runner-up #2 because every outlet covering this alert
leads with "under three hours," so #2 reads like the headlines already
out there. The sensor-coverage line is a detail most coverage skipped,
it names a tool many readers run, and the question is one a reader can
answer only by checking their own devices.

### Claims to verify before publishing
- All ARTEX facts come from the FBI FLASH PDF, which I read in full, and
the AWS Security Blog post, which I read through a summarizing fetch
tool. The CJ Moses quotes ("succeeded where basic security hygiene was
missing," "moderate confidence") should be checked against the live
post.
- The FBI lists "blocked by endpoint protection" and the sensor-coverage
inventory as separate table rows. The article says the FBI doesn't
connect them and draws the inference itself.
- The FBI alert uses "super intelligence (SI) agents." The article says
"AI agents."
- The SQL is copied from the "Get CrowdStrike sensor status" report in
`docs/01-Using-Fleet/standard-query-library/standard-query-library.yml`.
I did not run it against a live host. The top CTA links to
https://fleetdm.com/reports, please confirm that report appears there.
- This covers similar ground to the November 2 Aur0ra article (AI
agents, old techniques, Fleet is not an EDR). The sensor-gap angle is
new, but an editor may want to trim overlap.

## Testing

- [x] Description is 129 characters (under the 150-character build
limit). No em dashes. `articleTitle` matches the H1. Links point at
pages other articles already use.

## AI

**AI:** Claude Code (claude-fable-5-2)

https://claude.ai/code/session_015TcYahmiJyNQVnAN5AFPA8

---
_Generated by [Claude
Code](https://claude.ai/code/session_015TcYahmiJyNQVnAN5AFPA8)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: robinedev <aubedev@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant